Refactor footer production #4374
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": | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - repomatic/** | |
| - tests/** | |
| - pyproject.toml | |
| - uv.lock | |
| - .github/workflows/tests.yaml | |
| pull_request: | |
| branches-ignore: | |
| - prepare-release | |
| paths: | |
| - repomatic/** | |
| - tests/** | |
| - pyproject.toml | |
| - uv.lock | |
| - .github/workflows/tests.yaml | |
| schedule: | |
| # Run tests monthly to catch regressions from dependency or environment changes. | |
| - cron: "17 9 1 * *" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ !startsWith(github.event.head_commit.message, '[changelog] Release') }} | |
| jobs: | |
| tests: | |
| strategy: | |
| # We delegate the failure decision to each job, by the way of the "continue-on-error" flag. | |
| fail-fast: false | |
| matrix: | |
| # Available OS: https://github.com/actions/runner-images#available-images | |
| # Only targets 2 variants per platforms to keep the matrix small. | |
| os: | |
| - ubuntu-24.04-arm # arm64 | |
| - ubuntu-slim # x86 | |
| - macos-26 # arm64 | |
| - macos-15-intel # x86 | |
| - windows-11-arm # arm64 | |
| - windows-2025 # x86 | |
| python-version: | |
| - "3.10" | |
| # Ignore intermediate versions to reduce CI load. | |
| # - "3.11" | |
| # - "3.12" | |
| # - "3.13" | |
| - "3.14" | |
| - "3.14t" | |
| - "3.15" | |
| - "3.15t" | |
| exclude: | |
| # Python 3.10 has no native ARM64 Windows build. | |
| - os: windows-11-arm | |
| python-version: "3.10" | |
| include: | |
| # Default all jobs as stable, unless marked otherwise below. | |
| - state: stable | |
| # XXX Python 3.15 is still in development. | |
| - state: unstable | |
| python-version: "3.15" | |
| - state: unstable | |
| python-version: "3.15t" | |
| name: "${{ matrix.state == 'stable' && '✅' || '⁉️' }} ${{ matrix.os }} / py${{ matrix.python-version }}" | |
| runs-on: ${{ matrix.os }} | |
| # We keep going when a job flagged as not stable fails. | |
| continue-on-error: ${{ matrix.state == 'unstable' }} | |
| steps: | |
| - uses: actions/checkout@v6.0.2 | |
| - uses: astral-sh/setup-uv@v7.3.0 | |
| - name: Force native ARM64 Python on Windows ARM64 | |
| # Workaround for https://github.com/astral-sh/uv/issues/12906: uv defaults to x86_64 Python on ARM64 Windows, | |
| # relying on transparent emulation. Native extensions with Rust (e.g., test-results-parser from codecov-cli) | |
| # fail to compile because the ARM64 Rust toolchain lacks the x86_64-pc-windows-msvc target. Setting UV_PYTHON | |
| # to an architecture-qualified specifier forces uv (and uvx) to use native ARM64 Python for all steps. | |
| if: runner.os == 'Windows' && runner.arch == 'ARM64' | |
| shell: bash | |
| run: echo "UV_PYTHON=cpython-${{ matrix.python-version }}-aarch64" >> "$GITHUB_ENV" | |
| - name: Install Python ${{ matrix.python-version }} | |
| # If UV cannot find the requested Python version, it exits with code 2, which let the job pass unnoticed on | |
| # Windows. So we force the shell to bash, even on Windows, and "set -e" to ensure any error in the install | |
| # process is caught and fails the job. It works because Windows runners too Git Bash available). | |
| shell: bash | |
| run: | | |
| set -e | |
| uv --no-progress venv --python "${UV_PYTHON:-${{ matrix.python-version }}}" | |
| - name: Install project | |
| run: uv --no-progress sync --frozen --group test | |
| - name: Check launchable modules | |
| run: | | |
| uv run -m repomatic --version | |
| uv run python -m repomatic --version | |
| - name: Check launchable stable CLI | |
| run: | | |
| uvx -- repomatic --version | |
| uv run -- repomatic --version | |
| - name: Check launchable dev CLI | |
| run: | | |
| uvx --from git+https://github.com/kdeldycke/repomatic -- repomatic --version | |
| uv run --with git+https://github.com/kdeldycke/repomatic -- repomatic --version | |
| - name: Unittests | |
| # Produce XML artifacts for Codecov integration (coverage + test analytics). | |
| run: > | |
| uv --no-progress run --frozen -- pytest | |
| --cov-report=xml | |
| --junitxml=junit.xml | |
| --override-ini=junit_family=legacy | |
| - name: Upload coverage to Codecov | |
| run: > | |
| uvx --no-progress 'codecov-cli==11.2.6' | |
| --auto-load-params-from githubactions | |
| upload-process | |
| --git-service github | |
| --report-type coverage | |
| --token ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload test results to Codecov | |
| run: > | |
| uvx --no-progress 'codecov-cli==11.2.6' | |
| --auto-load-params-from githubactions | |
| upload-process | |
| --git-service github | |
| --report-type test_results | |
| --token ${{ secrets.CODECOV_TOKEN }} | |
| - name: Self-tests against test plan | |
| # test-plan-file is auto-detected from [tool.repomatic] in pyproject.toml. | |
| run: uv run --frozen --no-progress -- repomatic test-plan --command "uv run -- repomatic" | |
| project-metadata: | |
| name: 🧬 Project metadata | |
| runs-on: ubuntu-slim | |
| outputs: | |
| build_targets: ${{ steps.project-metadata.outputs.build_targets }} | |
| steps: | |
| - uses: actions/checkout@v6.0.2 | |
| - uses: astral-sh/setup-uv@v7.3.0 | |
| - name: Run repomatic metadata | |
| id: project-metadata | |
| run: uvx --no-progress --from . repomatic metadata --output "$GITHUB_OUTPUT" | |
| validate-arch: | |
| # Check architecture matches the one expected from the runner image. This is to ensure that the OS does not rely on | |
| # emulation to run the build. See: | |
| # https://docs.astral.sh/uv/concepts/python-versions/#transparent-x86_64-emulation-on-aarch64 | |
| name: 🖥️ Validate ${{ matrix.os }} / ${{ matrix.arch }} | |
| needs: | |
| - project-metadata | |
| if: needs.project-metadata.outputs.build_targets | |
| strategy: | |
| matrix: | |
| include: ${{ fromJSON(needs.project-metadata.outputs.build_targets) }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Check Python version | |
| run: | | |
| python --version | |
| python -m pip --version | |
| - name: Check architecture is ${{ matrix.arch }} | |
| shell: python | |
| run: | | |
| import platform | |
| arch = platform.machine() | |
| print(f"Detected architecture: {arch}") | |
| matrix_arch = "${{ matrix.arch }}" | |
| if matrix_arch == "x64": | |
| assert arch.lower() in ("x86_64", "amd64") | |
| elif matrix_arch == "arm64": | |
| assert arch.lower() in ("aarch64", "arm64") | |
| else: | |
| raise ValueError(f"Unrecognized architecture in the matrix: {matrix_arch}") |