Skip to content

Commit

Permalink
Simplify CI
Browse files Browse the repository at this point in the history
  • Loading branch information
janheinrichmerker committed Aug 9, 2023
1 parent 14feabb commit bdcfa9d
Showing 1 changed file with 131 additions and 162 deletions.
293 changes: 131 additions & 162 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,191 +4,160 @@ on:
push:

jobs:
build-wheel:
name: "πŸ—οΈ Python wheel"
python-build:
name: "πŸ—οΈ Build Python wheels"
strategy:
matrix:
os:
- ubuntu-latest
#- macos-latest
- windows-latest
python:
- 3.7
- 3.9
runs-on: ${{ matrix.os }}
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
runs-on: ubuntu-latest
steps:
- name: "πŸ“₯ Check-out"
uses: actions/checkout@v2
- name: "🧰 Install Python"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: setup.cfg
- name: "🧰 Install dependencies"
run: |
python -m pip install --upgrade pip build twine
pip install -e .
- name: "πŸ—οΈ Build Python wheel"
run: python -m build
- name: "πŸ§ͺ Check package bundles"
run: twine check dist/*
code-format:
name: "πŸ” Python code format"
needs:
- build-wheel
- name: "πŸ“₯ Check-out"
uses: actions/checkout@v3
- name: "🧰 Install Python"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: pyproject.toml
- name: "🧰 Install dependencies"
run: pip install build twine
- name: "πŸ—οΈ Build Python wheels"
run: python -m build
- name: "πŸ§ͺ Check package bundles"
run: twine check dist/*
- name: "πŸ“€ Upload Python wheels"
uses: actions/upload-artifact@v3
if: matrix.python == '3.11'
with:
name: wheels
path: dist
python-code-format:
name: "πŸ” Check Python code format"
strategy:
matrix:
os:
- ubuntu-latest
#- macos-latest
#- windows-latest
python:
- 3.7
- 3.9
runs-on: ${{ matrix.os }}
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
runs-on: ubuntu-latest
steps:
- name: "πŸ“₯ Check-out"
uses: actions/checkout@v2
- name: "🧰 Install Python"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: setup.cfg
- name: "🧰 Install dependencies"
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e .[test]
- name: "πŸ” Check Python code format"
run: flake8 targer_api examples tests
lint:
name: "πŸ” Python Lint"
needs:
- build-wheel
- name: "πŸ“₯ Check-out"
uses: actions/checkout@v3
- name: "🧰 Install Python"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: pyproject.toml
- name: "🧰 Install dependencies"
run: pip install .[test]
- name: "πŸ” Check Python code format"
run: flake8 targer_api tests examples
python-lint:
name: "πŸ” Lint Python code"
strategy:
matrix:
os:
- ubuntu-latest
#- macos-latest
#- windows-latest
python:
- 3.7
- 3.9
runs-on: ${{ matrix.os }}
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
runs-on: ubuntu-latest
steps:
- name: "πŸ“₯ Check-out"
uses: actions/checkout@v2
- name: "🧰 Install Python"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: setup.cfg
- name: "🧰 Install dependencies"
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e .[test]
- name: "πŸ” Lint Python code"
run: pylint -E targer_api examples tests
unit-tests:
name: "πŸ§ͺ Python unit tests"
needs:
- build-wheel
- name: "πŸ“₯ Check-out"
uses: actions/checkout@v3
- name: "🧰 Install Python"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: pyproject.toml
- name: "🧰 Install dependencies"
run: pip install .[test]
- name: "πŸ” Lint Python code"
run: pylint -E targer_api tests examples
python-test:
name: "πŸ§ͺ Test Python code"
strategy:
matrix:
os:
- ubuntu-latest
#- macos-latest
#- windows-latest
python:
- 3.7
- 3.9
runs-on: ${{ matrix.os }}
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
runs-on: ubuntu-latest
steps:
- name: "πŸ“₯ Check-out"
uses: actions/checkout@v2
- name: "🧰 Install Python"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: setup.cfg
- name: "🧰 Install dependencies"
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e .[test]
- name: "πŸ§ͺ Test Python code"
run: pytest targer_api examples tests --cov --cov-report=term --cov-report=xml
- name: "πŸ“€ Upload test coverage"
uses: actions/upload-artifact@v2
with:
path: coverage.xml
name: Python test coverage
- name: "πŸ“€ Publish test coverage"
uses: codecov/codecov-action@v1
publish:
name: "πŸš€ Publish Python package"
- name: "πŸ“₯ Check-out"
uses: actions/checkout@v3
- name: "🧰 Install Python"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: pyproject.toml
- name: "🧰 Install dependencies"
run: pip install .[test]
- name: "πŸ§ͺ Test Python code"
run: pytest --cov --cov-report=xml targer_api tests examples
- name: "πŸ“€ Upload coverage to Codecov"
uses: codecov/codecov-action@v3
if: matrix.python == '3.11'
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
python-publish:
name: "πŸš€ Publish Python wheels"
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- code-format
- lint
- unit-tests
- python-build
- python-code-format
- python-lint
- python-test
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: "πŸ“₯ Check-out"
uses: actions/checkout@v2
- name: "🧰 Install Python"
uses: actions/setup-python@v2
with:
python-version: 3.9
cache: pip
cache-dependency-path: setup.cfg
- name: "🧰 Install dependencies"
run: |
python -m pip install --upgrade pip build
pip install -e .
- name: "πŸ—οΈ Build Python wheel"
run: python -m build
- name: "πŸš€ Publish Python package"
uses: pypa/gh-action-pypi-publish@release/v1
release:
- name: "πŸ“₯ Check-out"
uses: actions/checkout@v3
- name: "πŸ“₯ Download Python wheels"
uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: "πŸš€ Publish Python wheels"
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: "πŸš€ Create GitHub release"
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- code-format
- lint
- unit-tests
runs-on: ubuntu-20.04
- python-build
- python-code-format
- python-lint
- python-test
runs-on: ubuntu-latest
steps:
- name: "πŸ“₯ Check-out"
uses: actions/checkout@v2
- name: "🏷️ Get version tag"
id: get-version
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
- name: "🧰 Install Python"
uses: actions/setup-python@v2
with:
python-version: 3.9
cache: pip
cache-dependency-path: setup.cfg
- name: "🧰 Install dependencies"
run: |
python -m pip install --upgrade pip build
pip install -e .
- name: "πŸ—οΈ Build Python wheel"
run: python -m build
- name: "πŸš€ Create GitHub release"
uses: softprops/action-gh-release@v1
with:
name: Release ${{ steps.get-version.outputs.tag }}
files: dist/*
fail_on_unmatched_files: true
draft: false
prerelease: false
generate_release_notes: true
- name: "πŸ“₯ Check-out"
uses: actions/checkout@v3
- name: "πŸ“₯ Download Python wheels"
uses: actions/download-artifact@v3
with:
name: wheels
path: dist
- name: "πŸš€ Create GitHub release"
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.ref_name }}
files: dist/*
fail_on_unmatched_files: true
draft: false
prerelease: false
generate_release_notes: true

0 comments on commit bdcfa9d

Please sign in to comment.