Skip to content

Commit

Permalink
Merge pull request #233 from graingert/configure-isolated-builds
Browse files Browse the repository at this point in the history
configure isolated builds and pypi upload
  • Loading branch information
graingert committed Sep 27, 2020
2 parents 7792227 + c6503a9 commit 61336c2
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 53 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
pull_request:

jobs:
modernize:
tox:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -34,7 +34,9 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.cfg') }}
key:
${{ runner.os }}-pip-${{ hashFiles('pyproject.toml', 'setup.py',
'setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-
Expand All @@ -45,4 +47,30 @@ jobs:
- name: tox
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: tox -e py,lint,coveralls
run: tox -e py,lint,coveralls,release

- name: upload dist
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}_${{ matrix.python-version}}_dist
path: dist

all-successful:
# https://github.community/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert
runs-on: ubuntu-latest
needs: [tox]
steps:
- name: Download dists for PyPI
uses: actions/download-artifact@v2
with:
name: ubuntu-latest_3.8_dist

- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}

- name: note that all tests succeeded
run: echo "🎉"
86 changes: 86 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[build-system]
requires = [ "setuptools >= 35.0.2", "wheel >= 0.29.0"]
build-backend = "setuptools.build_meta"

[tool.isort]
profile = "black"
add_imports="from __future__ import generator_stop"

[tool.pytest.ini_options]
addopts = [
"--strict-config",
"--strict-markers",
"--cov",
"--cov-fail-under=91.53",
"--cov-report=term-missing:skip-covered",
]
xfail_strict = true
junit_family = "xunit2"
filterwarnings = ["error"]

[tool.coverage.run]
branch = true
source_pkgs = [
"modernize",
"libmodernize",
]
source = ["tests"]

[tool.coverage.paths]
source = [
".",
".tox/*/lib/*/site-packages/",
'.tox\\*\\Lib\\site-packages\\',
]


[tool.tox]
legacy_tox_ini = """
; tox configuration file for running tests on local dev env and Travis CI.
;
; The local dev environment will be executed against latest released Twisted.
; The coverage is reported only and local dev and not on Travis-CI as there
; we have separate reported (ex codecov.io)
[tox]
envlist =
py{36,37,38},lint
minversion=3.20.0
requires=
virtualenv >= 20.0.31
tox-wheel >= 0.5.0
[testenv]
extras = test
commands = pytest {posargs}
wheel = True
wheel_pep517 = True
wheel_build_env = build
[testenv:build]
# empty environment to build universal wheel once per tox invocation
# https://github.com/ionelmc/tox-wheel#build-configuration
[testenv:coveralls]
passenv = GITHUB_*
deps =
coveralls
coverage>=5.3
commands = coveralls
[testenv:lint]
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure {posargs}
skip_install = true
[testenv:release]
deps = pep517
whitelist_externals =
cp
rm
commands =
rm -rf {toxinidir}/dist
cp -r {distdir} {toxinidir}/dist # copy the wheel built by tox-wheel
{envpython} -m pep517.build --source --out-dir={toxinidir}/dist {toxinidir}
"""
51 changes: 1 addition & 50 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,59 +42,10 @@ universal = 1

[zest.releaser]
python-file-with-version = libmodernize/__init__.py
tag-format = v{version}

[flake8]
disable-noqa = True
max-line-length = 88
extend-ignore =
E203, # whitespace before : is not PEP8 compliant (& conflicts with black)

[isort]
profile = black
add_imports=from __future__ import generator_stop

[tool:pytest]
addopts =
--strict-config
--strict-markers
--cov
--cov-fail-under=91.53
--cov-report=term-missing:skip-covered
xfail_strict = True
junit_family = xunit2
filterwarnings =
error

[coverage:run]
branch = True
source_pkgs =
modernize
libmodernize
source =
tests

[coverage:paths]
source =
.
.tox/*/lib/*/site-packages/
.tox\\*\\Lib\\site-packages\\

[tox:tox]
envlist =
py{36,37,38},lint

[testenv]
extras = test
commands = pytest {posargs}

[testenv:coveralls]
passenv = GITHUB_*
deps =
coveralls
coverage>=5.3
commands = coveralls

[testenv:lint]
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure {posargs}
skip_install = true

0 comments on commit 61336c2

Please sign in to comment.