From b3dda36fddd3ca75689bb3645cd320aa8392aaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Mon, 25 Jul 2022 11:28:10 +0300 Subject: [PATCH] Improve workflow with a collecting status check. (#548) * Improve workflow with a collecting status check. * Style fix. --- .github/workflows/examples.yml | 49 -------------------- .github/workflows/test.yml | 55 +++++++++++++++++++++- ci/templates/.github/workflows/test.yml | 61 ++++++++++++++++++++++++- setup.py | 2 + 4 files changed, 116 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/examples.yml diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index dbd62a6c..00000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Examples - -on: [push, pull_request, workflow_dispatch] - -env: - FORCE_COLOR: 1 - -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 }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3ad0bb49..a85a1e03 100644 --- a/.github/workflows/test.yml +++ b/.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 }} @@ -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) }} diff --git a/ci/templates/.github/workflows/test.yml b/ci/templates/.github/workflows/test.yml index fda6886a..3e99ef08 100644 --- a/ci/templates/.github/workflows/test.yml +++ b/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 }}' }} @@ -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 %} diff --git a/setup.py b/setup.py index 421ec6b7..8d20c134 100755 --- a/setup.py +++ b/setup.py @@ -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