mcxtrace-autobuild #373
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: mcxtrace-autobuild | |
on: | |
schedule: | |
- cron: '50 23 * * *' # 23:50 every day | |
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: 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@v4 | |
with: | |
path: McCode | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Setup build-deps | |
id: setup-build-deps | |
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: 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 McXtrace | |
id: mcxtrace-build | |
run: | | |
if [ "$RUNNER_OS" == "macOS" ]; then export SDKROOT=$(xcrun --sdk macosx --show-sdk-path); fi | |
set -e | |
set -u | |
set -x | |
cd McCode | |
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` | |
if [ "$RUNNER_OS" == "macOS" ]; then ./buildscripts/build_macos_mcxtrace ${REV} && tar cfz mcxtrace-macOS-conda.tgz mcxtrace-macOS-arm64/ mcxtrace-macOS-x86_64/; fi; | |
if [ "$RUNNER_OS" == "Linux" ]; then ./buildscripts/build_debs_mcxtrace ${REV} meta && mv dist mcxtrace-debian-x86_64 && tar cfz mcxtrace-debian-x86_64.tgz mcxtrace-debian-x86_64/; fi | |
- name: Cross-Build McXtrace for windows | |
id: mcxtrace-mingw-build | |
run: | | |
set -e | |
set -u | |
set -x | |
cd McCode | |
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` | |
if [ "$RUNNER_OS" == "Linux" ]; then rm -rf dist; fi | |
if [ "$RUNNER_OS" == "Linux" ]; then ./buildscripts/build_windows_mcxtrace ${REV} meta && mv dist mcxtrace-mingw64-Windows-x86_64; fi | |
if [ "$RUNNER_OS" == "Linux" ]; then tar cfz mcxtrace-Windows-x86_64.tgz mcxtrace-mingw64-Windows-x86_64/; fi | |
- name: 'Upload Artifact' | |
id: tar-upload | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: mcxtrace-artefacts-${{ matrix.os }} | |
path: "McCode/mcxtrace-*.tgz" | |
- name: Setup tmate session for manual debugging | |
uses: mxschmitt/action-tmate@v3 | |
if: always() && (inputs.manual-debugging == true && steps.tar-package.outcome != 'success') | |
with: | |
limit-access-to-actor: true |