Skip to content

mcstas-autobuild

mcstas-autobuild #87

name: mcstas-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-20.04, CC: gcc-10, CXX: g++-10, python: '3.8' }
# - { os: ubuntu-22.04, CC: gcc, CXX: g++, python: '3.9' }
- { os: ubuntu-latest, CC: gcc, CXX: g++, python: '3.11' }
# - { os: ubuntu-latest, CC: clang, CXX: clang++, python: '3.11' }
# - { os: ubuntu-latest, CC: gcc-12, CXX: g++-12, python: '3.11' }
# - { os: macos-11, CC: clang, CXX: clang++, python: "3.10" }
- { os: macos-12, CC: clang, CXX: clang++, python: "3.11" }
# - { os: macos-13, CC: clang, CXX: clang++, python: "3.11" }
# - { os: windows-latest, CC: gcc, CXX: g++, python: "3.11" }
# - { os: windows-2019, CC: gcc, CXX: g++, 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 -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
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=`date +%Y-%m-%d`
if [ "$RUNNER_OS" == "macOS" ]; then ./buildscripts/build_macos_mcstas ${REV}; fi
if [ "$RUNNER_OS" == "Linux" ]; then ./buildscripts/build_debs_mcstas ${REV} meta; fi
tar cfz dist-${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}.tgz dist/
- name: 'Upload Artifact'
id: tar-upload
uses: actions/upload-artifact@v4
if: always()
with:
name: mcstas-artefact-${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}
path: "McCode/dist-${{ matrix.os }}.${{ matrix.CC }}.python-${{ matrix.python }}.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