Skip to content

Commit

Permalink
Refreshed tox and CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Aug 16, 2020
1 parent e8ad492 commit 3ec4e35
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 42 deletions.
155 changes: 130 additions & 25 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,142 @@
name: Python package
name: tox

on: [push]
on:
push:
branches:
- master
- "[0-9]+.[0-9]+.x"
tags:
- "*"

jobs:

linters:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Install Tox and any other packages
run: pip install tox
- name: Run Tox
run: tox -e linters
pull_request:
branches:
- master
- "[0-9]+.[0-9]+.x"

jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: [3.6, 3.7, 3.8]
name: [
# "docs",
"py36",
"py37",
"py38",
"linters",
"packaging",
]
os: [
"ubuntu-latest",
]

include:

# - name: docs
# python: "3.6"
# os: ubuntu-latest
# tox_env: docs
- name: py36
python: "3.6"
os: ubuntu-latest
tox_env: py36
- name: py37
python: "3.7"
os: ubuntu-latest
tox_env: py37
- name: py38
python: "3.8"
os: ubuntu-latest
tox_env: py38

- name: "linters"
python: "3.7"
os: ubuntu-latest
tox_env: "linters"
- name: "packaging"
python: "3.7"
os: ubuntu-latest
tox_env: "packaging"

steps:
- uses: actions/checkout@v2
- name: Setup Python
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Install Tox and any other packages
run: pip install tox
- name: Run Tox
run: tox -e py # Run tox using the version of Python in `PATH`
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test
run: "tox -e ${{ matrix.tox_env }}"

publish:
name: Publish to PyPI registry
needs:
- build
runs-on: ubuntu-latest

env:
PY_COLORS: 1
TOXENV: packaging

steps:
- name: Switch to using Python 3.6 by default
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install tox
run: python -m pip install --user tox
- name: Check out src from Git
uses: actions/checkout@v2
with:
# Get shallow Git history (default) for tag creation events
# but have a complete clone for any other workflows.
# Both options fetch tags but since we're going to remove
# one from HEAD in non-create-tag workflows, we need full
# history for them.
fetch-depth: >-
${{
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
) &&
1 || 0
}}
- name: Drop Git tags from HEAD for non-tag-create events
if: >-
github.event_name != 'create' ||
github.event.ref_type != 'tag'
run: >-
git tag --points-at HEAD
|
xargs git tag --delete
- name: Build dists
run: python -m tox
- name: Publish to test.pypi.org
if: >-
(
github.event_name == 'push' &&
github.ref == format(
'refs/heads/{0}', github.event.repository.default_branch
)
) ||
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
)
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to pypi.org
if: >- # "create" workflows run separately from "push" & "pull_request"
github.event_name == 'create' &&
github.event.ref_type == 'tag'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ ignore_missing_imports = True

[mypy-github3]
ignore_missing_imports = True

[mypy-setuptools]
ignore_missing_imports = True
32 changes: 15 additions & 17 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = linters,py{36,37,38}
envlist = linters,py{36,37,38},packaging
minversion = 3.7
isolated_build = true
skip_missing_interpreters = true
Expand All @@ -21,41 +21,39 @@ passenv =
no_proxy
deps =
pip == 19.1.1
extra =
test
whitelist_externals = bash
commands =
python -m tender

[testenv:linters]
basepython = python3.7
passenv = {[testenv]passenv}
# without PROGRAMDATA cloning using git for Windows will fail with an
# `error setting certificate verify locations` error
PROGRAMDATA
extras = lint
deps =
pre-commit >= 1.14.4, < 2
twine
readme-renderer[md] >= 24.0
pip >= 18.0.0
pep517
deps = pre-commit >= 2.6.0
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
usedevelop = false
# don't install molecule itself in this env
skip_install = true
commands =
python -m pre_commit run --all-files --show-diff-on-failure

[testenv:packaging]
description = Builds the packages
skip_install = true
deps =
twine >= 3.2.0
readme-renderer[md] >= 24.0
pip >= 18.0.0
pep517
commands =
bash -c "rm -rf {toxinidir}/dist/ && mkdir -p {toxinidir}/dist/"
python -m pep517.build \
--source \
--binary \
--out-dir {toxinidir}/dist/ \
{toxinidir}
twine check dist/*

[testenv:upload]
description = Builds the packages and uploads them to https://pypi.org
envdir={toxworkdir}/linters
deps={[testenv:linters]deps}
commands =
{[testenv:linters]commands}
twine upload --disable-progress-bar --skip-existing --verbose dist/*
# twine upload --disable-progress-bar --skip-existing --verbose dist/*

0 comments on commit 3ec4e35

Please sign in to comment.