1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
name: Test and release when tagged
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.10
with:
environments: lint
- run: pixi run --environment lint lint --all-files --show-diff-on-failure
test-linux:
runs-on: ubuntu-latest
strategy:
matrix:
environment:
- test-py311
- test-py312
- test-py313
numpy: [null, "numpy>=1.25,<2.0.0", "numpy>=2.0.0rc1"]
uncertainties: [null, "uncertainties==3.1.6", "uncertainties>=3.1.6,<4.0.0"]
extras: [null]
include:
- environment: "test-py311" # Minimal versions
numpy: "numpy>=1.25,<2.0.0"
extras: matplotlib==3.5.3
- environment: "test-py311"
numpy: "numpy"
uncertainties: "uncertainties"
extras: "sparse xarray netCDF4 dask[complete]==2024.5.1 graphviz babel==2.8 mip>=1.13"
- environment: "test-py311"
numpy: "numpy==1.26.1"
uncertainties: null
extras: "babel==2.15 matplotlib==3.9.0"
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.10
with:
environments: ${{ matrix.environment }}
log-level: vvv
- name: Install numpy
if: ${{ matrix.numpy != null }}
run: pip install "${{matrix.numpy}}"
- name: Install uncertainties
if: ${{ matrix.uncertainties != null }}
run: pip install "${{matrix.uncertainties}}"
- name: Install extras
if: ${{ matrix.extras != null }}
run: pip install ${{matrix.extras}}
- name: Install locales
if: ${{ matrix.extras != null }}
run: |
sudo apt-get update
sudo apt-get install language-pack-es language-pack-fr language-pack-ro
sudo localedef -i es_ES -f UTF-8 es_ES
sudo localedef -i fr_FR -f UTF-8 fr_FR
sudo localedef -i ro_RO -f UTF-8 ro_RO
- name: Install dependencies
run: |
sudo apt install -y graphviz
pip install packaging
- name: Install pytest-mpl
if: contains(matrix.extras, 'matplotlib')
run: pip install pytest-mpl
- run: pixi run --environment ${{ matrix.environment }} test
test-windows:
runs-on: windows-latest
strategy:
matrix:
environment:
- test-py311
- test-py312
- test-py313
numpy: [null, "numpy>=1.25,<2.0.0", "numpy>=2.0.0rc1"]
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.10
with:
environments: ${{ matrix.environment }}
log-level: vvv
- name: Install numpy
if: ${{ matrix.numpy != null }}
run: pip install "${{matrix.numpy}}"
- run: pixi run --environment ${{ matrix.environment }} test
test-macos:
runs-on: macos-latest
strategy:
matrix:
environment:
- test-py311
- test-py312
- test-py313
numpy: [null, "numpy>=1.25,<2.0.0", "numpy>=2.0.0rc1"]
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.10
with:
environments: ${{ matrix.environment }}
log-level: vvv
- name: Install numpy
if: ${{ matrix.numpy != null }}
run: pip install "${{matrix.numpy}}"
- run: pixi run --environment ${{ matrix.environment }} test
publish:
if: github.ref_type == 'tag'
needs: [test-linux, test-windows, test-macos, lint]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pint
permissions:
id-token: write # for trusted publising to PyPI
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.10
with:
environments: build
- name: Build the package
run: pixi run --environment build build
- name: Publish to PyPI
run: pixi run --environment build publish
|