1
- name : CI
1
+ name : Test and release when tagged
2
2
3
- on : [push, pull_request ]
3
+ on : [push]
4
4
5
5
jobs :
6
+ lint :
7
+ runs-on : ubuntu-latest
8
+ steps :
9
+ - uses : actions/checkout@v4
10
+ -
uses :
prefix-dev/[email protected]
11
+ with :
12
+ environments : lint
13
+ - run : pixi run --environment lint lint
14
+
6
15
test-linux :
16
+ runs-on : ubuntu-latest
7
17
strategy :
8
- fail-fast : false
9
18
matrix :
10
- python-version : ["3.9", "3.10", "3.11", "3.12", "3.13"]
19
+ environment :
20
+ - test-py311
21
+ - test-py312
22
+ - test-py313
11
23
numpy : [null, "numpy>=1.23,<2.0.0", "numpy>=2.0.0rc1"]
12
24
uncertainties : [null, "uncertainties==3.1.6", "uncertainties>=3.1.6,<4.0.0"]
13
25
extras : [null]
14
26
include :
15
- - python-version : " 3.10 " # Minimal versions
27
+ - environment : " test-py311 " # Minimal versions
16
28
numpy : " numpy>=1.23,<2.0.0"
17
29
extras : matplotlib==3.5.3
18
- - python-version : " 3.10 "
30
+ - environment : " test-py311 "
19
31
numpy : " numpy"
20
32
uncertainties : " uncertainties"
21
33
extras : " sparse xarray netCDF4 dask[complete]==2024.5.1 graphviz babel==2.8 mip>=1.13"
22
- - python-version : " 3.10 "
34
+ - environment : " test-py311 "
23
35
numpy : " numpy==1.26.1"
24
36
uncertainties : null
25
37
extras : " babel==2.15 matplotlib==3.9.0"
26
- runs-on : ubuntu-latest
27
-
28
- env :
29
- TEST_OPTS : " -rfsxEX -s --cov=pint --cov-config=.coveragerc --benchmark-skip"
30
-
31
38
steps :
32
- - uses : actions/checkout@v2
39
+ - uses : actions/checkout@v4
40
+ -
uses :
prefix-dev/[email protected]
33
41
with :
34
- fetch-depth : 100
35
-
36
- - name : Get tags
37
- run : git fetch --depth=1 origin +refs/tags/*:refs/tags/*
38
-
39
- - name : Set up Python ${{ matrix.python-version }}
40
- uses : actions/setup-python@v2
41
- with :
42
- python-version : ${{ matrix.python-version }}
43
-
44
- - name : Get pip cache dir
45
- id : pip-cache
46
- run : echo "::set-output name=dir::$(pip cache dir)"
47
-
48
- - name : Setup caching
49
- uses : actions/cache@v2
50
- with :
51
- path : ${{ steps.pip-cache.outputs.dir }}
52
- key : pip-${{ matrix.python-version }}
53
- restore-keys : |
54
- pip-${{ matrix.python-version }}
55
-
42
+ environments : ${{ matrix.environment }}
56
43
- name : Install numpy
57
44
if : ${{ matrix.numpy != null }}
58
45
run : pip install "${{matrix.numpy}}"
@@ -77,164 +64,67 @@ jobs:
77
64
run : |
78
65
sudo apt install -y graphviz
79
66
pip install packaging
80
- pip install .[testbase]
81
67
82
68
- name : Install pytest-mpl
83
69
if : contains(matrix.extras, 'matplotlib')
84
70
run : pip install pytest-mpl
85
-
86
- - name : Run Tests
87
- run : |
88
- pytest $TEST_OPTS
89
-
90
- # - name: Coverage report
91
- # run: coverage report -m
92
-
93
- # - name: Coveralls Parallel
94
- # env:
95
- # COVERALLS_FLAG_NAME: ${{ matrix.test-number }}
96
- # COVERALLS_PARALLEL: true
97
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98
- # COVERALLS_SERVICE_NAME: github
99
- # run: |
100
- # pip install coveralls "requests<2.29"
101
- # coveralls
71
+ - run : pixi run --environment ${{ matrix.environment }} test
102
72
103
73
test-windows :
74
+ runs-on : windows-latest
104
75
strategy :
105
- fail-fast : false
106
76
matrix :
107
- python-version : ["3.10", "3.11", "3.12"]
108
- numpy : [ "numpy>=1.23,<2.0.0" ]
109
- runs-on : windows-latest
110
-
111
- env :
112
- TEST_OPTS : " -rfsxEX -s -k issue1498b --benchmark-skip"
113
-
77
+ environment :
78
+ - test-py311
79
+ - test-py312
80
+ - test-py313
81
+ numpy : [null, "numpy>=1.23,<2.0.0", "numpy>=2.0.0rc1"]
114
82
steps :
115
- - uses : actions/checkout@v2
116
- with :
117
- fetch-depth : 100
118
-
119
- - name : Get tags
120
- run : git fetch --depth=1 origin +refs/tags/*:refs/tags/*
121
-
122
- - name : Set up Python ${{ matrix.python-version }}
123
- uses : actions/setup-python@v2
124
- with :
125
- python-version : ${{ matrix.python-version }}
126
-
127
- - name : Get pip cache dir
128
- id : pip-cache
129
- run : echo "::set-output name=dir::$(pip cache dir)"
130
-
131
- - name : Setup caching
132
- uses : actions/cache@v2
83
+ - uses : actions/checkout@v4
84
+ -
uses :
prefix-dev/[email protected]
133
85
with :
134
- path : ${{ steps.pip-cache.outputs.dir }}
135
- key : pip-windows-${{ matrix.python-version }}
136
- restore-keys : |
137
- pip-windows-${{ matrix.python-version }}
138
-
86
+ environments : ${{ matrix.environment }}
139
87
- name : Install numpy
140
88
if : ${{ matrix.numpy != null }}
141
89
run : pip install "${{matrix.numpy}}"
142
-
143
- # - name: Install uncertainties
144
- # if: ${{ matrix.uncertainties != null }}
145
- # run: pip install "${{matrix.uncertainties}}"
146
- #
147
- # - name: Install extras
148
- # if: ${{ matrix.extras != null }}
149
- # run: pip install ${{matrix.extras}}
150
-
151
- - name : Install dependencies
152
- run : |
153
- # sudo apt install -y graphviz
154
- pip install packaging
155
- pip install .[testbase]
156
-
157
- # - name: Install pytest-mpl
158
- # if: contains(matrix.extras, 'matplotlib')
159
- # run: pip install pytest-mpl
160
-
161
- - name : Run tests
162
- run : pytest -rfsxEX -s -k issue1498b --benchmark-skip
90
+ - run : pixi run --environment ${{ matrix.environment }} test
163
91
164
92
test-macos :
93
+ runs-on : macos-latest
165
94
strategy :
166
- fail-fast : false
167
95
matrix :
168
- python-version : ["3.10", "3.11", "3.12"]
169
- numpy : [null, "numpy>=1.23,<2.0.0" ]
170
- runs-on : macos-latest
171
-
172
- env :
173
- TEST_OPTS : " -rfsxEX -s --cov=pint --cov-config=.coveragerc --benchmark-skip"
174
-
96
+ environment :
97
+ - test-py311
98
+ - test-py312
99
+ - test-py313
100
+ numpy : [null, "numpy>=1.23,<2.0.0", "numpy>=2.0.0rc1"]
175
101
steps :
176
- - uses : actions/checkout@v2
102
+ - uses : actions/checkout@v4
103
+ -
uses :
prefix-dev/[email protected]
177
104
with :
178
- fetch-depth : 100
179
-
180
- - name : Get tags
181
- run : git fetch --depth=1 origin +refs/tags/*:refs/tags/*
182
-
183
- - name : Set up Python ${{ matrix.python-version }}
184
- uses : actions/setup-python@v2
185
- with :
186
- python-version : ${{ matrix.python-version }}
187
-
188
- - name : Get pip cache dir
189
- id : pip-cache
190
- run : echo "::set-output name=dir::$(pip cache dir)"
191
-
192
- - name : Setup caching
193
- uses : actions/cache@v2
194
- with :
195
- path : ${{ steps.pip-cache.outputs.dir }}
196
- key : pip-${{ matrix.python-version }}
197
- restore-keys : |
198
- pip-${{ matrix.python-version }}
199
-
105
+ environments : ${{ matrix.environment }}
200
106
- name : Install numpy
201
107
if : ${{ matrix.numpy != null }}
202
108
run : pip install "${{matrix.numpy}}"
109
+ - run : pixi run --environment ${{ matrix.environment }} test
203
110
204
- - name : Install dependencies
205
- run : |
206
- pip install packaging
207
- pip install .[testbase]
208
-
209
- - name : Run Tests
210
- run : |
211
- pytest $TEST_OPTS
212
-
213
- # - name: Coverage report
214
- # run: coverage report -m
111
+ publish :
112
+ if : github.ref_type == 'tag'
113
+ needs : [test-linux, test-windows, test-macos, lint]
215
114
216
- # - name: Coveralls Parallel
217
- # env:
218
- # COVERALLS_FLAG_NAME: ${{ matrix.test-number }}
219
- # COVERALLS_PARALLEL: true
220
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
221
- # COVERALLS_SERVICE_NAME: github
222
- # run: |
223
- # pip install coveralls "requests<2.29"
224
- # coveralls
115
+ runs-on : ubuntu-latest
116
+ environment :
117
+ name : pypi
118
+ url : https://pypi.org/p/pint
119
+ permissions :
120
+ id-token : write # for trusted publising to PyPI
225
121
226
- # coveralls:
227
- # needs: test-linux
228
- # runs-on: ubuntu-latest
229
- # steps:
230
- # - uses: actions/setup-python@v2
231
- # with:
232
- # python-version: 3.x
233
- # - name: Coveralls Finished
234
- # continue-on-error: true
235
- # env:
236
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
237
- # COVERALLS_SERVICE_NAME: github
238
- # run: |
239
- # pip install coveralls "requests<2.29"
240
- # coveralls --finish
122
+ steps :
123
+ - uses : actions/checkout@v4
124
+ -
uses :
prefix-dev/[email protected]
125
+ with :
126
+ environments : build
127
+ - name : Build the package
128
+ run : pixi run --environment build build
129
+ - name : Publish to PyPI
130
+ run : pixi run --environment build publish
0 commit comments