Skip to content

Commit

Permalink
Improve workflow with a collecting status check. (#548)
Browse files Browse the repository at this point in the history
* Improve workflow with a collecting status check.

* Style fix.
  • Loading branch information
ionelmc committed Jul 25, 2022
1 parent 218419f commit b3dda36
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 51 deletions.
49 changes: 0 additions & 49 deletions .github/workflows/examples.yml

This file was deleted.

55 changes: 54 additions & 1 deletion .github/workflows/test.yml
@@ -1,6 +1,47 @@
name: Tests
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]
jobs:
examples:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["pypy-3.7", "3.9"]
target: [
"src-layout",
"adhoc-layout",
]
include:
# Add new helper variables to existing jobs
- {python-version: "pypy-3.7", tox-python-version: "pypy3"}
- {python-version: "3.9", tox-python-version: "py39"}
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key:
examples-v1-${{ hashFiles('**/tox.ini') }}
restore-keys: |
examples-v1-
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U wheel
python -m pip install --progress-bar=off tox -rci/requirements.txt
- name: Examples
run: |
cd examples/${{ matrix.target }}
tox -v -e ${{ matrix.tox-python-version }}
test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -165,3 +206,15 @@ jobs:
TOXPYTHON: '${{ matrix.toxpython }}'
run: >
tox -e ${{ matrix.tox_env }} -v
check:
if: always()
needs:
- test
- examples
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
61 changes: 60 additions & 1 deletion ci/templates/.github/workflows/test.yml
@@ -1,6 +1,50 @@
name: Tests
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]
jobs:
{%- raw %}
examples:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["pypy-3.7", "3.9"]
target: [
"src-layout",
"adhoc-layout",
]
include:
# Add new helper variables to existing jobs
- {python-version: "pypy-3.7", tox-python-version: "pypy3"}
- {python-version: "3.9", tox-python-version: "py39"}
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key:
examples-v1-${{ hashFiles('**/tox.ini') }}
restore-keys: |
examples-v1-
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U wheel
python -m pip install --progress-bar=off tox -rci/requirements.txt
- name: Examples
run: |
cd examples/${{ matrix.target }}
tox -v -e ${{ matrix.tox-python-version }}
{%- endraw %}

test:
name: {{ '${{ matrix.name }}' }}
runs-on: {{ '${{ matrix.os }}' }}
Expand Down Expand Up @@ -63,3 +107,18 @@ jobs:
TOXPYTHON: '{{ '${{ matrix.toxpython }}' }}'
run: >
tox -e {{ '${{ matrix.tox_env }}' }} -v
{% raw %}
successful:
# this provides a single status check for branch merge rules
# (use this in `Require status checks to pass before merging` in branch settings)
if: always()
needs:
- test
- examples
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
{% endraw %}
2 changes: 2 additions & 0 deletions setup.py
Expand Up @@ -11,11 +11,13 @@
from setuptools import Command
from setuptools import find_packages
from setuptools import setup

try:
# https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html
from setuptools.command.build import build
except ImportError:
from distutils.command.build import build

from setuptools.command.develop import develop
from setuptools.command.easy_install import easy_install
from setuptools.command.install_lib import install_lib
Expand Down

0 comments on commit b3dda36

Please sign in to comment.