|  | 
|  | 1 | +--- | 
|  | 2 | +name: CI | 
|  | 3 | +on: | 
|  | 4 | +  - push | 
|  | 5 | +  - pull_request | 
|  | 6 | +jobs: | 
|  | 7 | +  lint: | 
|  | 8 | +    name: Run linters | 
|  | 9 | +    runs-on: ubuntu-latest | 
|  | 10 | +    steps: | 
|  | 11 | +      - name: Checkout source code | 
|  | 12 | +        uses: actions/checkout@v2 | 
|  | 13 | +      - name: Set up Python 3.9 | 
|  | 14 | +        uses: actions/setup-python@v2 | 
|  | 15 | +        with: | 
|  | 16 | +          python-version: 3.9 | 
|  | 17 | +      - name: Install dependencies | 
|  | 18 | +        run: python -m pip install tox | 
|  | 19 | +      - name: Run tox | 
|  | 20 | +        run: tox -e style | 
|  | 21 | +  test: | 
|  | 22 | +    name: Run unit tests | 
|  | 23 | +    runs-on: ubuntu-latest | 
|  | 24 | +    strategy: | 
|  | 25 | +      matrix: | 
|  | 26 | +        python: [3.6, 3.7, 3.8, 3.9] | 
|  | 27 | +    steps: | 
|  | 28 | +      - name: Checkout source code | 
|  | 29 | +        uses: actions/checkout@v2 | 
|  | 30 | +      - name: Set up Python ${{ matrix.python }} | 
|  | 31 | +        uses: actions/setup-python@v2 | 
|  | 32 | +        with: | 
|  | 33 | +          python-version: ${{ matrix.python }} | 
|  | 34 | +      - name: Install dependencies | 
|  | 35 | +        run: python -m pip install tox | 
|  | 36 | +      - name: Run unit tests (via tox) | 
|  | 37 | +        # Run tox using the version of Python in `PATH` | 
|  | 38 | +        run: tox -e py | 
|  | 39 | +  docs: | 
|  | 40 | +    name: Build docs | 
|  | 41 | +    runs-on: ubuntu-latest | 
|  | 42 | +    steps: | 
|  | 43 | +      - name: Checkout source code | 
|  | 44 | +        uses: actions/checkout@v2 | 
|  | 45 | +        with: | 
|  | 46 | +          fetch-depth: 0 | 
|  | 47 | +      - name: Set up Python 3.9 | 
|  | 48 | +        uses: actions/setup-python@v2 | 
|  | 49 | +        with: | 
|  | 50 | +          python-version: 3.9 | 
|  | 51 | +      - name: Install dependencies | 
|  | 52 | +        run: python -m pip install tox | 
|  | 53 | +      - name: Build docs (via tox) | 
|  | 54 | +        run: tox -e docs | 
|  | 55 | +      - name: Archive build results | 
|  | 56 | +        uses: actions/upload-artifact@v2 | 
|  | 57 | +        with: | 
|  | 58 | +          name: html-docs-build | 
|  | 59 | +          path: docs/_build/html | 
|  | 60 | +          retention-days: 7 | 
|  | 61 | +  release: | 
|  | 62 | +    name: Upload release artifacts | 
|  | 63 | +    runs-on: ubuntu-latest | 
|  | 64 | +    needs: test | 
|  | 65 | +    if: github.event_name == 'push' | 
|  | 66 | +    steps: | 
|  | 67 | +      - name: Checkout source code | 
|  | 68 | +        uses: actions/checkout@v2 | 
|  | 69 | +        with: | 
|  | 70 | +          fetch-depth: 0 | 
|  | 71 | +      - name: Set up Python 3.9 | 
|  | 72 | +        uses: actions/setup-python@v2 | 
|  | 73 | +        with: | 
|  | 74 | +          python-version: 3.9 | 
|  | 75 | +      - name: Install dependencies | 
|  | 76 | +        run: python -m pip install build | 
|  | 77 | +      - name: Build a binary wheel and a source tarball | 
|  | 78 | +        run: python -m build --sdist --wheel --outdir dist/ . | 
|  | 79 | +      - name: Publish distribution to PyPI | 
|  | 80 | +        if: startsWith(github.ref, 'refs/tags') | 
|  | 81 | +        uses: pypa/gh-action-pypi-publish@master | 
|  | 82 | +        with: | 
|  | 83 | +          password: ${{ secrets.PYPI_API_TOKEN }} | 
0 commit comments