CI #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |