-
Notifications
You must be signed in to change notification settings - Fork 13
223 lines (198 loc) · 6.4 KB
/
Copy pathbuild.yml
File metadata and controls
223 lines (198 loc) · 6.4 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: build
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "*" ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-latest]
build_type: [Release]
shared_libs: [ON, OFF]
exclude:
# Windows only builds statically: the shared build scatters DLLs
# across _deps subdirs so ganak.exe can't find them at runtime.
- os: windows-latest
shared_libs: ON
steps:
- name: Set up MSYS2
if: contains(matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-gmp
mingw-w64-x86_64-mpfr
mingw-w64-x86_64-flint
mingw-w64-x86_64-zlib
mingw-w64-x86_64-pkgconf
make
- uses: actions/setup-python@v5
if: "!contains(matrix.os, 'windows')"
with:
python-version: '3.10'
- name: Setup ccache
if: "!contains(matrix.os, 'windows')"
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.shared_libs }}
max-size: 500M
- name: Install gmp for Mac
if: contains(matrix.os, 'macos')
run: |
wget https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz
tar xf gmp-6.3.0.tar.xz
cd gmp-6.3.0
./configure --enable-static --enable-cxx --enable-shared --with-pic
make -j8
sudo make install
cd ..
- name: Install zlib for Mac dynamic
if: contains(matrix.os, 'macos') && matrix.shared_libs == 'ON'
run: |
wget https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz
tar xzvf zlib-1.3.1.tar.gz
cd zlib-1.3.1
./configure
make -j8
sudo make install
cd ..
- name: Install zlib for Mac static
if: contains(matrix.os, 'macos') && matrix.shared_libs == 'OFF'
run: |
wget https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz
tar xzvf zlib-1.3.1.tar.gz
cd zlib-1.3.1
./configure --static
make -j8
sudo make install
cd ..
- name: Install mpfr for Mac
if: contains(matrix.os, 'macos')
run: |
wget https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.1.tar.xz
tar xf mpfr-4.2.1.tar.xz
cd mpfr-4.2.1
./configure --enable-static --enable-cxx --enable-shared
make -j8
sudo make install
cd ..
- name: Install dependencies for Linux
if: contains(matrix.os, 'ubuntu')
run: sudo apt-get update && sudo apt-get install -yq help2man libgmp-dev libmpfr-dev
- name: Install flint
if: "!contains(matrix.os, 'windows')"
run: |
wget https://github.com/flintlib/flint/releases/download/v3.2.0-rc1/flint-3.2.0-rc1.tar.gz
tar xzf flint-3.2.0-rc1.tar.gz
cd flint-3.2.0-rc1
./configure --enable-static --enable-shared
make -j8
sudo make install
cd ..
- uses: actions/checkout@v4
with:
path: project
submodules: 'true'
- name: Build project (non-Windows)
if: "!contains(matrix.os, 'windows')"
run: |
cd project
mkdir -p build && cd build
cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} \
-DENABLE_TESTING=OFF \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-S ..
cmake --build . --config ${{matrix.build_type}} -v
- name: Build project (Windows)
if: contains(matrix.os, 'windows')
shell: msys2 {0}
run: |
cd project
mkdir -p build && cd build
cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} \
-DENABLE_TESTING=OFF \
-G Ninja \
-S ..
cmake --build . --config ${{matrix.build_type}} -v
- name: Test
if: "!contains(matrix.os, 'windows')"
run: ctest -C ${{matrix.build_type}} --verbose
- name: run it to check it executes (non-Windows)
if: "!contains(matrix.os, 'windows')"
run: |
echo "Running version command"
./project/build/ganak --version
echo $?
echo "Running help command"
./project/build/ganak --help
echo $?
- name: run it to check it executes (Windows)
if: contains(matrix.os, 'windows')
shell: msys2 {0}
run: |
EXE=./project/build/ganak.exe
echo "Running: $EXE --version"
$EXE --version
echo $?
echo "Running: $EXE --help"
$EXE --help
echo $?
- name: Upload Artifact - Linux
if: contains(matrix.os, 'ubuntu') && matrix.shared_libs == 'OFF' && !contains(matrix.os, 'arm')
uses: actions/upload-artifact@v4
with:
name: ganak-linux-amd64
path: |
project/build/ganak
project/build/lib/*
project/build/include/*
- name: Upload Artifact - Linux arm
if: contains(matrix.os, 'ubuntu') && matrix.shared_libs == 'OFF' && contains(matrix.os, 'arm')
uses: actions/upload-artifact@v4
with:
name: ganak-linux-arm64
path: |
project/build/ganak
project/build/lib/*
project/build/include/*
- name: Upload Artifact - Mac Intel
if: matrix.os == 'macos-15-intel' && matrix.shared_libs == 'OFF'
uses: actions/upload-artifact@v4
with:
name: ganak-mac-x86_64
path: |
project/build/ganak
project/build/lib/*
project/build/include/*
- name: Upload Artifact - Mac Arm
if: matrix.os == 'macos-15' && matrix.shared_libs == 'OFF'
uses: actions/upload-artifact@v4
with:
name: ganak-mac-arm64
path: |
project/build/ganak
project/build/lib/*
project/build/include/*
- name: Upload Artifact - Windows
if: matrix.os == 'windows-latest' && matrix.shared_libs == 'OFF'
uses: actions/upload-artifact@v4
with:
name: ganak-windows-x86_64
path: |
project/build/ganak.exe
project/build/lib/*
project/build/include/*