Skip to content

Update dev workflow to use Pixi #858

Update dev workflow to use Pixi

Update dev workflow to use Pixi #858

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -el {0}
env:
# Many color libraries just need this to be set to any value, but at least
# one distinguishes color depth, where "3" -> "256-bit color".
FORCE_COLOR: 3
PIXI_VERSION: "v0.63.2"
jobs:
cache-pixi-lock:
runs-on: ubuntu-slim
outputs:
cache-key: ${{ steps.pixi-lock.outputs.cache-key }}
pixi-version: ${{ steps.pixi-lock.outputs.pixi-version }}
steps:
- uses: actions/checkout@v4
- uses: Parcels-code/pixi-lock/create-and-cache@9a2866f8258b87a3c616d5ad7d51c6cd853df78b
id: pixi-lock
with:
pixi-version: ${{env.PIXI_VERSION}}
- uses: actions/upload-artifact@v6 # make available as an artifact for local testing
with:
name: pixi-lock
path: pixi.lock
tests:
name: "Unit tests: ${{ matrix.runs-on }} | pixi run -e ${{ matrix.pixi-environment }} tests"
runs-on: ${{ matrix.runs-on }}
needs: cache-pixi-lock
strategy:
fail-fast: false
matrix:
pixi-environment: ["test-py310", "test-py312"]
runs-on: [ubuntu-latest, windows-latest, macos-14]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Parcels-code/pixi-lock/restore@9a2866f8258b87a3c616d5ad7d51c6cd853df78b
with:
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
- uses: prefix-dev/setup-pixi@v0.9.4
with:
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
- name: Test package
run:
pixi run -e ${{ matrix.pixi-environment }} tests -ra --cov --cov-report=xml --cov-report=term
--durations=20
- name: Upload coverage report
uses: codecov/codecov-action@v5.4.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
typechecking:
name: "TypeChecking: pixi run typing"
runs-on: ubuntu-latest
if: false
needs: cache-pixi-lock
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Parcels-code/pixi-lock/restore@9a2866f8258b87a3c616d5ad7d51c6cd853df78b
with:
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
- uses: prefix-dev/setup-pixi@v0.9.4
with:
cache: true
pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
- name: Typechecking
run: pixi run typing --non-interactive --html-report mypy-report
- name: Upload test results
if: ${{ always() }} # Upload even on mypy error
uses: actions/upload-artifact@v4
with:
name: Mypy report
path: mypy-report