POC: Jinja + Markup middle-ground for outer repr template #18
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - "[0-9]+.[0-9]+.x" | |
| pull_request: | |
| env: | |
| FORCE_COLOR: "1" | |
| # Cancel the job if new commits are pushed: https://stackoverflow.com/q/66335225/247482 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| get-environments: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| envs: ${{ steps.get-envs.outputs.envs }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| filter: blob:none | |
| fetch-depth: 0 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: false | |
| - id: get-envs | |
| run: | | |
| ENVS_JSON=$(NO_COLOR=1 uvx hatch env show --json | jq -c 'to_entries | |
| | map( | |
| select(.key | startswith("hatch-test")) | |
| | { name: .key, python: .value.python, args: (.value."extra-args" // [] | join(" ")) } | |
| )') | |
| echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT | |
| test: | |
| needs: get-environments | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| env: ${{ fromJSON(needs.get-environments.outputs.envs) }} | |
| io_mark: ["zarr_io", "not zarr_io", "dask_distributed"] # dask_distributed should not be run with -n auto as it uses a client with processes | |
| exclude: | |
| - { env: { name: "hatch-test.array_api" }, io_mark: "dask_distributed" } | |
| permissions: | |
| id-token: write # for codecov OIDC | |
| env: # environment variables for use in codecov’s env_vars tagging | |
| ENV_NAME: ${{ matrix.env.name }} | |
| IO_MARK: ${{ matrix.io_mark }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| filter: blob:none | |
| - name: Install system dependencies | |
| run: sudo apt install -y hdf5-tools | |
| - name: Install UV | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.env.python }} | |
| - name: Install dependencies | |
| run: | | |
| uv tool install hatch | |
| hatch -v env create ${{ matrix.env.name }} | |
| - name: Run tests | |
| run: | | |
| hatch run ${{ matrix.env.name }}:run-cov -v --color=yes ${{ matrix.io_mark != 'dask_distributed' && '-n auto' || '' }} --junitxml=test-data/test-results.xml -m "${{ matrix.env.name == 'hatch-test.array_api' && 'array_api and ' || '' }}${{ matrix.io_mark }}" ${{ matrix.env.args }} | |
| hatch run ${{ matrix.env.name }}:cov-combine | |
| hatch run ${{ matrix.env.name }}:coverage xml | |
| hatch run ${{ matrix.env.name }}:cov-report | |
| - name: Upload test results | |
| if: ${{ !cancelled() }} | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| report_type: test_results | |
| env_vars: ENV_NAME,IO_MARK | |
| files: test-data/test-results.xml | |
| use_oidc: true | |
| fail_ci_if_error: true | |
| - name: Upload coverage data | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| env_vars: ENV_NAME,IO_MARK | |
| files: test-data/coverage.xml | |
| use_oidc: true | |
| fail_ci_if_error: true | |
| build: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| filter: blob:none | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.x' | |
| cache: pip | |
| - name: Install build tools and requirements | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Display installed versions | |
| run: pip list | |
| - name: Build & Twine check | |
| run: | | |
| python -m build --sdist --wheel . | |
| twine check dist/* | |
| check: | |
| if: always() | |
| needs: | |
| - get-environments | |
| - test | |
| - build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: re-actors/alls-green@release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} |