|
| 1 | +name: dac actions |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '*' |
| 7 | + tags: |
| 8 | + - '*' |
| 9 | + |
| 10 | +jobs: |
| 11 | + |
| 12 | + check-style: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout π |
| 16 | + uses: actions/checkout@v3 |
| 17 | + with: |
| 18 | + fetch-depth: 1 |
| 19 | + - name: Setup python π |
| 20 | + uses: actions/setup-python@v4 |
| 21 | + with: |
| 22 | + python-version: '3.11' |
| 23 | + - name: Setup cache πΎ |
| 24 | + uses: actions/cache@v3 |
| 25 | + with: |
| 26 | + path: ~/.cache/pre-commit |
| 27 | + key: pre-commit |
| 28 | + - name: Prepare pre-commit πββοΈπ |
| 29 | + run: | |
| 30 | + python -m venv venv || . venv/bin/activate |
| 31 | + pip install -U pip wheel setuptools pre-commit |
| 32 | + pre-commit install |
| 33 | + - name: Run pre-commit ππ |
| 34 | + run: | |
| 35 | + pre-commit run |
| 36 | +
|
| 37 | + test: |
| 38 | + runs-on: "${{ matrix.os }}" |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + os: ["ubuntu-latest"] |
| 42 | + version: ["3.9", "3.10", "3.11"] |
| 43 | + steps: |
| 44 | + - name: Checkout π |
| 45 | + uses: actions/checkout@v3 |
| 46 | + with: |
| 47 | + fetch-depth: 1 |
| 48 | + - name: Setup python π |
| 49 | + uses: actions/setup-python@v4 |
| 50 | + with: |
| 51 | + python-version: "${{ matrix.version }}" |
| 52 | + - name: Prepare tests πββοΈπ¬ |
| 53 | + run: | |
| 54 | + python -m venv venv || . venv/bin/activate |
| 55 | + pip install -U pip wheel setuptools |
| 56 | + pip install -r requirements-test.txt |
| 57 | + - name: Run tests π¬π |
| 58 | + run: | |
| 59 | + pytest test --run-slow |
| 60 | +
|
| 61 | + docs: |
| 62 | + needs: [test, check-style] |
| 63 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 64 | + runs-on: ubuntu-latest |
| 65 | + steps: |
| 66 | + - name: Checkout π |
| 67 | + uses: actions/checkout@v3 |
| 68 | + - name: Setup python π |
| 69 | + uses: actions/setup-python@v4 |
| 70 | + with: |
| 71 | + python-version: "3.11" |
| 72 | + - name: Build and push docs ππ |
| 73 | + run: | |
| 74 | + pip install -r requirements-docs.txt |
| 75 | + mkdocs gh-deploy --force |
| 76 | +
|
| 77 | + pypi-release: |
| 78 | + needs: [test, check-style] |
| 79 | + if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} |
| 80 | + runs-on: ubuntu-latest |
| 81 | + steps: |
| 82 | + - name: Checkout π |
| 83 | + if: ${{ github.event_name == 'release' }} |
| 84 | + uses: actions/checkout@v3 |
| 85 | + with: |
| 86 | + fetch-depth: 1 |
| 87 | + - name: Setup python π |
| 88 | + uses: actions/setup-python@v4 |
| 89 | + with: |
| 90 | + python-version: "3.11" |
| 91 | + - name: Prepare release πββοΈπ¦test |
| 92 | + run: | |
| 93 | + python -m venv venv || . venv/bin/activate |
| 94 | + pip install -U pip wheel setuptools build twine |
| 95 | + - name: Build π οΈπ¦ |
| 96 | + run: | |
| 97 | + python -m build |
| 98 | + - name: Release π¦π |
| 99 | + env: |
| 100 | + TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} |
| 101 | + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} |
| 102 | + run: | |
| 103 | + python -m twine upload dist/* |
0 commit comments