Skip to content

Commit

Permalink
Fix "Github Actions" configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
lycantropos committed Apr 26, 2024
1 parent b471ce8 commit 3f0bd8d
Showing 1 changed file with 55 additions and 104 deletions.
159 changes: 55 additions & 104 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,27 @@ on:
- 'master'

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Setup Python'
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: 'Install pre-commit'
run: python -m pip install -U pre-commit
- name: 'Run pre-commit'
run: pre-commit run --all-files

test:
name: 'Test'
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python_version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
platform: [
{
os: 'macos-latest',
Expand All @@ -35,12 +50,6 @@ jobs:
},
]
include:
- python_version: 'pypy-3.7'
platform: { os: 'macos-latest', python_architecture: 'x64' }
- python_version: 'pypy-3.7'
platform: { os: 'ubuntu-latest', python_architecture: 'x64' }
- python_version: 'pypy-3.7'
platform: { os: 'windows-latest', python_architecture: 'x64' }
- python_version: 'pypy-3.8'
platform: { os: 'macos-latest', python_architecture: 'x64' }
- python_version: 'pypy-3.8'
Expand All @@ -59,29 +68,21 @@ jobs:
with:
submodules: true
- name: 'Setup Python'
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
architecture: ${{ matrix.platform.python_architecture }}
- name: 'Install packaging tools'
run: python -m pip install -U pip setuptools
- name: 'Install coverage dependencies'
run: python -m pip install -U coverage
- name: 'Install С++ coverage dependencies'
run: python -m pip install -U pip setuptools wheel
- name: 'Install Python coverage dependencies'
run: python -m pip install -U coverage[toml]
- name: 'Install С coverage dependencies'
run: python -m pip install -U gcovr
if: ${{ !startsWith(matrix.python_version, 'pypy') }}
if: ${{ !startsWith(matrix.python_version, 'pypy') && matrix.python_version != '3.12' }}
- name: 'Install in editable mode'
run: python -m pip -v install -e .
run: python -m pip -v install -e .[tests]
env:
CPPFLAGS: --coverage -O0
- name: 'Install Mypy'
run: python -m pip install -U mypy
if: ${{ !startsWith(matrix.python_version, 'pypy') }}
- name: 'Run Mypy'
run: python -m mypy --strict ${{ github.event.repository.name }}
if: ${{ !startsWith(matrix.python_version, 'pypy') }}
- name: 'Install tests dependencies'
run: python -m pip install -r requirements-tests.txt
- name: 'Run doctests'
run: >
coverage run -m doctest README.md
Expand All @@ -91,21 +92,21 @@ jobs:
- name: 'Collect coverage'
run: coverage xml
- name: 'Collect C coverage'
run: gcovr --filter src/ --filter include/ --xml -o coverage_c.xml
if: ${{ !startsWith(matrix.python_version, 'pypy') }}
run: gcovr --filter src/ --xml -o coverage_c.xml
if: ${{ !startsWith(matrix.python_version, 'pypy') && matrix.python_version != '3.12' }}
- name: 'Upload PyPy coverage'
uses: codecov/codecov-action@v2.1.0
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
files: ./coverage.xml
if: ${{ startsWith(matrix.python_version, 'pypy') }}
continue-on-error: true
- name: 'Upload СPython coverage'
uses: codecov/codecov-action@v2.1.0
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
files: ./coverage.xml,./coverage_c.xml
if: ${{ !startsWith(matrix.python_version, 'pypy') }}
if: ${{ !startsWith(matrix.python_version, 'pypy') && matrix.python_version != '3.12' }}
continue-on-error: true

