|
| 1 | +name: CI |
| 2 | +on: # yamllint disable-line rule:truthy |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | +env: |
| 6 | + USE_DOCKER: true |
| 7 | +jobs: |
| 8 | + test: |
| 9 | + runs-on: ["${{ matrix.os }}"] |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + os: [ubuntu-latest] |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v2 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + |
| 19 | + - name: Set up Python |
| 20 | + uses: actions/setup-python@v2 |
| 21 | + |
| 22 | + - name: Install Dependencies |
| 23 | + run: | |
| 24 | + python -m pip install -U pip docker-compose |
| 25 | +
|
| 26 | + - name: Unit tests |
| 27 | + run: | |
| 28 | + make test |
| 29 | +
|
| 30 | + - name: Publish coverage to codecov.io. |
| 31 | + uses: codecov/codecov-action@v2 |
| 32 | + if: ${{ !env.ACT }} |
| 33 | + with: |
| 34 | + fail_ci_if_error: true |
| 35 | + files: ./coverage.xml |
| 36 | + verbose: true |
| 37 | + lint: |
| 38 | + runs-on: [ubuntu-latest] |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v2 |
| 41 | + |
| 42 | + - name: Set up Python |
| 43 | + uses: actions/setup-python@v2 |
| 44 | + |
| 45 | + - name: Install Dependencies |
| 46 | + run: | |
| 47 | + python -m pip install -U pip docker-compose |
| 48 | +
|
| 49 | + - name: Run linters. |
| 50 | + run: | |
| 51 | + make lint |
| 52 | + check_cc_and_requirements: |
| 53 | + runs-on: [ubuntu-latest] |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v2 |
| 56 | + |
| 57 | + - name: Set up Python |
| 58 | + uses: actions/setup-python@v2 |
| 59 | + |
| 60 | + - name: Check that requirements are up-to-date. |
| 61 | + if: github.ref != 'refs/heads/master' && ! startsWith(github.ref, 'refs/tags') |
| 62 | + run: | |
| 63 | + make check-requirements |
| 64 | +
|
| 65 | + - name: Check that this project is up-to-date with cookiecutter. |
| 66 | + if: github.ref != 'refs/heads/master' && ! startsWith(github.ref, 'refs/tags') |
| 67 | + run: | |
| 68 | + make check-cc |
| 69 | + publish: |
| 70 | + runs-on: [ubuntu-latest] |
| 71 | + needs: |
| 72 | + - test |
| 73 | + - lint |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v2 |
| 76 | + with: |
| 77 | + fetch-depth: 0 |
| 78 | + |
| 79 | + - name: Set up Python |
| 80 | + uses: actions/setup-python@v2 |
| 81 | + - name: Install pypa/build |
| 82 | + run: | |
| 83 | + python -m pip install --user build setuptools_scm |
| 84 | +
|
| 85 | + - name: Build a binary wheel and a source tarball |
| 86 | + run: | |
| 87 | + python -m build --sdist --wheel --outdir dist/ |
| 88 | +
|
| 89 | + - name: Build wheels |
| 90 | + run: | |
| 91 | + python setup.py sdist |
| 92 | +
|
| 93 | + - name: Build docs and publish them back to the master branch if necessary. |
| 94 | + if: github.repository == 'bbugyi200/zorg' && github.ref == 'refs/heads/master' |
| 95 | + run: | |
| 96 | + ./bin/publish_docs |
| 97 | +
|
| 98 | + - name: Publish distribution to PyPI |
| 99 | + if: github.repository == 'bbugyi200/zorg' && startsWith(github.ref, 'refs/tags') |
| 100 | + uses: pypa/gh-action-pypi-publish@master |
| 101 | + with: |
| 102 | + password: ${{ secrets.PYPI_API_TOKEN }} |
| 103 | + skip_existing: true |
0 commit comments