Skip to content

Commit 84abe06

Browse files
committed
Adapt CI to use pixi
1 parent 351f1d8 commit 84abe06

File tree

2 files changed

+40
-163
lines changed

2 files changed

+40
-163
lines changed

.github/workflows/extensions.yml

Lines changed: 3 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
- gubbins
87
pull_request:
98
branches:
109
- main
@@ -15,59 +14,6 @@ defaults:
1514
shell: bash -el {0}
1615

1716
jobs:
18-
unittest:
19-
name: Unit test - ${{ matrix.package }}
20-
runs-on: ubuntu-latest
21-
strategy:
22-
fail-fast: false
23-
matrix:
24-
# In principle, the dependencies could be limited to the extension packages.
25-
# However, we want to use the local packages, and not those published on pypi
26-
include:
27-
- package: "./extensions/gubbins/gubbins-core"
28-
dependencies: "./extensions/gubbins/gubbins-testing ./diracx-testing ./diracx-core"
29-
- package: "./extensions/gubbins/gubbins-db"
30-
dependencies: "./extensions/gubbins/gubbins-testing ./extensions/gubbins/gubbins-core ./diracx-testing ./diracx-db ./diracx-core"
31-
- package: "./extensions/gubbins/gubbins-logic"
32-
dependencies: "./extensions/gubbins/gubbins-db ./extensions/gubbins/gubbins-core ./diracx-db ./diracx-core ./diracx-logic"
33-
- package: "./extensions/gubbins/gubbins-routers"
34-
dependencies: "./extensions/gubbins/gubbins-testing ./extensions/gubbins/gubbins-db ./extensions/gubbins/gubbins-logic ./extensions/gubbins/gubbins-core ./diracx-testing ./diracx-db ./diracx-logic ./diracx-core ./diracx-routers"
35-
- package: "./extensions/gubbins/gubbins-client"
36-
dependencies: "./extensions/gubbins/gubbins-testing ./diracx-testing ./extensions/gubbins/gubbins-client ./extensions/gubbins/gubbins-core ./diracx-client ./diracx-core"
37-
- package: "./extensions/gubbins/gubbins-cli"
38-
dependencies: "./extensions/gubbins/gubbins-testing ./extensions/gubbins/gubbins-client ./extensions/gubbins/gubbins-core ./diracx-testing ./diracx-cli ./diracx-client ./diracx-core ./diracx-api"
39-
steps:
40-
- name: Checkout code
41-
uses: actions/checkout@v4
42-
- uses: mamba-org/setup-micromamba@v2
43-
with:
44-
# TODO: Use a conda environment file used for the diracx/base container image
45-
environment-name: test-env
46-
create-args: >-
47-
python=3.11
48-
m2crypto
49-
python-gfal2
50-
mypy
51-
pip
52-
init-shell: bash
53-
post-cleanup: 'all'
54-
- name: Set up environment
55-
run: |
56-
pip install pytest-github-actions-annotate-failures
57-
pip install git+https://github.com/DIRACGrid/DIRAC.git@integration
58-
pip install ${{ matrix.dependencies }} ${{ matrix.package }}[types]
59-
- name: Run mypy
60-
run: |
61-
mypy ${{ matrix.package }}/src
62-
- name: Run pytest
63-
if: ${{ matrix.package != './extensions/gubbins/gubbins-logic' }}
64-
run: |
65-
cd ${{ matrix.package }}
66-
pip install .[testing]
67-
pytest --cov-report=xml:coverage.xml --junitxml=report.xml
68-
- name: Upload coverage report
69-
uses: codecov/codecov-action@v5.4.2
70-
7117

