|
| 1 | +name: tox |
| 2 | + |
| 3 | +on: |
| 4 | + create: # is used for publishing to PyPI and TestPyPI |
| 5 | + tags: # any tag regardless of its name, no branches |
| 6 | + - "**" |
| 7 | + push: # only publishes pushes to the main branch to TestPyPI |
| 8 | + branches: # any integration branch but not tag |
| 9 | + - "main" |
| 10 | + pull_request: |
| 11 | + release: |
| 12 | + types: |
| 13 | + - published # It seems that you can publish directly without creating |
| 14 | + schedule: |
| 15 | + - cron: 1 0 * * * # Run daily at 0:01 UTC |
| 16 | + # Run every Friday at 18:02 UTC |
| 17 | + # https://crontab.guru/#2_18_*_*_5 |
| 18 | + # - cron: 2 18 * * 5 |
| 19 | + workflow_call: |
| 20 | + |
| 21 | +jobs: |
| 22 | + tox: |
| 23 | + name: >- |
| 24 | + ${{ matrix.env.TOXENV }} |
| 25 | + runs-on: ${{ matrix.os }} |
| 26 | + strategy: |
| 27 | + fail-fast: false |
| 28 | + matrix: |
| 29 | + python-version: |
| 30 | + - 3.9 |
| 31 | + os: |
| 32 | + - ubuntu-20.04 |
| 33 | + env: |
| 34 | + - TOXENV: lint |
| 35 | + - TOXENV: packaging |
| 36 | + - TOXENV: py |
| 37 | + env: |
| 38 | + TOX_PARALLEL_NO_SPINNER: 1 |
| 39 | + FORCE_COLOR: 1 |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Check out src from Git |
| 43 | + uses: actions/checkout@v2 |
| 44 | + with: |
| 45 | + fetch-depth: 0 # needed by setuptools-scm |
| 46 | + - name: Set up Python ${{ matrix.python-version }} |
| 47 | + uses: actions/setup-python@v2 |
| 48 | + with: |
| 49 | + python-version: ${{ matrix.python-version }} |
| 50 | + - name: Pre-commit cache |
| 51 | + uses: actions/cache@v2 |
| 52 | + with: |
| 53 | + path: ~/.cache/pre-commit |
| 54 | + key: ${{ runner.os }}-${{ matrix.env.TOXENV }}-pre-commit-${{ hashFiles('setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml') }} |
| 55 | + - name: Pip cache |
| 56 | + uses: actions/cache@v2 |
| 57 | + with: |
| 58 | + path: ~/.cache/pip |
| 59 | + key: ${{ runner.os }}-${{ matrix.env.TOXENV }}-pip-${{ hashFiles('setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml') }} |
| 60 | + - name: Install tox |
| 61 | + run: | |
| 62 | + python3 -m pip install --upgrade tox |
| 63 | + - name: Log installed dists |
| 64 | + run: >- |
| 65 | + python -m pip freeze --all |
| 66 | + - name: >- |
| 67 | + Initialize tox envs |
| 68 | + run: >- |
| 69 | + python -m |
| 70 | + tox |
| 71 | + --parallel auto |
| 72 | + --parallel-live |
| 73 | + --notest |
| 74 | + --skip-missing-interpreters false |
| 75 | + -vv |
| 76 | + env: ${{ matrix.env }} |
| 77 | + - name: Test with tox |
| 78 | + run: | |
| 79 | + python -m tox --parallel auto --parallel-live |
| 80 | + env: ${{ matrix.env }} |
0 commit comments