-
Notifications
You must be signed in to change notification settings - Fork 42
265 lines (232 loc) · 9.66 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
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
name: Build Status
env:
# Run full CI Monday and Thursday at 3:25am EST (08:25 UTC)
# Note: do not run scheduled jobs on the hour exactly, per:
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule
# GitHub Actions schedules can sometimes delay by up to 15 minutes due to platform load
FULL_CI_SCHEDULE: '25 8 * * 1,4'
on:
push:
branches:
- main
tags:
- v*
paths-ignore:
- LICENSE
- NOTICE
- README.md
- "docs/**"
pull_request:
branches:
- main
paths-ignore:
- LICENSE
- NOTICE
- README.md
- "docs/**"
workflow_dispatch:
inputs:
ci-full:
description: "Run Full CI"
required: false
type: boolean
default: false
schedule:
- cron: '25 8 * * 1,4'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: write
checks: write
pull-requests: write
id-token: write # for pypi test release
jobs:
########################################################
#......................................................#
#..|########|..|###\.....|##|..|########|..|########|..#
#.....|##|.....|##|##\...|##|.....|##|.....|########|..#
#.....|##|.....|##|\##\..|##|.....|##|........|##|.....#
#.....|##|.....|##|.\##\.|##|.....|##|........|##|.....#
#.....|##|.....|##|..\##\|##|.....|##|........|##|.....#
#.....|##|.....|##|...\##\#/......|##|........|##|.....#
#..|########|..|##|....\##/....|########|.....|##|.....#
#......................................................#
########################################################
# Stage One - Initialize the build #
########################################################
# This is so we can inspect the latest commit message from
# both push and pull_request events (there is no
# github.event.head_commit.message otherwise on pull
# requests)
initialize:
runs-on: ubuntu-24.04
outputs:
COMMIT_MESSAGE: ${{ steps.setup.outputs.COMMIT_MSG }}
FULL_RUN: ${{ steps.setuppush.outputs.FULL_RUN || steps.setuppr.outputs.FULL_RUN || steps.setupmanual.outputs.FULL_RUN || steps.setupschedule.outputs.FULL_RUN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# for pull_request so we can do HEAD^2
fetch-depth: 2
- name: Get Commit Message
run: echo "COMMIT_MSG=$(git log -1 --pretty=%B HEAD | tr '\n' ' ')" >> $GITHUB_ENV
if: ${{ github.event_name == 'push' }}
- name: Get Commit Message
run: echo "COMMIT_MSG=$(git log -1 --pretty=%B HEAD^2 | tr '\n' ' ')" >> $GITHUB_ENV
if: ${{ github.event_name == 'pull_request' }}
- name: Display and Setup Build Args (Push)
id: setuppush
run: |
echo "Commit Message: $COMMIT_MSG"
echo "Full Run: $FULL_RUN"
echo "COMMIT_MSG=$COMMIT_MSG" >> $GITHUB_OUTPUT
echo "FULL_RUN=$FULL_RUN" >> $GITHUB_OUTPUT
env:
FULL_RUN: ${{ startsWith(github.ref_name, 'v') || contains(github.event.head_commit.message, '[ci-full]') }}
if: ${{ github.event_name == 'push' }}
- name: Display and Setup Build Args (PR)
id: setuppr
run: |
echo "Commit Message: $COMMIT_MSG"
echo "Full Run: $FULL_RUN"
echo "COMMIT_MSG=$COMMIT_MSG" >> $GITHUB_OUTPUT
echo "FULL_RUN=$FULL_RUN" >> $GITHUB_OUTPUT
env:
FULL_RUN: ${{ contains(github.event.pull_request.title, '[ci-full]') || contains(env.COMMIT_MSG, '[ci-full]') }}
if: ${{ github.event_name == 'pull_request' }}
- name: Display and Setup Build Args (Manual)
id: setupmanual
run: |
echo "Commit Message: $COMMIT_MSG"
echo "Full Run: $FULL_RUN"
echo "COMMIT_MSG=$COMMIT_MSG" >> $GITHUB_OUTPUT
echo "FULL_RUN=$FULL_RUN" >> $GITHUB_OUTPUT
env:
FULL_RUN: ${{ github.event.inputs.ci-full }}
if: ${{ github.event_name == 'workflow_dispatch' }}
- name: Display and Setup Build Args (Schedule)
id: setupschedule
run: |
echo "Commit Message: $COMMIT_MSG"
echo "Full Run: $FULL_RUN"
echo "COMMIT_MSG=$COMMIT_MSG" >> $GITHUB_OUTPUT
echo "FULL_RUN=$FULL_RUN" >> $GITHUB_OUTPUT
env:
FULL_RUN: ${{ github.event.schedule == env.FULL_CI_SCHEDULE }}
if: ${{ github.event_name == 'schedule' }}
################################################################
#..............................................................#
#..|########\..|##|..|##|..|########|..|##|........|#######\...#
#..|##|../##/..|##|..|##|.....|##|.....|##|........|##|..\##\..#
#..|##|./##/...|##|..|##|.....|##|.....|##|........|##|..|##|..#
#..|##||#<.....|##|..|##|.....|##|.....|##|........|##|..|##|..#
#..|##|.\##\...|##|..|##|.....|##|.....|##|........|##|..|##|..#
#..|##|..\##\..|##|..|##|.....|##|.....|########|..|##|../##/..#
#..|########/..|########|..|########|..|########|..|#######/...#
#..............................................................#
#..../####\....|#######\...|########|..../####\....|########|..#
#../##/..\##\..|##|..\##\.....|##|...../##/..\##\..|########|..#
#...\##\.......|##|..|##|.....|##|......\##\..........|##|.....#
#.....\##\.....|##|..|##|.....|##|........\##\........|##|.....#
#.......\##\...|##|..|##|.....|##|..........\##\......|##|.....#
#..\##\./##/...|##|../##/.....|##|.....\##\./##/......|##|.....#
#...\####/.....|#######/...|########|...\####/........|##|.....#
#..............................................................#
################################################################
# Stage Three - Build SDist #
################################################################
build_sdist:
needs:
- initialize
strategy:
matrix:
os:
- ubuntu-24.04
python-version:
- 3.9
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
version: '${{ matrix.python-version }}'
- name: Install python dependencies
run: make requirements
- name: Python SDist Steps
run: make dist-py-sdist
- name: Check sdist
run: make dist-check
- name: Upload SDist
uses: actions/upload-artifact@v4
with:
name: csp-sdist
path: dist/*.tar.gz
################################################################
#..............................................................#
#..|########|..|########|..../####\....|########|..............#
#..|########|..|##|......../##/..\##\..|########|..............#
#.....|##|.....|##|.........\##\..........|##|.................#
#.....|##|.....|########|.....\##\........|##|.................#
#.....|##|.....|##|.............\##\......|##|.................#
#.....|##|.....|##|........\##\../##/.....|##|.................#
#.....|##|.....|########|...\####/........|##|.................#
#..............................................................#
#..../####\....|#######\...|########|..../####\....|########|..#
#../##/..\##\..|##|..\##\.....|##|...../##/..\##\..|########|..#
#...\##\.......|##|..|##|.....|##|......\##\..........|##|.....#
#.....\##\.....|##|..|##|.....|##|........\##\........|##|.....#
#.......\##\...|##|..|##|.....|##|..........\##\......|##|.....#
#..\##\./##/...|##|../##/.....|##|.....\##\./##/......|##|.....#
#...\####/.....|#######/...|########|...\####/........|##|.....#
#..............................................................#
################################################################
# Stage Four - Build / test the SDist #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
test_sdist:
needs:
- initialize
- build_sdist
strategy:
matrix:
os:
- ubuntu-24.04
python-version:
- 3.9
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
version: '${{ matrix.python-version }}'
- name: Set up Caches
uses: ./.github/actions/setup-caches
- name: Install python dependencies
run: make requirements
- name: Install requirements
run: sudo dependencies-debian
- uses: actions/download-artifact@v4
with:
name: csp-sdist
path: dist/
- name: Install sdist
run: |
python -m pip install -U -vvv dist/csp*.tar.gz
python -m pip install -U --no-deps -vvv dist/csp*.tar.gz --target .
env:
CCACHE_DIR: /home/runner/work/csp/csp/.ccache
VCPKG_DEFAULT_BINARY_CACHE: /home/runner/vcpkg_cache
VCPKG_DOWNLOADS: /home/runner/vcpkg_download_cache
- name: Run tests against from-scratch sdist build
run: make test
env:
CSP_TEST_SKIP_EXAMPLES: "1"