-
Notifications
You must be signed in to change notification settings - Fork 3
373 lines (315 loc) · 11.7 KB
/
publish.yml
File metadata and controls
373 lines (315 loc) · 11.7 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
name: Publish
on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: nightly
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
jobs:
# Setup step is left here for future use, does nothing useful in this state
setup:
runs-on: ubuntu-latest
outputs:
build_type: ${{ steps.build.outputs.build_type }}
steps:
- name: Export build information
id: build
run: |
printf "build_type=Release\n" >> $GITHUB_OUTPUT
# Based on https://github.com/msys2/setup-msys2/blob/main/examples/cmake.yml
# Windows-MSVC
Windows-MSVC:
needs: setup
name: ${{ matrix.icon }} windows (${{matrix.platform}}, ${{matrix.compiler}}-${{matrix.compiler-ver}})
runs-on: ${{matrix.runs-on}}
strategy:
fail-fast: false
matrix:
runs-on: [windows-2025, windows-11-arm]
sys: [windows]
icon: ['⬜']
buildenv: [VS2022]
compiler: [MSVC]
mode: ["cxx23"]
build-type: ["Release"]
target : ["incplot"]
cmake-override: ["-DCPM_USE_LOCAL_PACKAGES=OFF -Dincplot_PORTABLE_LAYOUT=ON"]
include:
- compiler: "MSVC"
compiler-outputname: "msvc"
compiler-ver: 19
# - compiler: "clang-cl"
# compiler-outputname: "llvm"
- runs-on: windows-2025
platform: "x86_64"
- runs-on: windows-11-arm
platform: "arm64"
steps:
- name: '🧰 Checkout'
uses: actions/checkout@v5
with:
lfs: true
- uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: ${{matrix.platform}}
- name: Configure git credentials
run: |
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/" |
git lfs install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Configure'
shell: bash
run: cmake --preset Win_${{matrix.compiler}}_${{matrix.build-type}} ${{matrix.cmake-override}}
- name: '🚧 Build'
run: cmake --build build --target ${{matrix.target}}
- name: Package
run: cpack --config build/CPackConfig.cmake
- uses: actions/upload-artifact@v4
with:
name: ${{matrix.target}}_${{matrix.sys}}_${{matrix.compiler-outputname}}_${{matrix.platform}}
path: |
build/${{matrix.target}}_${{matrix.sys}}_${{matrix.compiler-outputname}}_${{matrix.platform}}.zip
retention-days: 1
- name: Export version
id: build
run: |
printf 'version<<END\n' >> $GITHUB_OUTPUT
./build/stage/incplot.exe --version | head -n 1 >> $GITHUB_OUTPUT
printf 'END\n' >> $GITHUB_OUTPUT
# Based on https://github.com/msys2/setup-msys2/blob/main/examples/cmake.yml
# Windows-MSYS:
# needs: setup
# name: ${{ matrix.icon }} windows (${{matrix.platform}}, ${{matrix.msystem}}, ${{matrix.compiler}}-${{matrix.compiler-ver}})
# runs-on: ${{ matrix.runs-on }}
# strategy:
# fail-fast: false
# matrix:
# runs-on: ["windows-2025"]
# sys: [windows]
# icon: ['🟦']
# buildenv: [MSYS2]
# msystem: [ucrt64]
# compiler: ["gcc"]
# build-type: ["Release"]
# platform: ["x86_64"]
# target : ["incplot"]
# cmake-override: [""]
# include:
# - compiler: "gcc"
# compiler-ver: "15"
# add-to-pacboy: ""
# defaults:
# run:
# shell: msys2 {0}
# steps:
# - name: '🧰 Checkout'
# uses: actions/checkout@v5
# - name: '${{ matrix.icon }} Setup MSYS2'
# uses: msys2/setup-msys2@v2.27.0
# with:
# msystem: ${{matrix.msystem}}
# update: true
# install: >-
# git
# make
# pacboy: >-
# toolchain:p
# ${{matrix.add-to-pacboy}}
# cmake:p
# ninja:p
# - name: Configure git credentials
# run: |
# git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: 'Configure'
# run: cmake --preset ${{matrix.compiler}}_${{matrix.build-type}} ${{matrix.cmake-override}}
# - name: '🚧 Build'
# run: cmake --build build --target ${{matrix.target}}
# - name: Package
# run: cpack --config build/CPackConfig.cmake
# - uses: actions/upload-artifact@v4
# with:
# name: ${{matrix.target}}_${{matrix.sys}}_gnu_${{matrix.platform}}
# path: |
# build/${{matrix.target}}_${{matrix.sys}}_gnu_${{matrix.platform}}.zip
# retention-days: 1
# Based on https://github.com/tcbrindle/flux/blob/main/.github/workflows/linux.yml
# Linux-Ubuntu:
# needs: setup
# name: ${{ matrix.icon }} linux (${{matrix.platform}}, ${{matrix.compiler}}-${{matrix.compiler-ver}}, ${{matrix.build-type}})
# runs-on: ${{matrix.runs-on}}
# strategy:
# fail-fast: false
# matrix:
# icon: ["🟧"]
# sys: [linux]
# runs-on: [ubuntu-24.04, ubuntu-24.04-arm]
# compiler: [gcc]
# # compiler-ver: [15, 21]
# build-type: [Release]
# target: ["incplot"]
# cmake-override: [""]
# include:
# - runs-on: ubuntu-24.04
# platform: "x86_64"
# - runs-on: ubuntu-24.04-arm
# platform: "arm64"
# - compiler: "gcc"
# compiler-setupname: "gcc"
# compiler-ver: "14"
# # - compiler: "clang"
# # compiler-setupname: "llvm"
# # compiler-ver: "21"
# outputs:
# version: ${{ steps.build.outputs.version }}
# steps:
# - name: "🧰 Checkout"
# uses: actions/checkout@v5
# - name: Setup Cpp
# uses: aminya/setup-cpp@v1
# with:
# setup-cpp: true
# compiler: ${{matrix.compiler-setupname}}-${{matrix.compiler-ver}}
# - name: Configure git credentials
# run: |
# git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Configure
# run: |
# cmake --preset ${{matrix.compiler}}_${{matrix.build-type}} ${{matrix.cmake-override}}
# - name: '🚧 Build'
# run: cmake --build build --target ${{matrix.target}}
# - name: Package
# run: cpack --config build/CPackConfig.cmake
# - uses: actions/upload-artifact@v4
# with:
# name: ${{matrix.target}}_${{matrix.sys}}_${{matrix.platform}}
# path: |
# build/${{matrix.target}}_${{matrix.sys}}_${{matrix.platform}}.tar.gz
# retention-days: 1
# - name: Export version
# id: build
# run: |
# printf 'version<<END\n' >> $GITHUB_OUTPUT
# ./build/incplot --version | head -n 1 >> $GITHUB_OUTPUT
# printf 'END\n' >> $GITHUB_OUTPUT
# macOS:
# needs: setup
# name: ${{ matrix.icon }} macos (${{matrix.platform}}, ${{matrix.compiler}}-${{matrix.compiler-ver}}, ${{matrix.build-type}})
# runs-on: ${{ matrix.runs-on }}
# strategy:
# fail-fast: false
# matrix:
# icon: ["⬛"]
# sys: [macos]
# runs-on: [macos-15, macos-15-intel]
# compiler: [clang]
# build-type: [Release]
# target: ["incplot"]
# include:
# - runs-on: macos-15
# platform: "arm64"
# - runs-on: macos-15-intel
# platform: "x86_64"
# # - compiler: "gcc"
# # compiler-setupname: "gcc"
# # compiler-ver: "15"
# # cmake-override: "-DCMAKE_C_COMPILER=gcc-15 -DCMAKE_CXX_COMPILER=g++-15"
# - compiler: "clang"
# compiler-setupname: "llvm"
# compiler-ver: "21"
# cmake-override: "-DCMAKE_C_COMPILER=clang \
# -DCMAKE_CXX_COMPILER=clang++ \
# -DCMAKE_CXX_FLAGS=\"-stdlib=libc++ -I$(brew --prefix llvm)/include/c++/v1\" \
# -DCMAKE_EXE_LINKER_FLAGS=\"-stdlib=libc++ -L$(brew --prefix llvm)/lib/c++\""
# steps:
# - name: '🧰 Checkout'
# uses: actions/checkout@v5
# - name: Setup Cpp
# uses: aminya/setup-cpp@v1
# with:
# setup-cpp: true
# compiler: ${{matrix.compiler}}-${{matrix.compiler-ver}}
# - name: Configure git credentials
# run: |
# git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Configure
# run: |
# cmake --preset ${{matrix.compiler}}_${{matrix.build-type}} ${{matrix.cmake-override}}
# - name: '🚧 Build'
# run: cmake --build build --target ${{matrix.target}}
# - name: Package
# run: cpack --config build/CPackConfig.cmake
# - uses: actions/upload-artifact@v4
# with:
# name: ${{matrix.target}}_${{matrix.sys}}_${{matrix.platform}}
# path: |
# build/${{matrix.target}}_${{matrix.sys}}_${{matrix.platform}}.tar.gz
# retention-days: 1
publish:
needs: [Windows-MSVC]
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
# Must perform checkout first, since it deletes the target directory
# before running, and would therefore delete the downloaded artifacts
- uses: actions/checkout@v4
- name: Configure git credentials
run: |
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y gettext-base
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- if: env.TAG_NAME == 'nightly'
run: |
(echo 'SUBJECT=incplot development build';
echo 'PRERELEASE=--prerelease') >> $GITHUB_ENV
gh release delete nightly --yes || true
git push origin :nightly || true
- if: env.TAG_NAME != 'nightly'
run: |
(echo 'SUBJECT=incplot release build';
echo 'PRERELEASE=') >> $GITHUB_ENV
gh release delete stable --yes || true
git push origin :stable || true
# `sha256sum` outputs <sha> <path>, so we cd into each dir to drop the
# containing folder from the output.
- run: |
for i in incplot*; do
(
cd $i || exit
sha256sum * >> $GITHUB_WORKSPACE/shasum.txt
)
done
- name: Publish release
env:
INCPLOT_VERSION: ${{ needs.Windows-MSVC.outputs.version }}
run: |
envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md"
echo '```' >> "$RUNNER_TEMP/notes.md"
cat shasum.txt >> "$RUNNER_TEMP/notes.md"
echo '```' >> "$RUNNER_TEMP/notes.md"
gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$INCPLOT_VERSION" --target $GITHUB_SHA incplot_windows_msvc_x86_64/* incplot_windows_msvc_arm64/* shasum.txt