CI: job to build docs from HEAD and compare to docs/book
#382
Workflow file for this run
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: Commit | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test_cli: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| name: [linux-gcc-13] | |
| include: | |
| - name: linux-gcc-13 | |
| os: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Install bats | |
| if: runner.os == 'Linux' | |
| shell: bash | |
| run: | | |
| # Install bats | |
| git clone https://github.com/sstephenson/bats.git | |
| cd bats | |
| sudo ./install.sh /usr/local | |
| - name: Create Build Environment | |
| shell: bash | |
| run: cmake -E make_directory ${{runner.workspace}}/build | |
| - name: Configure | |
| shell: bash | |
| working-directory: ${{runner.workspace}}/build | |
| run: | | |
| cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug \ | |
| -DPISA_ENABLE_BENCHMARKING=OFF \ | |
| -DPISA_ENABLE_TESTING=OFF \ | |
| -DPISA_CI_BUILD=ON \ | |
| -DPISA_BUILD_TOOLS=ON .. | |
| - name: Build | |
| shell: bash | |
| working-directory: ${{runner.workspace}}/build | |
| run: cmake --build . --config Debug -- -j 4 | |
| - name: Install | |
| shell: bash | |
| working-directory: ${{runner.workspace}}/build | |
| run: sudo make install | |
| - name: Test CLI | |
| shell: bash | |
| working-directory: ${{runner.workspace}}/build | |
| env: | |
| TEST_DIR: ../pisa/test | |
| run: ../pisa/test/cli/run.sh | |
| - name: Upload test-cli build files | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-cli-build | |
| overwrite: true | |
| path: ${{runner.workspace}}/build | |
| coverage: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Bulid docker image | |
| shell: bash | |
| run: docker build -t pisa -f- . < "${{runner.workspace}}/pisa/test/docker/coverage/Dockerfile" | |
| - name: Generate and upload coverage | |
| shell: bash | |
| run: docker run --env CODECOV_TOKEN="${{ secrets.CODECOV_TOKEN }}" --rm pisa | |
| format: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install clang-format | |
| shell: bash | |
| run: | | |
| sudo pip install clang-format==20.1.6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.13 | |
| - name: Run clang-format | |
| shell: bash | |
| run: | | |
| wget https://raw.githubusercontent.com/Sarcasm/run-clang-format/master/run-clang-format.py | |
| python run-clang-format.py \ | |
| --clang-format-executable clang-format \ | |
| -r src/**/*.cpp include/pisa/**/*.hpp tools/*.cpp tools/*.hpp test/*.cpp | |
| docs: | |
| runs-on: ubuntu-22.04 | |
| needs: test_cli | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download test-cli build files | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: test-cli-build | |
| path: ${{runner.workspace}}/build | |
| - name: Make bin exec | |
| shell: bash | |
| run: chmod -R +x ${{runner.workspace}}/build/bin | |
| - name: Install mdbook | |
| shell: bash | |
| run: cargo install mdbook@^0.4.52 mdbook-cmdrun@0.7.3 | |
| - name: Link build/bin for docs hardcoded cmdrun to pisa/build/bin | |
| shell: bash | |
| run: | | |
| mkdir -p ${{runner.workspace}}/pisa/build | |
| ln -fs ${{runner.workspace}}/build/bin ${{runner.workspace}}/pisa/build/bin | |
| - name: Build docs | |
| working-directory: ${{runner.workspace}}/pisa/docs | |
| shell: bash | |
| run: | | |
| mkdir -p ${{runner.workspace}}/docs_output | |
| mdbook build --dest-dir ${{runner.workspace}}/docs_output | |
| - name: Diff | |
| shell: bash | |
| run: | | |
| diff -qr --exclude-from=${{runner.workspace}}/pisa/docs/diff-exclude.txt \ | |
| ${{runner.workspace}}/docs_output \ | |
| ${{runner.workspace}}/pisa/docs/book | |
| headers: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Bulid docker image | |
| shell: bash | |
| run: docker build -t pisa -f- . < "${{runner.workspace}}/pisa/test/docker/headers/Dockerfile" |