|
| 1 | +name: continuous-integration |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + |
| 10 | + pre-commit: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v2 |
| 14 | + - name: Set up Python 3.8 |
| 15 | + uses: actions/setup-python@v1 |
| 16 | + with: |
| 17 | + python-version: 3.8 |
| 18 | + - uses: pre-commit/action@v2.0.0 |
| 19 | + |
| 20 | + tests: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + python-version: [3.6, 3.7, 3.8] |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v2 |
| 27 | + - name: Set up Python ${{ matrix.python-version }} |
| 28 | + uses: actions/setup-python@v1 |
| 29 | + with: |
| 30 | + python-version: ${{ matrix.python-version }} |
| 31 | + - name: Install dependencies |
| 32 | + run : | |
| 33 | + python -m pip install --upgrade pip |
| 34 | + pip install -e.[testing] |
| 35 | + - name: Run pytest |
| 36 | + run: | |
| 37 | + pytest --duration=10 --cov=sphinxcontrib --cov-report=xml --cov-report=term-missing |
| 38 | + - name: Create cov |
| 39 | + run: coverage xml |
| 40 | + - name: Upload to Codecov |
| 41 | + if: matrix.python-version == 3.7 |
| 42 | + uses: codecov/codecov-action@v1 |
| 43 | + with: |
| 44 | + name: sphinxcontrib-prettyproof-pytest-py3.7 |
| 45 | + flags: pytests |
| 46 | + file: ./coverage.xml |
| 47 | + fail_ci_if_error: true |
| 48 | + |
| 49 | + docs: |
| 50 | + name: Documentation build |
| 51 | + runs-on: ubuntu-latest |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v2 |
| 54 | + - name: Set up Python 3.8 |
| 55 | + uses: actions/setup-python@v1 |
| 56 | + with: |
| 57 | + python-version: 3.8 |
| 58 | + - name: Install dependencies |
| 59 | + run: | |
| 60 | + python -m pip install --upgrade pip |
| 61 | + pip install -e .[rtd] |
| 62 | + - name: Build docs |
| 63 | + run: | |
| 64 | + cd docs |
| 65 | + make clean |
| 66 | + make html |
| 67 | +
|
| 68 | + publish: |
| 69 | + name: Publish to PyPi |
| 70 | + needs: [pre-commit, tests, docs] |
| 71 | + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 72 | + runs-on: ubuntu-latest |
| 73 | + steps: |
| 74 | + - name: Checkout source |
| 75 | + uses: actions/checkout@v2 |
| 76 | + - name: Set up Python 3.7 |
| 77 | + uses: actions/setup-python@v1 |
| 78 | + with: |
| 79 | + python-version: 3.7 |
| 80 | + - name: Build package |
| 81 | + run: | |
| 82 | + pip install wheel |
| 83 | + python setup.py bdist_wheel sdist |
| 84 | + - name: Publish |
| 85 | + uses: pypa/gh-action-pypi-publish@v1.3.1 |
| 86 | + with: |
| 87 | + user: __token__ |
| 88 | + password: ${{ secrets.PYPI_KEY }} |
0 commit comments