pre-deploy:
Expand All @@ -127,13 +128,13 @@ jobs:
with:
submodules: true
- name: 'Setup Python'
uses: actions/setup-python@v3
uses: actions/setup-python@v5
- name: 'Install packaging tools'
run: python -m pip install -U build pip setuptools
- name: 'Build sdist'
run: python -m build --sdist
- name: 'Upload sdist'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
Expand All @@ -144,8 +145,20 @@ jobs:
needs: pre-deploy
strategy:
matrix:
python_tag: ['cp37', 'cp38', 'cp39', 'cp310', 'cp311']
python_tag: [ 'cp38', 'cp39', 'cp310', 'cp311', 'cp312' ]
platform: [
{
architecture: 'arm64',
os: 'macos-latest',
python_architecture: 'x64',
tag: 'macosx_arm64'
},
{
architecture: 'universal2',
os: 'macos-latest',
python_architecture: 'x64',
tag: 'macosx_universal2'
},
{
architecture: 'x86_64',
os: 'macos-latest',
Expand Down Expand Up @@ -207,96 +220,40 @@ jobs:
tag: 'win32'
},
]
include:
- python_tag: 'cp38'
platform: {
architecture: 'arm64',
os: 'macos-latest',
python_architecture: 'x64',
tag: 'macosx_arm64'
}
- python_tag: 'cp38'
platform: {
architecture: 'universal2',
os: 'macos-latest',
python_architecture: 'x64',
tag: 'macosx_universal2'
}
- python_tag: 'cp39'
platform: {
architecture: 'arm64',
os: 'macos-latest',
python_architecture: 'x64',
tag: 'macosx_arm64'
}
- python_tag: 'cp39'
platform: {
architecture: 'universal2',
os: 'macos-latest',
python_architecture: 'x64',
tag: 'macosx_universal2'
}
- python_tag: 'cp310'
platform: {
architecture: 'arm64',
os: 'macos-latest',
python_architecture: 'x64',
tag: 'macosx_arm64'
}
- python_tag: 'cp310'
platform: {
architecture: 'universal2',
os: 'macos-latest',
python_architecture: 'x64',
tag: 'macosx_universal2'
}
- python_tag: 'cp311'
platform: {
architecture: 'arm64',
os: 'macos-latest',
python_architecture: 'x64',
tag: 'macosx_arm64'
}
- python_tag: 'cp311'
platform: {
architecture: 'universal2',
os: 'macos-latest',
python_architecture: 'x64',
tag: 'macosx_universal2'
}
steps:
- name: 'Checkout'
uses: actions/checkout@v3
with:
submodules: true
- name: 'Setup Python'
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
architecture: ${{ matrix.platform.python_architecture }}
- name: 'Setup QEMU'
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
platforms: all
if: ${{ runner.os == 'Linux' }}
- name: 'Build wheels'
uses: pypa/cibuildwheel@v2.11.4
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_ARCHS: ${{ matrix.platform.architecture }}
CIBW_BUILD: ${{ matrix.python_tag }}-${{ matrix.platform.tag }}
CIBW_BUILD_VERBOSITY: 1
- name: 'Upload wheels'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: dist
path: wheelhouse/*.whl
overwrite: true

test-distributions:
name: Test distributions
runs-on: ${{ matrix.platform.os }}
needs: ['build-sdist', 'build-wheels']
needs: [ 'build-sdist', 'build-wheels' ]
strategy:
matrix:
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python_version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
platform: [
{
os: 'macos-latest',
Expand All @@ -316,12 +273,6 @@ jobs:
},
]
include:
- python_version: 'pypy-3.7'
platform: { os: 'macos-latest', python_architecture: 'x64' }
- python_version: 'pypy-3.7'
platform: { os: 'ubuntu-latest', python_architecture: 'x64' }
- python_version: 'pypy-3.7'
platform: { os: 'windows-latest', python_architecture: 'x64' }
- python_version: 'pypy-3.8'
platform: { os: 'macos-latest', python_architecture: 'x64' }
- python_version: 'pypy-3.8'
Expand All @@ -336,17 +287,17 @@ jobs:
platform: { os: 'windows-latest', python_architecture: 'x64' }
steps:
- name: 'Setup Python'
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
architecture: ${{ matrix.platform.python_architecture }}
- name: 'Download distributions'
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: 'Install from distributions'
run: python -m pip install --find-links=dist --no-deps --no-index ${{ github.event.repository.name }}
run: python -m pip install --find-links=dist --no-deps ${{ github.event.repository.name }}

deploy:
name: 'Deploy'
Expand All @@ -355,12 +306,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Download distributions'
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: 'PyPI upload'
uses: pypa/gh-action-pypi-publish@v1.5.0
uses: pypa/gh-action-pypi-publish@v1.8.6
with:
packages_dir: dist
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 3f0bd8d

Please sign in to comment.