Skip to content

Commit b3dda36

Browse files
authored
Improve workflow with a collecting status check. (#548)
* Improve workflow with a collecting status check. * Style fix.
1 parent 218419f commit b3dda36

File tree

4 files changed

+116
-51
lines changed

4 files changed

+116
-51
lines changed

.github/workflows/examples.yml

-49
This file was deleted.

.github/workflows/test.yml

+54-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,47 @@
11
name: Tests
2-
on: [push, pull_request]
2+
on: [push, pull_request, workflow_dispatch]
33
jobs:
4+
examples:
5+
runs-on: ubuntu-latest
6+
strategy:
7+
fail-fast: false
8+
matrix:
9+
python-version: ["pypy-3.7", "3.9"]
10+
target: [
11+
"src-layout",
12+
"adhoc-layout",
13+
]
14+
include:
15+
# Add new helper variables to existing jobs
16+
- {python-version: "pypy-3.7", tox-python-version: "pypy3"}
17+
- {python-version: "3.9", tox-python-version: "py39"}
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Cache
27+
uses: actions/cache@v2
28+
with:
29+
path: ~/.cache/pip
30+
key:
31+
examples-v1-${{ hashFiles('**/tox.ini') }}
32+
restore-keys: |
33+
examples-v1-
34+
35+
- name: Install dependencies
36+
run: |
37+
python -m pip install -U pip
38+
python -m pip install -U wheel
39+
python -m pip install --progress-bar=off tox -rci/requirements.txt
40+
41+
- name: Examples
42+
run: |
43+
cd examples/${{ matrix.target }}
44+
tox -v -e ${{ matrix.tox-python-version }}
445
test:
546
name: ${{ matrix.name }}
647
runs-on: ${{ matrix.os }}
@@ -165,3 +206,15 @@ jobs:
165206
TOXPYTHON: '${{ matrix.toxpython }}'
166207
run: >
167208
tox -e ${{ matrix.tox_env }} -v
209+
210+
check:
211+
if: always()
212+
needs:
213+
- test
214+
- examples
215+
runs-on: ubuntu-latest
216+
steps:
217+
- name: Decide whether the needed jobs succeeded or failed
218+
uses: re-actors/alls-green@release/v1
219+
with:
220+
jobs: ${{ toJSON(needs) }}

ci/templates/.github/workflows/test.yml

+60-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,50 @@
11
name: Tests
2-
on: [push, pull_request]
2+
on: [push, pull_request, workflow_dispatch]
33
jobs:
4+
{%- raw %}
5+
examples:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
python-version: ["pypy-3.7", "3.9"]
11+
target: [
12+
"src-layout",
13+
"adhoc-layout",
14+
]
15+
include:
16+
# Add new helper variables to existing jobs
17+
- {python-version: "pypy-3.7", tox-python-version: "pypy3"}
18+
- {python-version: "3.9", tox-python-version: "py39"}
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Cache
28+
uses: actions/cache@v2
29+
with:
30+
path: ~/.cache/pip
31+
key:
32+
examples-v1-${{ hashFiles('**/tox.ini') }}
33+
restore-keys: |
34+
examples-v1-
35+
36+
- name: Install dependencies
37+
run: |
38+
python -m pip install -U pip
39+
python -m pip install -U wheel
40+
python -m pip install --progress-bar=off tox -rci/requirements.txt
41+
42+
- name: Examples
43+
run: |
44+
cd examples/${{ matrix.target }}
45+
tox -v -e ${{ matrix.tox-python-version }}
46+
{%- endraw %}
47+
448
test:
549
name: {{ '${{ matrix.name }}' }}
650
runs-on: {{ '${{ matrix.os }}' }}
@@ -63,3 +107,18 @@ jobs:
63107
TOXPYTHON: '{{ '${{ matrix.toxpython }}' }}'
64108
run: >
65109
tox -e {{ '${{ matrix.tox_env }}' }} -v
110+
{% raw %}
111+
successful:
112+
# this provides a single status check for branch merge rules
113+
# (use this in `Require status checks to pass before merging` in branch settings)
114+
if: always()
115+
needs:
116+
- test
117+
- examples
118+
runs-on: ubuntu-latest
119+
steps:
120+
- name: Decide whether the needed jobs succeeded or failed
121+
uses: re-actors/alls-green@release/v1
122+
with:
123+
jobs: ${{ toJSON(needs) }}
124+
{% endraw %}

setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
from setuptools import Command
1212
from setuptools import find_packages
1313
from setuptools import setup
14+
1415
try:
1516
# https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html
1617
from setuptools.command.build import build
1718
except ImportError:
1819
from distutils.command.build import build
20+
1921
from setuptools.command.develop import develop
2022
from setuptools.command.easy_install import easy_install
2123
from setuptools.command.install_lib import install_lib

0 commit comments

Comments
 (0)