Made the public test setup more reliable #25
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-test-docs: | |
| runs-on: ubuntu-24.04 | |
| env: | |
| BUILD_DIR: build | |
| CI_IMAGE: gates-ci | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Build Docker image | |
| run: docker build -t "$CI_IMAGE" -f Dockerfile . | |
| - name: Configure in Docker | |
| run: | | |
| docker run --rm \ | |
| --user "$(id -u):$(id -g)" \ | |
| -e BUILD_DIR="$BUILD_DIR" \ | |
| -e HOME=/tmp/gates-home \ | |
| -v "$PWD":/workspace \ | |
| -w /workspace \ | |
| "$CI_IMAGE" \ | |
| bash -lc ' | |
| cmake -S . -B "$BUILD_DIR" -DENABLE_TESTING=ON | |
| ' | |
| - name: Build tests in Docker | |
| run: | | |
| docker run --rm \ | |
| --user "$(id -u):$(id -g)" \ | |
| -e BUILD_DIR="$BUILD_DIR" \ | |
| -e HOME=/tmp/gates-home \ | |
| -v "$PWD":/workspace \ | |
| -w /workspace \ | |
| "$CI_IMAGE" \ | |
| bash -lc ' | |
| cmake --build "$BUILD_DIR" --target gates_tests -j 2 | |
| ' | |
| - name: Run tests in Docker | |
| run: | | |
| docker run --rm \ | |
| --user "$(id -u):$(id -g)" \ | |
| -e BUILD_DIR="$BUILD_DIR" \ | |
| -e HOME=/tmp/gates-home \ | |
| -v "$PWD":/workspace \ | |
| -w /workspace \ | |
| "$CI_IMAGE" \ | |
| bash -lc ' | |
| ctest --test-dir "$BUILD_DIR" --output-on-failure | |
| ' | |
| - name: Build executable in Docker | |
| run: | | |
| docker run --rm \ | |
| --user "$(id -u):$(id -g)" \ | |
| -e BUILD_DIR="$BUILD_DIR" \ | |
| -e HOME=/tmp/gates-home \ | |
| -v "$PWD":/workspace \ | |
| -w /workspace \ | |
| "$CI_IMAGE" \ | |
| bash -lc ' | |
| cmake --build "$BUILD_DIR" --target gates -j 2 | |
| ' | |
| - name: Run smoke tests in Docker | |
| run: | | |
| docker run --rm \ | |
| --user "$(id -u):$(id -g)" \ | |
| -e BUILD_DIR="$BUILD_DIR" \ | |
| -e HOME=/tmp/gates-home \ | |
| -v "$PWD":/workspace \ | |
| -w /workspace \ | |
| "$CI_IMAGE" \ | |
| bash -lc ' | |
| ./$BUILD_DIR/gates --version && | |
| ./$BUILD_DIR/gates examples/example.c /tmp/example.vhdl && | |
| test -s /tmp/example.vhdl | |
| ' | |
| - name: Build docs in Docker | |
| run: | | |
| docker run --rm \ | |
| --user "$(id -u):$(id -g)" \ | |
| -e BUILD_DIR="$BUILD_DIR" \ | |
| -e HOME=/tmp/gates-home \ | |
| -v "$PWD":/workspace \ | |
| -w /workspace \ | |
| "$CI_IMAGE" \ | |
| bash -lc ' | |
| ./build_docs.sh | |
| ' | |
| - name: Run cppcheck in Docker | |
| run: | | |
| docker run --rm \ | |
| --user "$(id -u):$(id -g)" \ | |
| -e BUILD_DIR="$BUILD_DIR" \ | |
| -e HOME=/tmp/gates-home \ | |
| -v "$PWD":/workspace \ | |
| -w /workspace \ | |
| "$CI_IMAGE" \ | |
| bash -lc ' | |
| cmake --build "$BUILD_DIR" --target cppcheck | |
| ' | |
| - name: Upload docs artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gates-docs-html | |
| path: docs/build/html | |
| if-no-files-found: error |