Skip to content

Commit

Permalink
Revised CI (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
volkm authored Aug 12, 2024
2 parents b5c6461 + 2f92cce commit 7055d70
Show file tree
Hide file tree
Showing 3 changed files with 84 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
44 changes: 44 additions & 0 deletions doc/checklist_new_release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
The following steps should be performed before releasing a new carl-storm version.

1. Update `CHANGELOG.md`:
* To get all the commits from an author since the last tag execute:
```console
git log last_tag..HEAD --author "author_name"
```
* Set release month

2. Check that carl builds without errors and all tests are successful:
* [Github Actions](https://github.com/moves-rwth/carl-storm/actions/) should run successfully.

3. Set new carl version:
* Set new version in `CMakeLists.txt`

4. Set new tag in Git (assuming that the new version is X.Y.Z and that the remote "origin" is the github repo).
Use the flag `-s` to sign the tag.
```console
git tag -a X.Y.Z -m "Storm version X.Y.Z"
git push origin X.Y.Z
```
The new tag should now be visible on [GitHub](https://github.com/moves-rwth/carl-storm/tags).

5. Use the [CI](https://github.com/moves-rwth/carl-storm/actions/workflows/release_docker.yml) on the tag, provide the version `X.Y.Z` as tag and automatically create the [Docker containers](https://hub.docker.com/r/movesrwth/carl-storm) for the new version.

6. [Add new release](https://github.com/moves-rwth/carl-storm/releases/new) in GitHub.

7. Update `stable` branch:

```console
git checkout stable
git rebase master
git push origin stable
```
Note: Rebasing might fail if `stable` is ahead of `master` (e.g. because of merge commits). In this case we can do:
```console
git checkout stable
git reset --hard master
git push --force origin stable
```

8. Use the [CI](https://github.com/moves-rwth/carl-storm/actions/workflows/release_docker.yml) on the `stable` branch, provide the tag 'stable' and automatically create the [Docker containers](https://hub.docker.com/r/movesrwth/carl-storm).

9. Update [Homebrew formula](https://github.com/moves-rwth/homebrew-misc).

0 comments on commit 7055d70

Please sign in to comment.