|
1 | | -name: Continuous Deployment |
| 1 | +name: Continuous Integration |
2 | 2 |
|
3 | | -on: |
4 | | - push: |
| 3 | +on: [push, pull_request] |
5 | 4 |
|
6 | 5 | defaults: |
7 | 6 | run: |
8 | 7 | shell: bash |
9 | | - |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ci-tests-${{ github.ref }}-1 |
| 11 | + cancel-in-progress: true |
| 12 | + |
10 | 13 | jobs: |
11 | | - testing: |
| 14 | + test: |
12 | 15 | strategy: |
13 | 16 | fail-fast: false |
14 | 17 | matrix: |
15 | | - python-version: [3.6, 3.7, 3.8, 3.9] |
16 | | - os: [macos-10.15, windows-2019, ubuntu-18.04] |
| 18 | + os: [ubuntu-20.04, macos-11, windows-2019] |
| 19 | + python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10", "pypy3.7", "pypy3.8", "pypy3.9", ] |
17 | 20 | runs-on: ${{ matrix.os }} |
18 | 21 | steps: |
19 | 22 | - name: Check out repository |
20 | | - uses: actions/checkout@v2 |
21 | | - - name: Set Up Python ${{ matrix.python-version }} |
22 | | - uses: actions/setup-python@v2 |
| 23 | + uses: actions/checkout@v3 |
| 24 | + - name: Set up python |
| 25 | + id: setup-python |
| 26 | + uses: actions/setup-python@v4 |
23 | 27 | with: |
24 | 28 | python-version: ${{ matrix.python-version }} |
25 | | - - run: python -VV |
26 | | - - name: Install poetry |
27 | | - uses: snok/install-poetry@v1.3.0 |
28 | | - - name: Install Dependencies |
29 | | - run: poetry install -vvv |
30 | | - - name: Do testing |
| 29 | + - name: Print Python Information |
| 30 | + run: python -VV |
| 31 | + - name: Install and configure Poetry |
| 32 | + run: | |
| 33 | + pip3 install poetry |
| 34 | + poetry config virtualenvs.in-project true |
| 35 | + - name: Set up cache |
| 36 | + uses: actions/cache@v3 |
| 37 | + id: cached-poetry-dependencies |
| 38 | + with: |
| 39 | + path: .venv |
| 40 | + key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} |
| 41 | + - name: Install dependencies |
| 42 | + run: poetry install |
| 43 | + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' |
| 44 | + - name: run tests |
31 | 45 | run: poetry run pytest -vv tests/* |
| 46 | + |
| 47 | + builder: |
| 48 | + needs: [test] |
| 49 | + if: github.ref == 'refs/heads/master' |
| 50 | + strategy: |
| 51 | + matrix: |
| 52 | + os: [macos-11, windows-2019] |
| 53 | + runs-on: ${{ matrix.os }} |
| 54 | + steps: |
| 55 | + - name: Check out repository |
| 56 | + uses: actions/checkout@v2 |
| 57 | + - name: Discover python architecture |
| 58 | + run: | |
| 59 | + if [ "$RUNNER_OS" == "Windows" ]; then |
| 60 | + echo "PYTHON_ARCHITECTURE=x86" >> $GITHUB_ENV |
| 61 | + else |
| 62 | + echo "PYTHON_ARCHITECTURE=x64" >> $GITHUB_ENV |
| 63 | + fi |
| 64 | + - name: Set up python |
| 65 | + uses: actions/setup-python@v4 |
| 66 | + with: |
| 67 | + python-version: "3.9.x" |
| 68 | + architecture: "${{ env.PYTHON_ARCHITECTURE }}" |
| 69 | + - name: Print Python Information |
| 70 | + run: python -VV |
| 71 | + - name: Update dependencies |
| 72 | + run: python -m pip install -U pip wheel setuptools twine |
| 73 | + - name: Build universal source Archive and wheel |
| 74 | + run: poetry build |
| 75 | + - name: Upload artifacts |
| 76 | + uses: actions/upload-artifact@v3 |
| 77 | + with: |
| 78 | + name: python-package-distributions |
| 79 | + path: dist/ |
| 80 | + |
| 81 | + publisher_release: |
| 82 | + needs: [builder] |
| 83 | + if: startsWith(github.event.ref, 'refs/tags/v') && github.ref == 'refs/heads/master' |
| 84 | + runs-on: ubuntu-latest |
| 85 | + steps: |
| 86 | + - name: Check out repository |
| 87 | + uses: actions/checkout@v3 |
| 88 | + - name: Download artifacts |
| 89 | + uses: actions/download-artifact@v3 |
| 90 | + with: |
| 91 | + name: python-package-distributions |
| 92 | + path: dist/ |
| 93 | + - name: Publish to PyPI |
| 94 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 95 | + with: |
| 96 | + verbose: true |
| 97 | + user: __token__ |
| 98 | + password: ${{ secrets.PYPI_API_TOKEN }} |
| 99 | + |
| 100 | + publisher_latest: |
| 101 | + needs: [builder] |
| 102 | + if: github.ref == 'refs/heads/master' |
| 103 | + runs-on: ubuntu-latest |
| 104 | + steps: |
| 105 | + - name: Check out repository |
| 106 | + uses: actions/checkout@v3 |
| 107 | + - name: Download artifacts |
| 108 | + uses: actions/download-artifact@v3 |
| 109 | + with: |
| 110 | + name: python-package-distributions |
| 111 | + path: dist/ |
| 112 | + - name: Make release |
| 113 | + uses: "marvinpinto/action-automatic-releases@v1.2.1" |
| 114 | + with: |
| 115 | + repo_token: "${{ secrets.GITHUB_TOKEN }}" |
| 116 | + prerelease: true |
| 117 | + title: "Latest Development Version" |
| 118 | + automatic_release_tag: "latest" |
| 119 | + files: dist/* |
0 commit comments