File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 3434
3535 - id : set-matrix
3636 run : |
37- echo "matrix=$( python -m nox -l --json | jq -c '[.[] | select(.name == "tests") | {"python-version": .python, "django-version": .call_spec.django}] | {include: .}')" >> $GITHUB_OUTPUT
37+ python -m nox --session "gha_matrix"
3838
3939 test :
4040 name : Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}
Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import json
34import os
45from pathlib import Path
56
@@ -130,3 +131,20 @@ def demo(session):
130131
131132 session .install ("django-simple-nav[dev] @ ." )
132133 session .run ("python" , "example/demo.py" , "runserver" , addrport )
134+
135+
136+ @nox .session
137+ def gha_matrix (session ):
138+ sessions = session .run ("nox" , "-l" , "--json" , silent = True )
139+ matrix = {
140+ "include" : [
141+ {
142+ "python-version" : session ["python" ],
143+ "django-version" : session ["call_spec" ]["django" ],
144+ }
145+ for session in json .loads (sessions )
146+ if session ["name" ] == "tests"
147+ ]
148+ }
149+ with Path (os .environ ["GITHUB_OUTPUT" ]).open ("a" ) as fh :
150+ print (f"matrix={ matrix } " , file = fh )
You can’t perform that action at this time.
0 commit comments