-
-
Notifications
You must be signed in to change notification settings - Fork 5
156 lines (129 loc) · 5.01 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
on: [push, pull_request]
name: build
jobs:
test:
strategy:
matrix:
go-version: [1.23.x]
os: [ubuntu-24.04, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
targetplatform: [x64]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: false
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Checkout code
uses: actions/checkout@v4
- name: Get dependencies
run: |
env GO111MODULE=on go vet ./...
pip install coverage
- name: Build
run: go build -v .
- name: Test on Windows
env:
CGO_ENABLED: 1
if: matrix.os == 'windows-latest'
run: go build -buildmode=c-shared -o libexcelize.amd64.windows.dll main.go && coverage run -m unittest
- name: Test on Linux
env:
CGO_ENABLED: 1
if: matrix.os == 'ubuntu-latest'
run: go build -buildmode=c-shared -o libexcelize.amd64.linux.so main.go && coverage run -m unittest
- name: Test on macOS
env:
CGO_ENABLED: 1
if: matrix.os == 'macos-latest'
run: go build -buildmode=c-shared -o libexcelize.arm64.darwin.dylib main.go && coverage run -m unittest
- name: Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
flags: unittests
name: codecov-umbrella
build:
runs-on: macos-latest
needs: [test]
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x
cache: false
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Checkout code
uses: actions/checkout@v4
- name: Get dependencies
run: |
env GO111MODULE=on go vet ./...
pip install coverage
- name: Build Shared Library
env:
CGO_ENABLED: 1
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew tap messense/macos-cross-toolchains
brew install FiloSottile/musl-cross/musl-cross i686-unknown-linux-gnu mingw-w64
wget https://github.com/mstorsjo/llvm-mingw/releases/download/20241203/llvm-mingw-20241203-ucrt-macos-universal.tar.xz
tar -xzf llvm-mingw-20241203-ucrt-macos-universal.tar.xz
export PATH="$(pwd)/llvm-mingw-20241203-ucrt-macos-universal/bin:$PATH"
CC=i686-linux-gnu-gcc GOOS=linux GOARCH=386 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.386.linux.so main.go
CC=x86_64-linux-musl-gcc GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.amd64.linux.so main.go
CC=aarch64-linux-musl-gcc GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.arm64.linux.so main.go
CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.amd64.windows.dll main.go
CC=i686-w64-mingw32-gcc GOOS=windows GOARCH=386 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.386.windows.dll main.go
CC=aarch64-w64-mingw32-gcc GOOS=windows GOARCH=arm64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.arm64.windows.dll main.go
CC=gcc GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.arm64.darwin.dylib main.go
CC=gcc GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -buildmode=c-shared -o libexcelize.amd64.darwin.dylib main.go
rm -f libexcelize.*.h
- uses: actions/upload-artifact@v4
with:
name: libexcelize
path: |
libexcelize.386.linux.so
libexcelize.amd64.linux.so
libexcelize.arm64.linux.so
libexcelize.amd64.windows.dll
libexcelize.386.windows.dll
libexcelize.arm64.windows.dll
libexcelize.arm64.darwin.dylib
libexcelize.amd64.darwin.dylib
publish:
runs-on: ubuntu-latest
needs: [build]
environment:
name: pypi
url: https://pypi.org/p/excelize
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Checkout code
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ./
- name: Build Python Package
run: |
pip install build setuptools wheel
python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1