Build Test #210
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: Build Test | |
# Builds and tests pycarl on different Linux systems | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
# run weekly | |
- cron: '0 10 * * 3' | |
# needed to trigger the workflow manually | |
workflow_dispatch: | |
pull_request: | |
env: | |
# GitHub runners currently have 4 cores | |
NR_JOBS: "4" | |
jobs: | |
indepthTests: | |
name: Indepth Tests (${{ matrix.setupArgs.name }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
distro: ["latest"] | |
debugOrRelease: ["release"] | |
setupArgs: | |
# This is the standard config | |
#- {name: "Standard", cln: "true", parser: "true"} | |
- {name: "no CLN", cln: "false", parser: "true"} | |
- {name: "no parser", cln: "true", parser: "false"} | |
- {name: "no CLN, no parser", cln: "false", parser: "false"} | |
steps: | |
- name: Setup environment variables | |
# this is strangely the best way to implement environment variables based on the value of another | |
# GITHUB_ENV is a magic variable pointing to a file; if a line with format {NAME}={VALUE} | |
# then the env variable with name NAME will be created/updated with VALUE | |
run: | | |
([[ ${{ matrix.debugOrRelease }} == "debug" ]] && echo "BUILD_TYPE=Debug" || echo "BUILD_TYPE=Release") >> $GITHUB_ENV | |
([[ ${{ matrix.setupArgs.cln }} == "true" ]] && echo "CARL_CMAKE_ARGS=-DUSE_CLN_NUMBERS=ON -DUSE_GINAC=ON" || echo "CARL_CMAKE_ARGS=-DUSE_CLN_NUMBERS=OFF -DUSE_GINAC=OFF") >> $GITHUB_ENV | |
([[ ${{ matrix.debugOrRelease }} == "debug" ]] && echo "DEBUG_SWITCH=--debug" || true) >> $GITHUB_ENV | |
- name: Git clone | |
uses: actions/checkout@v4 | |
- name: Replace Dockerfile (optional) | |
# If carl-parser should be excluded | |
if: matrix.setupArgs.parser == 'false' | |
run: cp .github/workflows/Dockerfile.no_parser Dockerfile | |
- name: Build pycarl from Dockerfile | |
run: docker build -t movesrwth/pycarl:ci-${{ matrix.debugOrRelease }} . --build-arg BASE_IMAGE=movesrwth/storm-basesystem:${{ matrix.distro }} --build-arg build_type=${BUILD_TYPE} --build-arg carl_cmake_args="${CARL_CMAKE_ARGS}" --build-arg setup_args=${DEBUG_SWITCH} --build-arg no_threads=${NR_JOBS} | |
- name: Run Docker | |
run: docker run -d -it --name ci movesrwth/pycarl:ci-${{ matrix.debugOrRelease }} | |
- name: Run tests | |
run: docker exec ci bash -c "cd /opt/pycarl; pip install pytest; pytest" | |
distroTests: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
distro: ["debian-12", "ubuntu-22.04", "ubuntu-24.04"] | |
debugOrRelease: ["debug", "release"] | |
steps: | |
- name: Setup environment variables | |
# this is strangely the best way to implement environment variables based on the value of another | |
# GITHUB_ENV is a magic variable pointing to a file; if a line with format {NAME}={VALUE} | |
# then the env variable with name NAME will be created/updated with VALUE | |
run: | | |
([[ ${{ matrix.debugOrRelease }} == "debug" ]] && echo "BUILD_TYPE=Debug" || echo "BUILD_TYPE=Release") >> $GITHUB_ENV | |
([[ ${{ matrix.debugOrRelease }} == "debug" ]] && echo "DEBUG_SWITCH=--debug" || true) >> $GITHUB_ENV | |
- name: Git clone | |
uses: actions/checkout@v4 | |
- name: Build pycarl from Dockerfile | |
run: docker build -t movesrwth/pycarl:ci-${{ matrix.debugOrRelease }} . --build-arg BASE_IMAGE=movesrwth/storm-basesystem:${{ matrix.distro }} --build-arg build_type=${BUILD_TYPE} --build-arg setup_args=${DEBUG_SWITCH} --build-arg no_threads=${NR_JOBS} | |
- name: Run Docker | |
run: docker run -d -it --name ci movesrwth/pycarl:ci-${{ matrix.debugOrRelease }} | |
- name: Run tests | |
run: docker exec ci bash -c "cd /opt/pycarl; pip install pytest; pytest" | |
deploy: | |
name: Build, Test and deploy documentation | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
debugOrRelease: ["debug", "release"] | |
steps: | |
- name: Setup environment variables | |
# this is strangely the best way to implement environment variables based on the value of another | |
# GITHUB_ENV is a magic variable pointing to a file; if a line with format {NAME}={VALUE} | |
# then the env variable with name NAME will be created/updated with VALUE | |
run: | | |
([[ ${{ matrix.debugOrRelease }} == "debug" ]] && echo "BUILD_TYPE=Debug" || echo "BUILD_TYPE=Release") >> $GITHUB_ENV | |
([[ ${{ matrix.debugOrRelease }} == "debug" ]] && echo "DEBUG_SWITCH=--debug" || true) >> $GITHUB_ENV | |
- name: Git clone | |
uses: actions/checkout@v4 | |
- name: Build pycarl from Dockerfile | |
run: docker build -t movesrwth/pycarl:ci-${{ matrix.debugOrRelease }} . --build-arg BASE_IMAGE=movesrwth/storm-basesystem:latest --build-arg build_type=${BUILD_TYPE} --build-arg setup_args=${DEBUG_SWITCH} --build-arg no_threads=${NR_JOBS} | |
- name: Run Docker | |
run: docker run -d -it --name ci movesrwth/pycarl:ci-${{ matrix.debugOrRelease }} | |
- name: Run tests | |
run: docker exec ci bash -c "cd /opt/pycarl; pip install pytest; pytest" | |
# Build and publish documentation for release build | |
- name: Install documentation dependencies | |
if: matrix.debugOrRelease == 'release' | |
run: docker exec ci bash -c "cd /opt/pycarl; pip install -e '.[doc]'" | |
- name: Build documentation | |
if: matrix.debugOrRelease == 'release' | |
run: | | |
docker exec ci bash -c "cd /opt/pycarl/doc; make html" | |
docker exec ci rm -r /opt/pycarl/doc/build/html/_sources | |
docker cp ci:/opt/pycarl/doc/build/html . | |
- name: Deploy documentation | |
# Only deploy for master on original repo (and not for pull requests or forks) | |
if: matrix.debugOrRelease == 'release' && github.repository_owner == 'moves-rwth' && github.ref == 'refs/heads/master' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
personal_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./html | |
notify: | |
name: Email notification | |
runs-on: ubuntu-latest | |
needs: [indepthTests,distroTests,deploy] | |
# Only run in main repo and even if previous step failed | |
if: github.repository_owner == 'moves-rwth' && always() | |
steps: | |
- uses: technote-space/workflow-conclusion-action@v3 | |
- uses: dawidd6/action-send-mail@v3 | |
with: | |
server_address: ${{ secrets.STORM_CI_MAIL_SERVER }} | |
server_port: 587 | |
username: ${{ secrets.STORM_CI_MAIL_USERNAME }} | |
password: ${{ secrets.STORM_CI_MAIL_PASSWORD }} | |
subject: "[You broke it] CI run failed for ${{ github.repository }}" | |
body: | |
"CI job of ${{ github.repository }} has failed for commit ${{ github.sha }}.\n\ | |
The error type is: ${{ env.WORKFLOW_CONCLUSION }}.\n\n\ | |
For more information, see https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
to: ${{ secrets.STORM_CI_MAIL_RECIPIENTS }} | |
from: Github Actions <[email protected]> | |
if: env.WORKFLOW_CONCLUSION != 'success' # notify only if failure |