| 1 | name: Continuous Integration |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | pull_request: |
| 6 | |
| 7 | jobs: |
| 8 | unit-tests: |
| 9 | name: Test on Python v${{ matrix.python-version }} |
| 10 | runs-on: ubuntu-latest |
| 11 | strategy: |
| 12 | matrix: |
| 13 | python-version: [3.4, 3.5, 3.6, 3.7, 3.8, 3.9] |
| 14 | |
| 15 | steps: |
| 16 | - name: Checkout the repository |
| 17 | uses: actions/checkout@v2 |
| 18 | with: |
| 19 | persist-credentials: false |
| 20 | |
| 21 | - name: Install build essentials |
| 22 | run: sudo apt-get --yes install build-essential |
| 23 | |
| 24 | - name: Set up Python |
| 25 | uses: actions/setup-python@v2 |
| 26 | with: |
| 27 | python-version: ${{ matrix.python-version }} |
| 28 | |
| 29 | - name: Install dependencies |
| 30 | run: | |
| 31 | pip install pip==19.0.3 pipenv==2018.11.26 |
| 32 | pipenv install --dev |
| 33 | |
| 34 | - run: pipenv run tests |
| 35 | - run: pipenv run tests-coverage |
| 36 | |
| 37 | publish-release: |
| 38 | name: Publish the release |
| 39 | if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 40 | runs-on: ubuntu-latest |
| 41 | |
| 42 | steps: |
| 43 | - name: Checkout the repository |
| 44 | uses: actions/checkout@v2 |
| 45 | with: |
| 46 | persist-credentials: false |
| 47 | |
| 48 | - name: Install build essentials |
| 49 | run: sudo apt-get --yes install build-essential |
| 50 | |
| 51 | - name: Set up Python |
| 52 | uses: actions/setup-python@v2 |
| 53 | |
| 54 | - name: Install dependencies |
| 55 | run: | |
| 56 | pip install pip==19.0.3 pipenv==2018.11.26 |
| 57 | pipenv install --dev |
| 58 | |
| 59 | - name: Create the distribution |
| 60 | run: pipenv run python setup.py build sdist |
| 61 | |
| 62 | - name: Publish the distribution |
| 63 | uses: pypa/gh-action-pypi-publish@master |
| 64 | with: |
| 65 | user: __token__ |
| 66 | password: ${{ secrets.PYPI_PASSWORD }} |
| 67 | |
| 68 | - name: Create the release |
| 69 | id: create_release |
| 70 | uses: actions/create-release@v1 |
| 71 | env: |
| 72 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 73 | with: |
| 74 | tag_name: ${{ github.ref }} |
| 75 | release_name: Release ${{ github.ref }} |
| 76 |