forked from supercollider/supercollider
-
Notifications
You must be signed in to change notification settings - Fork 1
314 lines (286 loc) · 11.8 KB
/
actions.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
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
name: CI
on:
push:
paths-ignore:
- 'examples/**'
- 'HelpSource/**'
- 'sounds/**'
- '*.md'
pull_request:
paths-ignore:
- 'examples/**'
- 'HelpSource/**'
- 'sounds/**'
- '*.md'
schedule:
- cron: '0 0 * * 0' # run weekly to refresh cache
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: lint class library
run: |
sudo npm install -g lintspaces-cli
lintspaces -e .editorconfig SCClassLibrary/**/*.sc || true # ignore failure
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- uses: pre-commit/action@v3.0.0
name: 'Run pre-commit'
env:
FULL_CHECK: 1
version-getter:
runs-on: ubuntu-22.04
outputs:
sc-version: ${{ steps.set-version.outputs.version }}
steps:
- name: set version string for artifacts
id: set-version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
FULL_TAG=${GITHUB_REF#refs/tags/}
SC_VERSION=${FULL_TAG##Version-}
else
SC_VERSION=$GITHUB_SHA
fi
echo "version=$SC_VERSION" >> $GITHUB_OUTPUT
build-linux:
needs: [lint, version-getter]
uses: ./.github/workflows/build_linux.yml
with:
sc-version: ${{ needs.version-getter.outputs.sc-version }}
secrets: inherit
macOS:
needs: [lint, version-getter]
uses: ./.github/workflows/build_macos.yml
with:
sc-version: ${{ needs.version-getter.outputs.sc-version }}
secrets: inherit
Windows:
needs: [lint, version-getter]
uses: ./.github/workflows/build_windows.yml
with:
sc-version: ${{ needs.version-getter.outputs.sc-version }}
secrets: inherit
test:
strategy:
fail-fast: false
matrix:
include:
- name: macOS
runs-on: macos-12
sclang: 'build/Install/SuperCollider/SuperCollider.app/Contents/MacOS/sclang'
artifact-suffix: macOS-universal
artifact-extension: '.dmg'
- name: Linux
runs-on: ubuntu-22.04
sclang: 'build/Install/bin/sclang'
artifact-suffix: linux-jammy-gcc12
# - name: Windows
# runs-on: windows-2022
# sclang: 'build/Install/SuperCollider/sclang'
# artifact-suffix: win64
needs: [version-getter, build-linux, macOS, Windows] # unfortunately we can't use matrix expression here to make Linux test depend only on Linux build
runs-on: '${{ matrix.runs-on }}'
name: 'test on ${{ matrix.name }}'
env:
INSTALL_PATH: ${{ github.workspace }}/build/Install
ARTIFACT_FILE: 'SuperCollider-${{ needs.version-getter.outputs.sc-version }}-${{ matrix.artifact-suffix }}${{ matrix.artifact-extension }}'
TESTS_PATH: ${{ github.workspace }}/testsuite/classlibrary
SCLANG: ${{ github.workspace }}/${{ matrix.sclang }}
TEST_LIST_PROTO: ${{ github.workspace }}/testsuite/scripts/test_run_proto_gha.scd
TEST_LIST_RESULT: ${{ github.workspace }}/testsuite/scripts/run/gha_result.scxtar
SCRIPT_RUN_TESTS: ${{ github.workspace }}/testsuite/scripts/sclang_test_runner.scd
SCRIPT_ADD_PATH: ${{ github.workspace }}/testsuite/scripts/add_include_path.scd
SCRIPT_PRINT_RESULTS: ${{ github.workspace }}/testsuite/scripts/print_results.scd
steps:
- uses: actions/checkout@v4
with:
submodules: false # don't need submodules for testing
- name: download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_FILE }}
path: ${{ env.INSTALL_PATH }}
- name: extract artifact
shell: bash
run: |
cd $INSTALL_PATH
echo Contents of `pwd`:
ls
if [[ ${{ runner.os }} == "macOS" ]]; then
hdiutil attach $ARTIFACT_FILE
echo "mkdir SuperCollider"
mkdir SuperCollider
cp -R /Volumes/SuperCollider/* SuperCollider/
else
unzip $ARTIFACT_FILE.zip
fi
- name: setup Linux environment
if: runner.os == 'Linux'
run: |
# install dependencies
sudo apt-get update
sudo apt-get install --yes libsndfile1 libavahi-client-dev libfftw3-dev libicu-dev libudev-dev qtbase5-dev qtwebengine5-dev jackd1 socat
# add bin to PATH so that scsynth can be found
echo "$INSTALL_PATH/bin" >> $GITHUB_PATH
# start jack
jackd --no-realtime --silent -d dummy &
# start virtual display server
export DISPLAY=:99
echo "DISPLAY=$DISPLAY" >> $GITHUB_ENV
Xvfb $DISPLAY -screen 0 1024x768x16 &
- name: setup macOS environment
if: runner.os == 'macOS'
env:
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: brew install coreutils # to get 'timeout' utility
- name: setup Windows environment
if: runner.os == 'Windows'
shell: bash
run: |
# install jack
# even though SC on Windows doesn't use JACK directly
# it will use JackRouter ASIO device
curl -O -J -L https://github.com/jackaudio/jack2-releases/releases/download/v1.9.22/jack2-win64-v1.9.22.exe
echo "installing JACK2"
./jack2-win64-v1.9.22.exe //TYPE="router" //SILENT //SUPPRESSMSGBOXES
# add bin to PATH so that scsynth can be found
echo "$INSTALL_PATH/SuperCollider" >> $GITHUB_PATH
# start jack
/c/Program\ Files/JACK2/jackd.exe --no-realtime -d dummy &
- name: run tests
shell: bash
continue-on-error: true
run: |
# add path
$SCLANG $SCRIPT_ADD_PATH $TESTS_PATH
# run tests
timeout 1200 $SCLANG $SCRIPT_RUN_TESTS $TEST_LIST_PROTO $TEST_LIST_RESULT
- name: post test results
shell: bash
run: |
$SCLANG $SCRIPT_PRINT_RESULTS $TEST_LIST_RESULT
deploy_s3:
strategy:
fail-fast: false
matrix:
include:
- artifact-suffix: macOS-universal
s3-os-name: osx
s3-artifact-suffx: ''
s3-artifact-extension: 'dmg'
artifact-extension: '.dmg' # for download-artifacts action, for non-zip only, should include `.`
s3-create-latest-link: true # create link to pointing to the "latest" build; activate only one per branch per s3-os-name
- artifact-suffix: win32
s3-os-name: win32
s3-artifact-suffx: ''
s3-artifact-extension: 'zip'
s3-create-latest-link: true # create link to pointing to the "latest" build
- artifact-suffix: win64
s3-os-name: win64
s3-artifact-suffx: ''
s3-artifact-extension: 'zip'
s3-create-latest-link: true # create link to pointing to the "latest" build
if: github.repository_owner == 'supercollider' && github.event_name != 'pull_request' # run in the main repo, but not on pull requests
needs: [lint, version-getter, macOS, Windows]
runs-on: ubuntu-latest
name: 'deploy ${{ matrix.artifact-suffix }} to s3'
env:
INSTALL_PATH: ${{ github.workspace }}/build/Install
ARTIFACT_FILE: SuperCollider-${{ needs.version-getter.outputs.sc-version }}-${{ matrix.artifact-suffix }}${{ matrix.artifact-extension }}
UPLOAD_TO_S3: ${{ (secrets.S3_ACCESS_KEY_ID != 0) && !startsWith(github.ref, 'refs/tags/') }}
S3_CREATE_LATEST_LINK: ${{ matrix.s3-create-latest-link && (secrets.S3_ACCESS_KEY_ID != 0) && startsWith(github.ref, 'refs/heads/') }}
S3_ARTIFACT_PATH: ${{ github.workspace }}/build/s3-upload
S3_ARTIFACT_NAME: SC-${{ github.sha }}${{ matrix.s3-artifact-suffx }}.${{ matrix.s3-artifact-extension }}
S3_BUILD_LOCATION: builds/supercollider/supercollider/${{ matrix.s3-os-name }}
S3_ROOT_URL: 'https://supercollider.s3.amazonaws.com'
steps:
- name: download artifacts
uses: actions/download-artifact@v4
if: env.UPLOAD_TO_S3 == 'true'
with:
name: ${{ env.ARTIFACT_FILE }}
path: ${{ env.INSTALL_PATH }}
- name: preapre s3 upload
if: env.UPLOAD_TO_S3 == 'true'
run: |
mkdir $S3_ARTIFACT_PATH
mv $INSTALL_PATH/*.* $S3_ARTIFACT_PATH/$S3_ARTIFACT_NAME
# set S3_BUILD_LOCATION
echo 'S3_BUILD_URL<<EOF' >> $GITHUB_ENV
echo ${{ env.S3_ROOT_URL }}/${{ env.S3_BUILD_LOCATION }}/${{ env.S3_ARTIFACT_NAME }} >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
if [[ $S3_CREATE_LATEST_LINK == true ]]; then
# set LATEST_HTML_PATH and LATEST_HTML_URL
echo 'LATEST_HTML_PATH<<EOF' >> $GITHUB_ENV
echo ${{ env.S3_ARTIFACT_PATH }}/${GITHUB_REF#refs/heads/}-latest.html >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo 'LATEST_HTML_URL<<EOF' >> $GITHUB_ENV
echo ${{ env.S3_ROOT_URL }}/${{ env.S3_BUILD_LOCATION }}/${GITHUB_REF#refs/heads/}-latest.html >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
fi
- name: create latest link
if: env.S3_CREATE_LATEST_LINK == 'true'
env:
FWD_HTML: '<html><head><meta http-equiv="refresh" content="0; url=''${{ env.S3_BUILD_URL }}''" /></head></html>'
run: |
mkdir -p "${LATEST_HTML_PATH%/*}"
echo writing $FWD_HTML to $LATEST_HTML_PATH
echo $FWD_HTML > $LATEST_HTML_PATH
echo html file contents:
cat $LATEST_HTML_PATH
- name: upload to S3
uses: jakejarvis/s3-sync-action@master
if: env.UPLOAD_TO_S3 == 'true'
with:
args: --acl public-read
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: supercollider
AWS_S3_ENDPOINT: https://s3-us-west-2.amazonaws.com
AWS_REGION: 'us-west-2'
SOURCE_DIR: ${{ env.S3_ARTIFACT_PATH }}
DEST_DIR: ${{ env.S3_BUILD_LOCATION }}
- name: post S3 build location
if: env.UPLOAD_TO_S3 == 'true'
run: |
echo "::group::S3 build location"
echo $S3_BUILD_URL
if [[ -n "$LATEST_HTML_URL" ]]; then echo $LATEST_HTML_URL; fi
echo "::endgroup::"
# release - list of files uploaded to GH release is specified in the *upload* step
deploy_gh:
if: startsWith(github.ref, 'refs/tags/') # run on tagged commits
needs: [lint, version-getter, macOS, Windows]
runs-on: ubuntu-latest
name: 'deploy release'
env:
INSTALL_PATH: ${{ github.workspace }}/Install
ARTIFACT_FILE_PREFIX: 'SuperCollider-${{ needs.version-getter.outputs.sc-version }}'
steps:
- name: download artifacts
uses: actions/download-artifact@v4
with:
path: ${{ env.INSTALL_PATH }} # no "name" paramter - download all artifacts
- name: upload to the release page
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.INSTALL_PATH }}/${{ env.ARTIFACT_FILE_PREFIX }}-macOS-x64.dmg/*
${{ env.INSTALL_PATH }}/${{ env.ARTIFACT_FILE_PREFIX }}-macOS-universal.dmg/*
${{ env.INSTALL_PATH }}/${{ env.ARTIFACT_FILE_PREFIX }}-macOS-arm64.dmg/*
${{ env.INSTALL_PATH }}/${{ env.ARTIFACT_FILE_PREFIX }}-macOS-x64-legacy.dmg/*
${{ env.INSTALL_PATH }}/${{ env.ARTIFACT_FILE_PREFIX }}-win32-installer/*
${{ env.INSTALL_PATH }}/${{ env.ARTIFACT_FILE_PREFIX }}-win64-installer/*
${{ env.INSTALL_PATH }}/${{ env.ARTIFACT_FILE_PREFIX }}-win32/*
${{ env.INSTALL_PATH }}/${{ env.ARTIFACT_FILE_PREFIX }}-win64/*
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}