7218
build-wheels:
7319
name: Build wheels
@@ -178,16 +124,9 @@ jobs:
178124
docker image ls -a
179125
- name: Checkout code
180126
uses: actions/checkout@v4
181-
- uses: mamba-org/setup-micromamba@v2
127+
- uses: prefix-dev/setup-pixi@v0.8.3
182128
with:
183-
environment-file: environment.yml
184-
init-shell: bash
185-
post-cleanup: 'all'
186-
- name: Set up environment
187-
run: |
188-
pip install pytest-github-actions-annotate-failures
189-
pip install git+https://github.com/DIRACGrid/DIRAC.git@integration
190-
pip install ./diracx-core/[testing] ./diracx-api/[testing] ./diracx-cli/[testing] ./diracx-client/[testing] ./diracx-routers/[testing] ./diracx-logic/[testing] ./diracx-db/[testing] ./diracx-testing/[testing] ./extensions/gubbins/gubbins-testing[testing] ./extensions/gubbins/gubbins-db[testing] ./extensions/gubbins/gubbins-logic/[testing] ./extensions/gubbins/gubbins-routers/[testing] ./extensions/gubbins/gubbins-client/[testing] ./extensions/gubbins/gubbins-cli/[testing] ./extensions/gubbins/gubbins-core/[testing]
129+
environments: default-gubbins
191130
- name: Start demo
192131
run: |
193132
git clone https://github.com/DIRACGrid/diracx-charts.git ../diracx-charts
@@ -221,7 +160,7 @@ jobs:
221160
- name: Run pytest
222161
run: |
223162
cd extensions/gubbins
224-
pytest --demo-dir=../../../diracx-charts/ --cov-report=xml:coverage-pytest.xml --junitxml=report.xml
163+
pixi run pytest-diracx --demo-dir=../../../diracx-charts/ --cov-report=xml:coverage-pytest.xml --junitxml=report.xml
225164
- name: Collect demo coverage
226165
run: |
227166
DIRACX_DEMO_DIR=$PWD/../diracx-charts/.demo
@@ -245,7 +184,6 @@ jobs:
245184
ln -sf "${fn}" "${fake_module}/src/diracx/$(basename "${fn}")"
246185
done
247186
248-
249187
mkdir -p "${fake_module}/src/gubbins"
250188
for fn in "${PWD}"/extensions/gubbins/*/src/gubbins/*; do
251189
ln -sf "${fn}" "${fake_module}/src/gubbins/$(basename "${fn}")"
@@ -260,25 +198,3 @@ jobs:
260198
uses: codecov/codecov-action@v5.4.2
261199
with:
262200
files: ./coverage-pytest.xml,./coverage-demo.xml
263-
264-
client-generation:
265-
runs-on: ubuntu-latest
266-
steps:
267-
- name: Checkout code
268-
uses: actions/checkout@v4
269-
- uses: mamba-org/setup-micromamba@v2
270-
with:
271-
environment-file: environment.yml
272-
init-shell: bash
273-
post-cleanup: 'all'
274-
- name: Set up environment
275-
run: |
276-
micromamba install -c conda-forge nodejs pre-commit
277-
pip install git+https://github.com/DIRACGrid/DIRAC.git@integration
278-
pip install ./diracx-core/[testing] ./diracx-api/[testing] ./diracx-cli/[testing] ./diracx-client/[testing] ./diracx-routers/[testing] ./diracx-logic/[testing] ./diracx-logic/[testing] ./diracx-db/[testing] ./diracx-testing/[testing] ./extensions/gubbins/gubbins-testing[testing] ./extensions/gubbins/gubbins-db[testing] ./extensions/gubbins/gubbins-logic[testing] ./extensions/gubbins/gubbins-routers/[testing] ./extensions/gubbins/gubbins-testing/[testing] -e ./extensions/gubbins/gubbins-client/[testing] ./extensions/gubbins/gubbins-core/[testing]
279-
npm install -g autorest
280-
- name: Run autorest
281-
run: |
282-
autorest --python --help
283-
$HOME/.autorest/\@autorest_python\@*/node_modules/\@autorest/python/venv/bin/python -m pip install --upgrade setuptools
284-
pytest --no-cov --regenerate-client extensions/gubbins/gubbins-client/tests/test_regenerate.py

.github/workflows/main.yml

Lines changed: 37 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -12,75 +12,50 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}
1313
cancel-in-progress: true
1414

15-
defaults:
16-
run:
17-
shell: bash -el {0}
18-
1915
jobs:
2016

2117
shellcheck:
2218
runs-on: ubuntu-latest
23-
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx'
24-
timeout-minutes: 30
25-
2619
steps:
27-
- uses: actions/checkout@v4
28-
- name: Run shellcheck
29-
# Excluded codes related to sourcing files
30-
# SC1090: Can't follow non-constant source
31-
# SC1091: Not following sourced file
32-
run: |
33-
find -name '*.sh' -print0 | xargs -0 -n1 shellcheck --exclude=SC1090,SC1091 --external-source
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
- uses: prefix-dev/setup-pixi@v0.8.3
23+
with:
24+
environments: shellcheck
25+
- name: Run shellcheck
26+
run: pixi run shellcheck
3427

