| 1 |
name: Run tests |
| 2 |
|
| 3 |
|
| 4 |
on: |
| 5 |
|
| 6 |
push: |
| 7 |
branches: |
| 8 |
- master |
| 9 |
paths: |
| 10 |
- "dpath/" |
| 11 |
- "**.py" |
| 12 |
- "tox.ini" |
| 13 |
pull_request: |
| 14 |
paths: |
| 15 |
- "dpath/" |
| 16 |
- "**.py" |
| 17 |
- "tox.ini" |
| 18 |
|
| 19 |
|
| 20 |
workflow_dispatch: |
| 21 |
|
| 22 |
|
| 23 |
jobs: |
| 24 |
|
| 25 |
|
| 26 |
flake8: |
| 27 |
runs-on: ubuntu-latest |
| 28 |
|
| 29 |
steps: |
| 30 |
- name: Check out code |
| 31 |
uses: actions/checkout@main |
| 32 |
|
| 33 |
- name: Set up Python 3.12 |
| 34 |
uses: actions/setup-python@main |
| 35 |
with: |
| 36 |
python-version: "3.12" |
| 37 |
|
| 38 |
- name: Setup flake8 annotations |
| 39 |
uses: TrueBrain/[email protected] |
| 40 |
with: |
| 41 |
path: setup.py dpath/ tests/ |
| 42 |
|
| 43 |
|
| 44 |
generate-hashseed: |
| 45 |
runs-on: ubuntu-latest |
| 46 |
|
| 47 |
outputs: |
| 48 |
hashseed: ${{ steps.generate.outputs.hashseed }} |
| 49 |
|
| 50 |
steps: |
| 51 |
- name: Generate Hashseed |
| 52 |
id: generate |
| 53 |
run: | |
| 54 |
python -c "import os |
| 55 |
from random import randint |
| 56 |
hashseed = randint(0, 4294967295) |
| 57 |
print(f'{hashseed=}') |
| 58 |
open(os.environ['GITHUB_OUTPUT'], 'a').write(f'hashseed={hashseed}')" |
| 59 |
|
| 60 |
|
| 61 |
tests: |
| 62 |
|
| 63 |
runs-on: ubuntu-latest |
| 64 |
|
| 65 |
needs: [generate-hashseed, flake8] |
| 66 |
|
| 67 |
strategy: |
| 68 |
matrix: |
| 69 |
|
| 70 |
python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy-3.7', '3.12'] |
| 71 |
|
| 72 |
|
| 73 |
steps: |
| 74 |
|
| 75 |
- name: Check out code |
| 76 |
uses: actions/checkout@main |
| 77 |
|
| 78 |
- name: Set up Python ${{ matrix.python-version }} |
| 79 |
uses: actions/setup-python@main |
| 80 |
with: |
| 81 |
python-version: ${{ matrix.python-version }} |
| 82 |
|
| 83 |
- name: Run tox with tox-gh-actions |
| 84 |
uses: ymyzk/run-tox-gh-actions@main |
| 85 |
with: |
| 86 |
tox-args: -vv --hashseed=${{ needs.generate-hashseed.outputs.hashseed }} |