Skip to content

Commit

Permalink
Revised CI
Browse files Browse the repository at this point in the history
  • Loading branch information
volkm committed Jul 8, 2024
1 parent 2067126 commit 2f92cce
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 38 deletions.
76 changes: 39 additions & 37 deletions .github/workflows/buildtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,74 +18,76 @@ env:
NR_JOBS: "2"

jobs:
indepthTests:
name: Build and Test
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"]
debugOrRelease: ["debug", "release"]
buildType: ["Debug", "Release"]
steps:
- name: Setup configuration
# 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
- name: Git clone
uses: actions/checkout@v4

- name: Build Carl-storm
run: docker build -t movesrwth/carl-storm:ci-${{ matrix.debugOrRelease }} . --build-arg BASE_IMAGE=movesrwth/storm-basesystem:${{ matrix.distro }} --build-arg build_type=${BUILD_TYPE} --build-arg no_threads=${NR_JOBS}
- 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 --privileged movesrwth/carl-storm:ci-${{ matrix.debugOrRelease }}
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 unit tests
- name: Run tests
run: docker exec ci bash -c "cd /opt/carl/build; ctest test --output-on-failure"

deploy:
name: Build, Test and Deploy
name: Test and Deploy (${{ matrix.buildType.name }})
runs-on: ubuntu-latest
strategy:
matrix:
distro: ["latest"]
debugOrRelease: ["debug", "release"]
buildType:
- {name: "Debug",
dockerTag: "ci-debug",
distro: "storm-basesystem:latest"
}
- {name: "Release",
dockerTag: "ci",
distro: "storm-basesystem:latest"
}
steps:
- name: Setup cmake arguments
# 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
- 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'
run: echo "${{ secrets.STORM_CI_DOCKER_PASSWORD }}" | docker login -u "${{ secrets.STORM_CI_DOCKER_USERNAME }}" --password-stdin
- name: Git clone
uses: actions/checkout@v4

- name: Build Carl-storm
run: docker build -t movesrwth/carl-storm:ci-${{ matrix.debugOrRelease }} . --build-arg BASE_IMAGE=movesrwth/storm-basesystem:${{ matrix.distro }} --build-arg build_type=${BUILD_TYPE} --build-arg no_threads=${NR_JOBS}
- 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:ci-${{ matrix.debugOrRelease }}
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 unit tests
- 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:ci-${{ matrix.debugOrRelease }}
docker push movesrwth/carl-storm:ci-${{ matrix.debugOrRelease }}
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: [indepthTests, deploy]
needs: [distroTests, deploy]
# Only run in main repo and even if previous step failed
if: github.repository_owner == 'moves-rwth' && always()
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:

jobs:
deploy:
name: Deploy (${{ matrix.buildtType.name }})
name: Deploy (${{ matrix.buildType.name }})
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down

0 comments on commit 2f92cce

Please sign in to comment.