Skip to content

Build Test

Build Test #152

Workflow file for this run

name: Build Test
# Builds and tests carl-storm on various platforms
# also deploys images to Dockerhub
on:
push:
branches:
- master
schedule:
# run weekly
- cron: '0 10 * * 2'
# needed to trigger the workflow manually
workflow_dispatch:
pull_request:
env:
# GitHub runners currently have two cores
NR_JOBS: "2"
jobs:
distroTests:
name: Distro Tests (${{ matrix.distro }}, ${{ matrix.buildType }})
runs-on: ubuntu-latest
strategy:
matrix:
distro: ["debian-11", "debian-12", "ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04", "minimal_dependencies"]
buildType: ["Debug", "Release"]
steps:
- name: Git clone
uses: actions/checkout@v4
- name: Build Carl-storm from Dockerfile
run: |
docker build -t movesrwth/carl-storm:ci . \
--build-arg BASE_IMAGE=movesrwth/storm-basesystem:${{ matrix.distro }} \
--build-arg build_type="${{ matrix.buildType }}" \
--build-arg no_threads=${NR_JOBS}
- name: Run Docker
run: docker run -d -it --name ci movesrwth/carl-storm:ci
- name: Build tests
run: docker exec ci bash -c "cd /opt/carl/build; make -j ${NR_JOBS}"
- name: Run tests
run: docker exec ci bash -c "cd /opt/carl/build; ctest test --output-on-failure"
deploy:
name: Test and Deploy (${{ matrix.buildType.name }})
runs-on: ubuntu-latest
strategy:
matrix:
buildType:
- {name: "Debug",
dockerTag: "ci-debug",
distro: "storm-basesystem:latest"
}
- {name: "Release",
dockerTag: "ci",
distro: "storm-basesystem:latest"
}
steps:
- name: Git clone
uses: actions/checkout@v4
- name: Build Carl-storm from Dockerfile
run: |
docker build -t movesrwth/carl-storm:${{ matrix.buildType.dockerTag }} . \
--build-arg BASE_IMAGE=movesrwth/${{ matrix.buildType.distro }} \
--build-arg build_type="${{ matrix.buildType.name }}" \
--build-arg no_threads=${NR_JOBS}
- name: Run Docker
run: docker run -d -it --name ci movesrwth/carl-storm:${{ matrix.buildType.dockerTag }}
- name: Build tests
run: docker exec ci bash -c "cd /opt/carl/build; make -j ${NR_JOBS}"
- name: Run tests
run: docker exec ci bash -c "cd /opt/carl/build; ctest test --output-on-failure"
- name: Login into docker
# Only login if using master on original repo (and not for pull requests or forks)
if: github.repository_owner == 'moves-rwth' && github.ref == 'refs/heads/master'
uses: docker/login-action@v3
with:
username: ${{ secrets.STORM_CI_DOCKER_USERNAME }}
password: ${{ secrets.STORM_CI_DOCKER_TOKEN }}
- name: Deploy carl
# Only deploy if using master on original repo (and not for pull requests or forks)
if: github.repository_owner == 'moves-rwth' && github.ref == 'refs/heads/master'
run: |
docker commit ci movesrwth/carl-storm:${{ matrix.buildType.dockerTag }}
docker push movesrwth/carl-storm:${{ matrix.buildType.dockerTag }}
notify:
name: Email notification
runs-on: ubuntu-latest
needs: [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