mcstas-autobuild #812
This file contains hidden or 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: mcstas-autobuild | |
| on: | |
| schedule: | |
| - cron: '50 23 * * *' # 23:50 every day | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| manual-debugging: | |
| type: boolean | |
| description: Launch manual debugging tmate for inspection (automatic in case of errors) | |
| default: false | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { os: ubuntu-latest, CC: gcc, CXX: g++, python: '3.11' } | |
| - { os: ubuntu-24.04-arm, CC: gcc, CXX: g++, python: '3.11' } | |
| - { os: macos-latest, CC: clang, CXX: clang++, python: "3.11" } | |
| name: ${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }} | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| CC: ${{ matrix.CC }} | |
| CXX: ${{ matrix.CXX }} | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| path: McCode | |
| - name: Setup python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Setup build-deps-linux-intel | |
| id: setup-build-deps-linux-intel | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| if [ "$RUNNER_OS" == "Linux" ]; then sudo apt-get update && sudo apt-get -y install equivs ; fi | |
| if [ "$RUNNER_OS" == "Linux" ]; then sudo apt-get -y install xvfb mingw-w64 gfortran-mingw-w64 mingw-w64-x86-64-dev libz-mingw-w64-dev dos2unix nsis wine64; fi | |
| if [ "$RUNNER_OS" == "Linux" ]; then sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install wine32; fi | |
| ( if [ "$RUNNER_OS" == "Linux" ]; then Xvfb :0 -screen 0 1024x768x16 ; fi ) & | |
| if [ "$RUNNER_OS" == "Linux" ]; then mkdir /tmp/innosetup && cd /tmp/innosetup && wget https://jrsoftware.org/download.php/is.exe && DISPLAY=:0 wine ./is.exe /SP- /VERYSILENT /ALLUSERS /SUPPRESSMSGBOXES /DOWNLOADISCRYPT=1 ; fi | |
| if [ "$RUNNER_OS" == "Linux" ]; then killall -9 Xvfb ; fi | |
| - name: Setup build-deps-linux-arm | |
| id: setup-build-deps-linux-arm | |
| if: matrix.os == 'ubuntu-24.04-arm' | |
| run: | | |
| if [ "$RUNNER_OS" == "Linux" ]; then sudo apt-get update && sudo apt-get -y install equivs ; fi | |
| - name: Check versions | |
| id: version-checks | |
| run: | | |
| which python3 | |
| python3 --version | |
| which cmake | |
| cmake --version | |
| #NB: bison and flex in path are actually too old, on mac we | |
| #inject these via a brew keg later | |
| - name: Build McStas | |
| id: mcstas-build | |
| if: matrix.os != 'ubuntu-24.04-arm' | |
| run: | | |
| if [ "$RUNNER_OS" == "macOS" ]; then export SDKROOT=$(xcrun --sdk macosx --show-sdk-path); fi | |
| set -e | |
| set -u | |
| set -x | |
| cd McCode | |
| # Check if this is a clear-cut release-tag build: | |
| export REV=`git tag --points-at HEAD | cut -b2-` | |
| # Otherwise, pick latest and add _nightly | |
| if [ "$REV" == "" ]; then export REV=`git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags origin 'v*.*.*' | tail -1 | cut -f3 -d/ | cut -f2 -dv`_nightly; fi | |
| echo Building on $RUNNER_OS with version set to $REV | |
| if [ "$RUNNER_OS" == "macOS" ]; then ./buildscripts/build_macos_mcstas ${REV} && tar cfz mcstas-macOS-conda.tgz mcstas-macOS-arm64/ mcstas-macOS-x86_64/; fi; | |
| if [ "$RUNNER_OS" == "Linux" ]; then ./buildscripts/build_debs_mcstas ${REV} meta && mv dist mcstas-debian-x86_64 && tar cfz mcstas-debian-x86_64.tgz mcstas-debian-x86_64/; fi | |
| - name: Build McStas arm Linux | |
| id: mcstas-build-arm | |
| if: matrix.os == 'ubuntu-24.04-arm' | |
| run: | | |
| set -e | |
| set -u | |
| set -x | |
| cd McCode | |
| # Check if this is a clear-cut release-tag build: | |
| export REV=`git tag --points-at HEAD | cut -b2-` | |
| # Otherwise, pick latest and add _nightly | |
| if [ "$REV" == "" ]; then export REV=`git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags origin 'v*.*.*' | tail -1 | cut -f3 -d/ | cut -f2 -dv`_nightly; fi | |
| echo Building on $RUNNER_OS with version set to $REV | |
| if [ "$RUNNER_OS" == "Linux" ]; then ./buildscripts/build_debs_mcstas_arm64 ${REV} meta && mv dist mcstas-debian-arm64 && tar cfz mcstas-debian-arm64.tgz mcstas-debian-arm64/; fi | |
| - name: Cross-Build McStas for windows | |
| id: mcstas-mingw-build | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| set -e | |
| set -u | |
| set -x | |
| cd McCode | |
| # Check if this is a clear-cut release-tag build: | |
| export REV=`git tag --points-at HEAD | cut -b2-` | |
| # Otherwise, pick latest and add _nightly | |
| if [ "$REV" == "" ]; then export REV=`git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags origin 'v*.*.*' | tail -1 | cut -f3 -d/ | cut -f2 -dv`_nightly; fi | |
| echo Cross-compiling for MinGW Windows on $RUNNER_OS with version set to $REV | |
| if [ "$RUNNER_OS" == "Linux" ]; then rm -rf dist; fi | |
| if [ "$RUNNER_OS" == "Linux" ]; then ./buildscripts/build_windows_mcstas ${REV} meta && mv dist mcstas-mingw64-Windows-x86_64; fi | |
| if [ "$RUNNER_OS" == "Linux" ]; then tar cfz mcstas-Windows-x86_64.tgz mcstas-mingw64-Windows-x86_64/; fi | |
| - name: 'Upload Artifact' | |
| id: tar-upload | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: mcstas-artefacts-${{ matrix.os }} | |
| path: "McCode/mcstas-*.tgz" | |
| - name: Setup tmate session for manual debugging | |
| uses: mxschmitt/action-tmate@v3 | |
| if: always() && (inputs.manual-debugging) | |
| with: | |
| limit-access-to-actor: true |