3528
unittest:
3629
name: Unit test - ${{ matrix.package }}
3730
runs-on: ubuntu-latest
3831
strategy:
3932
fail-fast: false
4033
matrix:
41-
include:
42-
- package: "./diracx-core"
43-
dependencies: "./diracx-testing"
44-
- package: "./diracx-db"
45-
dependencies: "./diracx-testing ./diracx-core"
46-
- package: "./diracx-logic"
47-
dependencies: "./diracx-core ./diracx-db"
48-
- package: "./diracx-routers"
49-
dependencies: "./diracx-testing ./diracx-core ./diracx-db ./diracx-logic"
50-
- package: "./diracx-client"
51-
dependencies: "./diracx-testing ./diracx-core"
52-
- package: "./diracx-api"
53-
dependencies: "./diracx-testing ./diracx-core ./diracx-client"
54-
- package: "./diracx-cli"
55-
dependencies: "./diracx-testing ./diracx-core ./diracx-client ./diracx-api"
34+
package:
35+
- diracx-core
36+
- diracx-db
37+
- diracx-logic
38+
- diracx-routers
39+
- diracx-client
40+
- diracx-api
41+
- diracx-cli
42+
- gubbins-core
43+
- gubbins-db
44+
- gubbins-logic
45+
- gubbins-routers
46+
- gubbins-client
47+
- gubbins-api
48+
- gubbins-cli
5649
steps:
5750
- name: Checkout code
5851
uses: actions/checkout@v4
59-
- uses: mamba-org/setup-micromamba@v2
52+
- uses: prefix-dev/setup-pixi@v0.8.3
6053
with:
61-
# TODO: Use a conda environment file used for the diracx/base container image
62-
environment-name: test-env
63-
environment-file: environment.yml
64-
init-shell: bash
65-
post-cleanup: 'all'
66-
- name: Set up environment
67-
run: |
68-
pip install pytest-github-actions-annotate-failures
69-
# Note: DIRAC will install pretty much everything
70-
# from diracx so installing just the dependency may
71-
# be a bit useless
72-
pip install git+https://github.com/DIRACGrid/DIRAC.git@integration
73-
pip install ${{ matrix.dependencies }}
54+
environments: ${{ matrix.package }}
7455
- name: Run pytest
75-
if: ${{ matrix.package != './diracx-logic' }}
76-
run: |
77-
cd ${{ matrix.package }}
78-
pip install .[testing]
79-
pytest --cov-report=xml:coverage.xml --junitxml=report.xml
80-
- name: Run mypy
81-
run: |
82-
pip install mypy ${{ matrix.package }}[types]
83-
mypy ${{ matrix.package }}/src
56+
env:
57+
EXTRA_PYTEST_ARGS: --cov-report=xml:coverage.xml --junitxml=report.xml
58+
run: pixi run unit-${{ matrix.package }}
8459
- name: Upload coverage report
8560
uses: codecov/codecov-action@v5.4.2
8661

@@ -89,16 +64,9 @@ jobs:
8964
steps:
9065
- name: Checkout code
9166
uses: actions/checkout@v4
92-
- uses: mamba-org/setup-micromamba@v2
67+
- uses: prefix-dev/setup-pixi@v0.8.3
9368
with:
94-
environment-file: environment.yml
95-
init-shell: bash
96-
post-cleanup: 'all'
97-
- name: Set up environment
98-
run: |
99-
pip install pytest-github-actions-annotate-failures
100-
pip install git+https://github.com/DIRACGrid/DIRAC.git@integration
101-
pip install ./diracx-core/[testing] ./diracx-api/[testing] ./diracx-cli/[testing] ./diracx-client/[testing] ./diracx-routers/[testing] ./diracx-logic/[testing] ./diracx-db/[testing] ./diracx-testing/
69+
environments: default
10270
- name: Start demo
10371
run: |
10472
git clone https://github.com/DIRACGrid/diracx-charts.git ../diracx-charts
@@ -123,7 +91,7 @@ jobs:
12391
fi
12492
- name: Run pytest
12593
run: |
126-
pytest --demo-dir=../diracx-charts/ --cov-report=xml:coverage-pytest.xml --junitxml=report.xml
94+
pixi run pytest-diracx --demo-dir=../diracx-charts/ --cov-report=xml:coverage-pytest.xml --junitxml=report.xml
12795
- name: Collect demo coverage
12896
run: |
12997
DIRACX_DEMO_DIR=$PWD/../diracx-charts/.demo
@@ -155,22 +123,15 @@ jobs:
155123

156124
client-generation:
157125
runs-on: ubuntu-latest
126+
strategy:
127+
fail-fast: false
128+
matrix:
129+
package: [diracx, gubbins]
158130
steps:
159131
- name: Checkout code
160132
uses: actions/checkout@v4
161-
- uses: mamba-org/setup-micromamba@v2
133+
- uses: prefix-dev/setup-pixi@v0.8.3
162134
with:
163-
environment-file: environment.yml
164-
init-shell: bash
165-
post-cleanup: 'all'
166-
- name: Set up environment
167-
run: |
168-
micromamba install -c conda-forge nodejs pre-commit
169-
pip install git+https://github.com/DIRACGrid/DIRAC.git@integration
170-
pip install ./diracx-core/ ./diracx-api/ ./diracx-cli/ -e ./diracx-client/[testing] ./diracx-routers/[testing] ./diracx-logic/[testing] ./diracx-db/ ./diracx-testing/
171-
npm install -g autorest
135+
environments: ${{ matrix.package }}-generate-client
172136
- name: Run autorest
173-
run: |
174-
autorest --python --help
175-
$HOME/.autorest/\@autorest_python\@*/node_modules/\@autorest/python/venv/bin/python -m pip install --upgrade setuptools
176-
pytest --no-cov --regenerate-client diracx-client/tests/test_regenerate.py
137+
run: pixi run -e ${{ matrix.package }}-generate-client generate-client

0 commit comments

Comments
 (0)