Add issue and PR templates #19
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: Continuous Integration | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: {} | |
| env: | |
| PYTHON_VERSION: "3.10" | |
| jobs: | |
| determine_changes: | |
| name: "determine changes" | |
| runs-on: ubuntu-latest | |
| outputs: | |
| # Flag that is raised when any code is changed | |
| code: ${{ steps.check_code.outputs.changed }} | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Determine merge base | |
| id: merge_base | |
| env: | |
| BASE_REF: ${{ github.event.pull_request.base.ref || 'main' }} | |
| run: | | |
| sha=$(git merge-base HEAD "origin/${BASE_REF}") | |
| echo "sha=${sha}" >> "$GITHUB_OUTPUT" | |
| - name: Check if there was any code related change | |
| id: check_code | |
| env: | |
| MERGE_BASE: ${{ steps.merge_base.outputs.sha }} | |
| run: | | |
| if git diff --quiet "${MERGE_BASE}...HEAD" -- \ | |
| . \ | |
| ':!docs/' \ | |
| ':!CODE_OF_CONDUCT.md' \ | |
| ':!CONTRIBUTING.md' \ | |
| ':!LICENSE' \ | |
| ':!pyproject.toml' \ | |
| ':!README.md' \ | |
| ':!zensical.toml' \ | |
| ; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| pre-commit: | |
| name: "pre commit" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: j178/prek-action@91fd7d7cf70ae1dee9f4f44e7dfa5d1073fe6623 # v1.0.11 | |
| build-docs: | |
| name: "Build docs" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Prepare docs | |
| run: uv run --script scripts/prepare_docs.py | |
| - name: Build docs | |
| run: uv run --isolated --with-requirements docs/requirements.txt zensical build | |
| cargo-test: | |
| name: "cargo test (${{ matrix.os }})" | |
| runs-on: ${{ matrix.os }} | |
| needs: determine_changes | |
| if: ${{ (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }} | |
| strategy: | |
| max-parallel: 18 | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | |
| - name: "Install Rust toolchain" | |
| run: rustup show | |
| - name: "Install cargo nextest" | |
| uses: taiki-e/install-action@a416ddeedbd372e614cc1386e8b642692f66865e # v2.57.1 | |
| with: | |
| tool: cargo-nextest | |
| - name: "Cargo test" | |
| run: | | |
| cargo nextest run --no-fail-fast --all-features | |
| coverage: | |
| name: "coverage" | |
| runs-on: ubuntu-latest | |
| needs: determine_changes | |
| if: ${{ (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }} | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | |
| - name: "Install Rust toolchain" | |
| run: rustup show | |
| - name: Install cargo-llvm-cov | |
| uses: taiki-e/install-action@62da238c048aa0f865cc5a322082957d34e7fc1a # v2.62.54 | |
| with: | |
| tool: cargo-llvm-cov,cargo-nextest | |
| - name: Generate code coverage | |
| run: cargo llvm-cov nextest --all-features --lcov --output-path lcov.info | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: lcov.info | |
| slug: MatthewMckee4/action-format | |
| fail_ci_if_error: true |