Validation and external directory updates #810
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: tests | |
| on: | |
| pull_request: | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Allows usage from other workflows | |
| workflow_call: | |
| inputs: | |
| source-artifact: | |
| description: Prepared source artifact to test instead of fetching core into a fresh checkout. | |
| required: false | |
| type: string | |
| default: "" | |
| jobs: | |
| format-and-types: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download prepared source | |
| if: ${{ inputs.source-artifact != '' }} | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: ${{ inputs.source-artifact }} | |
| path: . | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| - name: Report node version | |
| run: node --version | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: report python version | |
| run: uv run python --version | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Initialize project | |
| if: ${{ inputs.source-artifact == '' }} | |
| run: uv run python scripts/fetch_core.py | |
| - name: Check formatting with black | |
| run: uv run black --check --diff $(git ls-files "*.py") | |
| - name: Check for lint | |
| run: uv run flake8 | |
| - name: Check types | |
| run: uv run mypy --install-types --non-interactive | |
| deep-test: | |
| needs: format-and-types | |
| runs-on: ubuntu-22.04 | |
| container: pretextbook/pretext-full:latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download prepared source | |
| if: ${{ inputs.source-artifact != '' }} | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: ${{ inputs.source-artifact }} | |
| path: . | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Report Python version | |
| run: uv run python --version | |
| - name: set up node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| - name: Install build dependencies if on Linux | |
| run: | | |
| apt-get update | |
| apt-get -y install gcc pkg-config python3-dev build-essential python3-louis librsvg2-bin libcairo2-dev | |
| - name: Install dependencies | |
| shell: bash | |
| run: uv sync --all-extras | |
| - name: Initialize project | |
| if: ${{ inputs.source-artifact == '' }} | |
| run: uv run python scripts/fetch_core.py | |
| - name: Ensure dependencies are present | |
| run: | | |
| uv run pelican --version | |
| uv run playwright install chromium | |
| - name: Test with pytest | |
| run: | | |
| uv run pytest -v --cov | |
| broad-tests: | |
| needs: format-and-types | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| os: [ubuntu-latest, windows-latest] | |
| exclude: | |
| - os: windows-latest | |
| python-version: "3.10" | |
| - os: windows-latest | |
| python-version: "3.11" | |
| - os: windows-latest | |
| python-version: "3.12" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download prepared source | |
| if: ${{ inputs.source-artifact != '' }} | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: ${{ inputs.source-artifact }} | |
| path: . | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: set up node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| - name: Install build dependencies if on Linux | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install \ | |
| gcc pkg-config python3-dev build-essential python3-louis librsvg2-bin libcairo2-dev | |
| - name: Install dependencies | |
| shell: bash | |
| run: uv sync --all-extras | |
| - name: Initialize project | |
| if: ${{ inputs.source-artifact == '' }} | |
| run: uv run python scripts/fetch_core.py | |
| - name: Initialize playwright | |
| run: | | |
| echo "Installing playwright dependencies" | |
| uv run playwright install-deps | |
| echo "Installing playwright browsers" | |
| uv run playwright install | |
| - name: Ensure dependencies are present | |
| run: | | |
| uv run pelican --version | |
| - name: Test with pytest | |
| run: | | |
| uv run pytest -v --cov | |
| schema: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download prepared source | |
| if: ${{ inputs.source-artifact != '' }} | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: ${{ inputs.source-artifact }} | |
| path: . | |
| - uses: awalsh128/cache-apt-pkgs-action@latest | |
| with: | |
| packages: jing trang | |
| version: 1.0 | |
| - name: Make sure Schema rnc and rng files in sync via TRANG | |
| run: | | |
| trang ./schema/project-ptx.rnc ./tmp-project-ptx.rng | |
| cmp ./schema/project-ptx.rng ./tmp-project-ptx.rng | |
| - name: Verify template `project.ptx` match schema via JING | |
| run: | | |
| for i in $(find ./templates -name "project.ptx"); do jing ./schema/project-ptx.rng "$i"; done |