-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
148 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters