|
1 | | -name: main |
| 1 | +name: tox |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
15 | 15 |
|
16 | 16 | jobs: |
17 | 17 | build: |
| 18 | + name: ${{ matrix.name }} |
18 | 19 | runs-on: ${{ matrix.os }} |
19 | 20 |
|
20 | 21 | strategy: |
21 | 22 | fail-fast: false |
22 | 23 | matrix: |
23 | 24 | name: [ |
24 | | - "ubuntu-py27", |
25 | | - "ubuntu-py36", |
26 | | - "ubuntu-py37", |
27 | | - "ubuntu-py38", |
28 | 25 | "linting", |
29 | 26 | "packaging", |
| 27 | + "py36", |
| 28 | + "py37", |
| 29 | + "py38", |
| 30 | + "devel", |
30 | 31 | ] |
31 | 32 | os: [ |
32 | 33 | "ubuntu-latest", |
33 | 34 | ] |
34 | 35 |
|
35 | 36 | include: |
36 | 37 |
|
37 | | - - name: "ubuntu-py27" |
38 | | - python: "2.7" |
| 38 | + - name: "linting" |
| 39 | + python: "3.6" |
| 40 | + os: ubuntu-latest |
| 41 | + tox_env: "linting" |
| 42 | + - name: "packaging" |
| 43 | + python: "3.6" |
39 | 44 | os: ubuntu-latest |
40 | | - tox_env: "py27" |
41 | | - - name: "ubuntu-py36" |
| 45 | + tox_env: "packaging" |
| 46 | + - name: py36 |
42 | 47 | python: "3.6" |
43 | 48 | os: ubuntu-latest |
44 | | - tox_env: "py36" |
45 | | - - name: "ubuntu-py37" |
| 49 | + tox_env: py36 |
| 50 | + - name: py37 |
46 | 51 | python: "3.7" |
47 | 52 | os: ubuntu-latest |
48 | | - tox_env: "py37" |
49 | | - - name: "ubuntu-py38" |
| 53 | + tox_env: py37 |
| 54 | + - name: py38 |
50 | 55 | python: "3.8" |
51 | 56 | os: ubuntu-latest |
52 | | - tox_env: "py38" |
53 | | - |
54 | | - - name: "linting" |
55 | | - python: "3.7" |
56 | | - os: ubuntu-latest |
57 | | - tox_env: "linting" |
58 | | - - name: "packaging" |
59 | | - python: "3.7" |
| 57 | + tox_env: py38 |
| 58 | + - name: devel |
| 59 | + python: "3.8" |
60 | 60 | os: ubuntu-latest |
61 | | - tox_env: "packaging" |
| 61 | + tox_env: devel |
62 | 62 |
|
63 | 63 | steps: |
64 | 64 | - uses: actions/checkout@v1 |
|
72 | 72 | pip install tox |
73 | 73 | - name: Test |
74 | 74 | run: "tox -e ${{ matrix.tox_env }}" |
| 75 | + |
| 76 | + publish: |
| 77 | + name: Publish to PyPI registry |
| 78 | + needs: |
| 79 | + - build |
| 80 | + runs-on: ubuntu-latest |
| 81 | + |
| 82 | + env: |
| 83 | + PY_COLORS: 1 |
| 84 | + TOXENV: packaging |
| 85 | + |
| 86 | + steps: |
| 87 | + - name: Switch to using Python 3.6 by default |
| 88 | + uses: actions/setup-python@v2 |
| 89 | + with: |
| 90 | + python-version: 3.6 |
| 91 | + - name: Install tox |
| 92 | + run: python -m pip install --user tox |
| 93 | + - name: Check out src from Git |
| 94 | + uses: actions/checkout@v2 |
| 95 | + with: |
| 96 | + # Get shallow Git history (default) for tag creation events |
| 97 | + # but have a complete clone for any other workflows. |
| 98 | + # Both options fetch tags but since we're going to remove |
| 99 | + # one from HEAD in non-create-tag workflows, we need full |
| 100 | + # history for them. |
| 101 | + fetch-depth: >- |
| 102 | + ${{ |
| 103 | + ( |
| 104 | + github.event_name == 'create' && |
| 105 | + github.event.ref_type == 'tag' |
| 106 | + ) && |
| 107 | + 1 || 0 |
| 108 | + }} |
| 109 | + - name: Drop Git tags from HEAD for non-tag-create events |
| 110 | + if: >- |
| 111 | + github.event_name != 'create' || |
| 112 | + github.event.ref_type != 'tag' |
| 113 | + run: >- |
| 114 | + git tag --points-at HEAD |
| 115 | + | |
| 116 | + xargs git tag --delete |
| 117 | + - name: Build dists |
| 118 | + run: python -m tox |
| 119 | + - name: Publish to test.pypi.org |
| 120 | + if: >- |
| 121 | + ( |
| 122 | + github.event_name == 'push' && |
| 123 | + github.ref == format( |
| 124 | + 'refs/heads/{0}', github.event.repository.default_branch |
| 125 | + ) |
| 126 | + ) || |
| 127 | + ( |
| 128 | + github.event_name == 'create' && |
| 129 | + github.event.ref_type == 'tag' |
| 130 | + ) |
| 131 | + uses: pypa/gh-action-pypi-publish@master |
| 132 | + with: |
| 133 | + password: ${{ secrets.testpypi_password }} |
| 134 | + repository_url: https://test.pypi.org/legacy/ |
| 135 | + - name: Publish to pypi.org |
| 136 | + if: >- # "create" workflows run separately from "push" & "pull_request" |
| 137 | + github.event_name == 'create' && |
| 138 | + github.event.ref_type == 'tag' |
| 139 | + uses: pypa/gh-action-pypi-publish@master |
| 140 | + with: |
| 141 | + password: ${{ secrets.pypi_password }} |
0 commit comments