Skip to content

Commit

Permalink
Simplify workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
philpep committed May 19, 2023
1 parent ec313d3 commit b545297
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 89 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/ack.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/push.yml

This file was deleted.

39 changes: 20 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,25 @@ jobs:
env:
FORCE_COLOR: 1
PY_COLORS: 1
TOXENV: pkg

steps:
- name: Switch to using Python 3.9 by default
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install tox
run: python3 -m pip install --user "tox>=4.0.0"
- name: Check out src from Git
uses: actions/checkout@v3
with:
fetch-depth: 0 # needed by setuptools-scm
- name: Build dists
run: python -m tox
- name: Publish to pypi.org
if: >- # "create" workflows run separately from "push" & "pull_request"
github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
- uses: actions/checkout@v3
with:
fetch-depth: 0 # needed by setuptools-scm
- name: Switch to using Python 3.9 by default
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Build dists
run: |
tox -e packaging
- name: Publish to pypi.org
if: >- # "create" workflows run separately from "push" & "pull_request"
github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
85 changes: 39 additions & 46 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,61 +19,54 @@ concurrency:
cancel-in-progress: true

jobs:
pre:
name: pre
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.generate_matrix.outputs.matrix }}
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Determine matrix
id: generate_matrix
uses: coactions/matrix@main
with:
min_python: "3.8"
max_python: "3.10"
other_names: |
lint
docs
packaging
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tox -e lint
run: |
tox -e lint
build:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
needs: pre
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.pre.outputs.matrix) }}
matrix:
toxenv: [docs, packaging, py39]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

# Even our lint and other envs need access to tox
- name: Set up Python version
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}

- name: Install dependencies
run: |
docker version
docker info
python -m pip install -U pip
pip install tox
- name: Run tox -e ${{ matrix.passed_name }}
run: |
echo "${{ matrix.PREFIX }} tox -e ${{ matrix.passed_name }}"
${{ matrix.PREFIX }} tox -e ${{ matrix.passed_name }}
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tox -e ${{ matrix.toxenv }}
run: |
tox -e ${{ matrix.toxenv }}
check: # This job does nothing and is only used for the branch protection
if: always()
permissions:
pull-requests: write # allow codenotify to comment on pull-request
needs:
- build
runs-on: ubuntu-22.04

- lint
- build
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) }}
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ minversion = 4.0.16
envlist=
lint
py
doc
docs
packaging

[testenv]
Expand Down

0 comments on commit b545297

Please sign in to comment.