Skip to content

Commit

Permalink
chore: fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKevJames committed Apr 26, 2024
1 parent f8ef582 commit 1fb6ed7
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 128 deletions.
141 changes: 57 additions & 84 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,113 +1,86 @@
version: 2.1

orbs:
linter: talkiq/linter@3.1.0
linter: talkiq/linter@4

executors:
python-minimum:
py36:
docker:
# N.B. lowest common denominator, don't want to error on not using the
# latest syntax.
- image: python:3.10.7
- image: python:3.6-alpine
resource_class: small
py37:
docker:
- image: python:3.7-alpine
resource_class: small
py38:
docker:
- image: python:3.8-alpine
resource_class: small
py39:
docker:
- image: python:3.9-alpine
resource_class: small
py310:
docker:
- image: python:3.10-alpine
resource_class: small
pypy731: # py36
docker:
- image: pypy:3-7.3.1-slim
resource_class: small
pypy735: # py37
docker:
- image: pypy:3-7.3.5-slim
resource_class: small
pypy737: # py37+py38
docker:
- image: pypy:3-7.3.7-slim
resource_class: small
pypy7311: # py38+py39
docker:
- image: pypy:3-7.3.11-slim
resource_class: small
pypy73: # py39+py310
docker:
- image: pypy:3-7.3-slim
resource_class: small

jobs:
toxpy:
docker:
- image: python:<<parameters.docker_image>>-alpine
executor: <<parameters.executor>>
parameters:
cov_version:
default: ""
type: string
docker_image:
type: string
# TODO: figure out `<<parameters.docker_image>>.replace('.','')`
tox_environment:
type: string
executor:
type: executor
steps:
- run: apk add --no-cache gcc git libffi-dev musl-dev openssh-client openssl-dev
- checkout
- run: pip install tox tox-factor
- unless:
condition: <<parameters.cov_version>>
steps:
- run: tox -f <<parameters.tox_environment>>
- run: tox -e coveralls41
- when:
condition: <<parameters.cov_version>>
steps:
- run: tox -f <<parameters.tox_environment>>-cov<<parameters.cov_version>>
- run: tox -e coveralls<<parameters.cov_version>>
- run: python3 -m pip install --upgrade tox
- run: tox run -f <<parameters.executor>>
- run: tox run -e upload

toxpypy:
docker:
- image: pypy:<<parameters.docker_image>>
executor: <<parameters.executor>>
parameters:
cov_version:
type: string
docker_image:
type: string
executor:
type: executor
steps:
- checkout
- run: pip install tox tox-factor
- run: tox -f pypy3-cov<<parameters.cov_version>>
- run: tox -e coveralls<<parameters.cov_version>>
- run: python3 -m pip install --upgrade tox
- run: tox run -f pypy3
- run: tox run -e upload

workflows:
lint:
test:
jobs:
- linter/pre-commit:
executor: python-minimum

test-cpython:
jobs:
- toxpy:
name: test-py3.6-cov<<matrix.cov_version>>
docker_image: '3.6'
tox_environment: py36
matrix:
parameters:
cov_version: ['41', '5', '6']
executor: py36
- toxpy:
name: test-py3.7-cov<<matrix.cov_version>>
docker_image: '3.7'
tox_environment: py37
matrix:
parameters:
cov_version: ['41', '5', '6']
- toxpy:
name: test-py3.8-cov<<matrix.cov_version>>
docker_image: '3.8'
tox_environment: py38
matrix:
parameters:
cov_version: ['41', '5', '6']
- toxpy:
name: test-py3.9-cov<<matrix.cov_version>>
docker_image: '3.9'
tox_environment: py39
matrix:
parameters:
cov_version: ['41', '5', '6']
- toxpy:
name: test-py3.10-cov<<matrix.cov_version>>
docker_image: '3.10'
tox_environment: py310
matrix:
parameters:
cov_version: ['41', '5', '6']

test-pypy:
jobs:
- toxpypy:
name: test-pypy<<matrix.docker_image>>-cov<<matrix.cov_version>>
name: test-<<matrix.executor>>
matrix:
parameters:
cov_version: ['41', '5']
docker_image: ['3-5', '3-6']
executor: [py36, py37, py38, py39, py310]
- toxpypy:
name: test-pypy3-7-cov<<matrix.cov_version>>
docker_image: '3-7'
name: test-<<matrix.executor>>
matrix:
parameters:
cov_version: ['41', '5', '6']
executor: [pypy731, pypy735, pypy737, pypy7311, pypy73]
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build

on:
push:
branches:
tags:

jobs:
buildsdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build sdist
run: python setup.py sdist
- uses: actions/upload-artifact@v4
with:
path: ./dist/*.tar.gz

buildwheel:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- name: Build wheels
run: python -m wheel .
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./dist/*.whl

publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
if: github.event_name == 'push' && github.ref_type == 'tag'
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- run: ls -la ./dist
# TODO: enable me
# - name: Publish package distributions to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
26 changes: 0 additions & 26 deletions .github/workflows/pythonpackage.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# TODO: 3.6 not supported on latest
python-version: ['3.7', '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: python -m pip install --upgrade pip tox tox-gh-actions
- run: tox
- run: tox -e upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 6 additions & 18 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ envlist = py{36,37,38,39,310,py3}-cov{41,5,6}-{default,pyyaml}

[gh-actions]
python =
3.6: py36-cov6
3.7: py37-cov6
3.8: py38-cov6
3.9: py39-cov6
3.10: py310-cov6
3.6: py36-cov6,upload
3.7: py37-cov6,upload
3.8: py38-cov6,upload
3.9: py39-cov6,upload
3.10: py310-cov6,upload

[testenv]
passenv = *
Expand All @@ -24,19 +24,7 @@ commands =
coverage run --branch --source=coveralls -m pytest tests/
coverage report -m

[testenv:coveralls41]
deps =
coverage>=4.1,<5.0
commands =
coveralls --verbose

[testenv:coveralls5]
deps =
coverage>=5.0,<6.0
commands =
coveralls --verbose

[testenv:coveralls6]
[testenv:upload]
deps =
coverage>=6.0,<7.0
commands =
Expand Down

0 comments on commit 1fb6ed7

Please sign in to comment.