1212 pull_request :
1313 branches :
1414 - main
15+
16+ defaults :
17+ run :
18+ shell : bash -l {0}
19+
1520jobs :
1621 # pre-job to read nox tests matrix - see https://stackoverflow.com/q/66747359/7262247
1722 list_nox_test_sessions :
1823 runs-on : ubuntu-latest
1924 steps :
20- - uses : actions/checkout@v2
21- - uses : actions/setup-python@v1
25+ - name : Checkout
26+ uses : actions/checkout@v2
27+
28+ - name : Install python 3.9
29+ uses : actions/setup-python@v4
2230 with :
23- python-version : 3.7
31+ python-version : 3.9
2432 architecture : x64
2533
2634 - name : Install noxfile requirements
27- shell : bash -l {0}
2835 run : pip install -r noxfile-requirements.txt
2936
30- - name : List 'tests' nox sessions
37+ - name : List 'tests' nox sessions and required python versions
3138 id : set-matrix
32- run : echo "::set-output name=matrix::$(nox -s gha_list -- tests)"
39+ run : echo "::set-output name=matrix::$(nox -s gha_list -- -s tests -v)"
40+
3341 outputs :
3442 matrix : ${{ steps.set-matrix.outputs.matrix }} # save nox sessions list to outputs
3543
@@ -38,36 +46,39 @@ jobs:
3846 strategy :
3947 fail-fast : false
4048 matrix :
49+ # see https://github.com/actions/setup-python/issues/544
50+ # os: [ ubuntu-20.04 ]
4151 os : [ ubuntu-latest ] # , macos-latest, windows-latest]
4252 # all nox sessions: manually > dynamically from previous job
4353 # nox_session: ["tests-2.7(env='pytest2.x')", "tests-3.7(env='pytest-latest')"]
4454 nox_session : ${{ fromJson(needs.list_nox_test_sessions.outputs.matrix) }}
4555
46- name : ${{ matrix.os }} ${{ matrix.nox_session }} # ${{ matrix.name_suffix }}
56+ name : ${{ matrix.os }} ${{ matrix.nox_session.python }} ${{ matrix.nox_session.session }} # ${{ matrix.name_suffix }}
4757 runs-on : ${{ matrix.os }}
4858 steps :
49- - uses : actions/checkout@v2
59+ - name : Checkout
60+ uses : actions/checkout@v2
61+
62+ - name : Install python ${{ matrix.nox_session.python }} for tests
63+ uses : MatteoH2O1999/setup-python@v1 # actions/setup-python@v4
64+ id : set-py
65+ with :
66+ python-version : ${{ matrix.nox_session.python }}
67+ architecture : x64
68+ allow-build : info
69+ cache-build : true
5070
51- # Conda install
52- - name : Install conda v3.7
53- uses : conda-incubator/setup-miniconda@v2
71+ - name : Install python 3.9 for nox
72+ uses : actions/setup-python@v4
5473 with :
55- # auto-update-conda: true
56- python-version : 3.7
57- activate-environment : noxenv
58- - run : conda info
59- shell : bash -l {0} # so that conda works
60- - run : conda list
61- shell : bash -l {0} # so that conda works
62-
63- # Nox install + run
74+ python-version : 3.9
75+ architecture : x64
76+
6477 - name : Install noxfile requirements
65- shell : bash -l {0} # so that conda works
6678 run : pip install -r noxfile-requirements.txt
67- - run : conda list
68- shell : bash -l {0} # so that conda works
69- - run : nox -s "${{ matrix.nox_session }}"
70- shell : bash -l {0} # so that conda works
79+
80+ - name : Run nox session ${{ matrix.nox_session.session }}
81+ run : nox -s "${{ matrix.nox_session.session }}" -v
7182
7283 # Share ./docs/reports so that they can be deployed with doc in next job
7384 - name : Share reports with other jobs
7788 name : reports_dir
7889 path : ./docs/reports
7990
91+ build_doc :
92+ runs-on : ubuntu-latest
93+ if : github.event_name == 'pull_request'
94+ steps :
95+ - name : Checkout
96+ uses : actions/checkout@v2
97+
98+ - name : Install python 3.9 for nox
99+ uses : actions/setup-python@v4
100+ with :
101+ python-version : 3.9
102+ architecture : x64
103+
104+ - name : Install noxfile requirements
105+ run : pip install -r noxfile-requirements.txt
106+
107+ - name : Build the doc including example gallery
108+ run : nox -s docs -- build
109+
80110 publish_release :
81111 needs : run_all_tests
82112 runs-on : ubuntu-latest
@@ -87,47 +117,37 @@ jobs:
87117 GITHUB_CONTEXT : ${{ toJSON(github) }}
88118 run : echo "$GITHUB_CONTEXT"
89119
90- - uses : actions/checkout@v2
120+ - name : Checkout with no depth
121+ uses : actions/checkout@v2
91122 with :
92123 fetch-depth : 0 # so that gh-deploy works
93124
125+ - name : Install python 3.9 for nox
126+ uses : actions/setup-python@v4
127+ with :
128+ python-version : 3.9
129+ architecture : x64
130+
94131 # 1) retrieve the reports generated previously
95132 - name : Retrieve reports
96133 uses : actions/download-artifact@master
97134 with :
98135 name : reports_dir
99136 path : ./docs/reports
100137
101- # Conda install
102- - name : Install conda v3.7
103- uses : conda-incubator/setup-miniconda@v2
104- with :
105- # auto-update-conda: true
106- python-version : 3.7
107- activate-environment : noxenv
108- - run : conda info
109- shell : bash -l {0} # so that conda works
110- - run : conda list
111- shell : bash -l {0} # so that conda works
112-
113138 # Nox install
114139 - name : Install noxfile requirements
115- shell : bash -l {0} # so that conda works
116140 run : pip install -r noxfile-requirements.txt
117- - run : conda list
118- shell : bash -l {0} # so that conda works
119141
120142 # 5) Run the flake8 report and badge
121143 - name : Run flake8 analysis and generate corresponding badge
122- shell : bash -l {0} # so that conda works
123144 run : nox -s flake8
124145
125146 # -------------- only on Ubuntu + MAIN PUSH (no pull request, no tag) -----------
126147
127148 # 5) Publish the doc and test reports
128149 - name : \[not on TAG\] Publish documentation, tests and coverage reports
129150 if : github.event_name == 'push' && startsWith(github.ref, 'refs/heads') # startsWith(matrix.os,'ubuntu')
130- shell : bash -l {0} # so that conda works
131151 run : nox -s publish
132152
133153 # 6) Publish coverage report
@@ -151,7 +171,6 @@ jobs:
151171 # 7) Create github release and build the wheel
152172 - name : \[TAG only\] Build wheel and create github release
153173 if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
154- shell : bash -l {0} # so that conda works
155174 run : nox -s release -- ${{ secrets.GITHUB_TOKEN }}
156175
157176 # 8) Publish the wheel on PyPi
0 commit comments