Improvements suggested by Bytetec #683
Workflow file for this run
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: build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python: | |
- '3.x' | |
- '3.10' | |
- '3.7' | |
build_api_docs: ["ON"] | |
werror: ["OFF"] | |
include: | |
- python: '3.7' | |
build_api_docs: "OFF" | |
werror: "ON" | |
- python: '3.7' | |
build_api_docs: "OFF" | |
werror: "OFF" | |
# Set the job name, have to use horrible syntax to achieve nice names | |
name: build${{ fromJSON('{true:" API",false:""}')[matrix.build_api_docs == 'ON'] }}${{ fromJSON('{true:" Werror",false:""}')[matrix.werror == 'ON'] }}${{ fromJSON('{true:" annotated",false:""}')[matrix.werror == 'OFF' && matrix.build_api_docs == 'OFF'] }} ${{ matrix.python}} | |
env: | |
python: ${{ matrix.python }} | |
build_api_docs: ${{ matrix.build_api_docs }} | |
werror: ${{ matrix.werror }} | |
steps: | |
- name: Checkout FLAMEGPU2/FLAMEGPU2-docs | |
uses: actions/checkout@v3 | |
with: | |
path: FLAMEGPU2-docs | |
- name: Checkout FLAMEGPU2/FLAMEGPU2 | |
if: env.build_api_docs == 'ON' | |
uses: actions/checkout@v3 | |
with: | |
repository: FLAMEGPU/FLAMEGPU2 | |
path: FLAMEGPU2 | |
# Install dependencies via apt | |
- name: Install graphviz | |
run: sudo apt -y install graphviz | |
# Install API docs dependencies via apt | |
- name: Install doxygen | |
if: env.build_api_docs == 'ON' | |
run: sudo apt -y install doxygen | |
- name: Select Python | |
if: ${{ env.python != '' }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.python }} | |
- name: Install python packages | |
working-directory: FLAMEGPU2-docs | |
run: | | |
mkdir -p -m 700 .venv | |
python3 -m venv .venv | |
source .venv/bin/activate | |
python3 -m pip install -r requirements.txt | |
# Annotations only enabled for non-API builds, with Werror=off, as werror changes the output format of sphinx messages... | |
- name: Add custom problem matchers for annotations | |
if: ${{ env.build_api_docs == 'OFF' && env.werror == 'OFF' }} | |
run: echo "::add-matcher::FLAMEGPU2-docs/.github/problem-matchers.json" | |
- name: Configure | |
working-directory: FLAMEGPU2-docs | |
run: | | |
source .venv/bin/activate | |
cmake . -B build -DFLAMEGPU_DOCS_WARNINGS_AS_ERRORS=${{ env.werror }} | |
- name: Build | |
working-directory: FLAMEGPU2-docs/build | |
run: cmake --build . --target all --verbose -j `nproc` | |
- name: Create Archive on PR | |
if: ${{ github.event_name == 'pull_request' && matrix.werror == 'OFF'}} | |
working-directory: FLAMEGPU2-docs/build | |
run: zip html.zip -r userguide/ | |
- name: Upload Artifact on PR | |
if: ${{ github.event_name == 'pull_request' && matrix.werror == 'OFF'}} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: userguide-py${{ env.python }}${{ fromJSON('{true:"-NOAPI",false:""}')[matrix.werror == 'OFF' && matrix.build_api_docs == 'OFF'] }} | |
path: FLAMEGPU2-docs/build/html.zip | |
if-no-files-found: error | |
retention-days: 14 |