Skip to content

Commit

Permalink
Simplify Github Actions Workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
nycholas committed Sep 27, 2024
1 parent 889e4ca commit ab5e1a8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 86 deletions.
65 changes: 12 additions & 53 deletions .github/workflows/on_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,61 +11,17 @@ permissions:
contents: read

jobs:
lint:
name: Lint and Format
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -r requirements/base.txt -r requirements/style.txt
- name: Run ruff
run: |
ruff check .
test:
name: Test
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -r requirements/base.txt -r requirements/tests.txt
- name: Run py.test
run: |
py.test
run-tox:
name: Tox | Test, Style, Lint, Typing, Pytype, Security and Docs
name: Tox
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.11", "3.12"]
- macos-latest
- windows-latest
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
Expand All @@ -76,11 +32,14 @@ jobs:
- name: Install dependencies
run: |
python -m pip install tox
- name: Run tox
- name: Run tox (Pytype) | Python 3.11
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.11' }}
run: |
tox -e typing-pytype -p all
- name: Run tox (Style, Type checker, Security, Docs) | Python 3.12
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12' }}
run: |
tox -e py,py-async,style,typing-mypy,typing-pyright,security-safety,security-bandit,docs -p all
- name: Run tox (Pytype)
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.11' }}
tox -e style,typing-mypy,typing-pyright,security-safety,security-bandit,docs -p all
- name: Run tox (Tests) | ${{ matrix.platform }}
run: |
tox -e typing-pytype
tox -e py,py-async
64 changes: 31 additions & 33 deletions .github/workflows/pre_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,6 @@ permissions:
contents: read

jobs:
run-tox:
name: Tox | Test, Style, Lint, Typing, Pytype, Security and Docs
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.11", "3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install tox
- name: Run tox
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12' }}
run: |
tox -e py,py-async,style,typing-mypy,typing-pyright,security-safety,security-bandit,docs -p all
- name: Run tox (Pytype)
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.11' }}
run: |
tox -e typing-pytype
test:
name: Test
runs-on: ${{ matrix.platform }}
Expand Down Expand Up @@ -102,7 +74,7 @@ jobs:

build:
name: Build source on ${{ matrix.platform }}
needs: [run-tox, coverage]
needs: [coverage]
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
Expand All @@ -121,6 +93,34 @@ jobs:
run: |
python -m pip install -r requirements/build.txt
python -m build --outdir dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Tar build and wheel distributions files
run: |
tar -cvf dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Upload build and wheel distributions files
uses: actions/upload-artifact@v4
with:
name: pre-release-build-${{ matrix.platform }}-${{ matrix.python-version }}
path: |
dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar
build-mypyc:
name: Build using Mypyc source on ${{ matrix.platform }}
continue-on-error: true
needs: [coverage]
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
python-version: ["3.12"]
steps:
- name: Checkout source at ${{ matrix.platform }}
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Compiles Python modules to C extensions with Mypyc
env:
MYPYC_ENABLE: 1
Expand All @@ -131,19 +131,17 @@ jobs:
python setup.py bdist_wheel --dist-dir mypyc-dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Tar build and wheel distributions files
run: |
tar -cvf dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar dist-${{ matrix.platform }}-${{ matrix.python-version }}
tar -cvf mypyc-dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar mypyc-dist-${{ matrix.platform }}-${{ matrix.python-version }}
- name: Upload build and wheel distributions files
uses: actions/upload-artifact@v4
with:
name: pre-release-build-${{ matrix.platform }}-${{ matrix.python-version }}
name: pre-release-cbuild-${{ matrix.platform }}-${{ matrix.python-version }}
path: |
dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar
mypyc-dist-${{ matrix.platform }}-${{ matrix.python-version }}.tar
build-wheels:
name: Build wheels on ${{ matrix.platform }}
needs: [run-tox, coverage]
needs: [coverage]
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
paths-ignore:
- 'docs/**'
- '*.md'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
issue_comment:
types: [created]

Expand Down

0 comments on commit ab5e1a8

Please sign in to comment.