Examples (#57) #501
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: tests | |
on: | |
push: | |
branches: | |
- main | |
- 'releases/**' | |
pull_request: | |
env: | |
DOCKER_BASE: "${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.DOCKER_HUB_IMAGE }}:latest" | |
OMPI_ALLOW_RUN_AS_ROOT: 1 | |
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 | |
jobs: | |
build_base_container: | |
name: Build base container | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v3.3.0 | |
- uses: whoan/docker-build-with-cache-action@v6 | |
id: docker-base-cache | |
with: | |
username: kubagalecki | |
password: "${{ secrets.DOCKER_HUB_TOKEN }}" | |
image_name: l3ster-base | |
dockerfile: scripts/ci/Dockerfile.base | |
unit_tests_and_static_analysis: | |
name: Static analysis and unit tests | |
needs: build_base_container | |
runs-on: self-hosted | |
container: kubagalecki/l3ster-base:latest | |
env: | |
BUILD_TYPE: Release | |
TOOLCHAIN_PATH: ../cmake/toolchains/StaticAnalysis.cmake | |
steps: | |
- uses: actions/checkout@v3.3.0 | |
- name: Build and run tests | |
run: scripts/ci/build-and-run-tests.sh | |
- name: Cleanup | |
if: always() | |
run: rm -rf build/ | |
sanitizers: | |
name: Sanitizers | |
needs: unit_tests_and_static_analysis | |
runs-on: self-hosted | |
container: kubagalecki/l3ster-base:latest | |
env: | |
BUILD_TYPE: ${{ matrix.build_type }} | |
TOOLCHAIN_PATH: "../cmake/toolchains/${{ matrix.sanitizer }}Sanitizer.cmake" | |
strategy: | |
matrix: | |
build_type: [ Debug, Release ] | |
sanitizer: [ Address, UndefinedBehavior ] # Thread disabled, too many false positives with TBB | |
steps: | |
- uses: actions/checkout@v3.3.0 | |
- name: Build and run tests | |
run: scripts/ci/build-and-run-tests.sh | |
- name: Cleanup | |
if: always() | |
run: rm -rf build/ | |
deployment: | |
name: Deployment tests | |
needs: unit_tests_and_static_analysis | |
runs-on: self-hosted | |
container: kubagalecki/l3ster-base:latest | |
env: | |
DEPLOYMENT_TESTS: true | |
BUILD_TYPE: Release | |
TOOLCHAIN_PATH: ../cmake/toolchains/StaticAnalysis.cmake | |
steps: | |
- uses: actions/checkout@v3.3.0 | |
- name: Build and run tests | |
run: scripts/ci/build-and-run-tests.sh | |
- name: Cleanup | |
if: always() | |
run: rm -rf build/ | |
coverage: | |
name: Code coverage | |
needs: [ sanitizers, deployment ] | |
runs-on: self-hosted | |
container: kubagalecki/l3ster-base:latest | |
env: | |
BUILD_TYPE: Debug | |
TOOLCHAIN_PATH: ../cmake/toolchains/Coverage.cmake | |
steps: | |
- uses: actions/checkout@v3.3.0 | |
- name: Build and run tests | |
run: scripts/ci/build-and-run-tests.sh | |
- name: Gather coverage results via gcovr | |
run: | | |
gcovr --verbose --xml --print-summary --exclude-unreachable-branches --exclude-throw-branches \ | |
--gcov-executable gcov-12 \ | |
--root "$GITHUB_WORKSPACE" \ | |
--exclude "$GITHUB_WORKSPACE/tests/" \ | |
--output "$GITHUB_WORKSPACE/coverage_report.xml" \ | |
"$GITHUB_WORKSPACE/build/tests/" | |
- name: Cleanup | |
if: always() | |
run: rm -rf build/ | |
- uses: codecov/codecov-action@v3.1.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
verbose: true |