Skip to content

Commit fd67e81

Browse files
committed
WIP: better hatch matrix in GH workflow
1 parent a80ab43 commit fd67e81

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

Diff for: .github/workflows/test.v2.yaml

+20-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,31 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11+
define-matirx:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
matrix: ${{ steps.set-matrix.outputs.matrix }}
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
19+
- name: Set matrix
20+
id: set-matrix
21+
run: |
22+
python -m pip install hatch
23+
{
24+
echo 'hatchenv<<EOF'
25+
echo $(hatch env show --json | jq -r 'to_entries[] | select(.key | startswith("test")) | .key')
26+
echo 'EOF'
27+
} >> "$GITHUB_OUTPUT"
28+
1129
test:
1230

1331
runs-on: ubuntu-latest
1432
strategy:
1533
fail-fast: false
1634
matrix:
17-
python-version: ["3.9", "3.10", "3.11", "3.12"]
35+
env: ${{fromJson(needs.define-matirx.outputs.hatchenv)}}
1836

1937
steps:
2038
- uses: actions/checkout@v3
@@ -24,7 +42,6 @@ jobs:
2442
python-version: ${{ matrix.python-version }}
2543
- name: Install Python dependencies
2644
run: |
27-
python -m pip install --upgrade pip
2845
python -m pip install hatch
2946
- name: Pytest
30-
run: hatch -v run +py=${{ matrix.python-version }} test:test
47+
run: hatch -v run ${{ matrix.env }}:test

0 commit comments

Comments
 (0)