|
| 1 | +on: ["push", "pull_request"] |
| 2 | + |
| 3 | +name: Test |
| 4 | + |
| 5 | +concurrency: |
| 6 | + # Cancel older, in-progress jobs from the same PR, same workflow. |
| 7 | + # use run_id if the job is triggered by a push to ensure |
| 8 | + # push-triggered jobs to not get canceled. |
| 9 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + linting: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Setup Python |
| 20 | + uses: actions/setup-python@v5 |
| 21 | + with: |
| 22 | + python-version: "3.10" |
| 23 | + |
| 24 | + - name: Install Dependencies |
| 25 | + run: | |
| 26 | + python -m pip install --upgrade pip |
| 27 | + pip install .[lint] |
| 28 | +
|
| 29 | + - name: Run Black |
| 30 | + run: black --check . |
| 31 | + |
| 32 | + - name: Run isort |
| 33 | + run: isort --check-only . |
| 34 | + |
| 35 | + - name: Run flake8 |
| 36 | + run: flake8 . |
| 37 | + |
| 38 | + - name: Run mdformat |
| 39 | + run: mdformat . --check |
| 40 | + |
| 41 | + type-check: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Setup Python |
| 48 | + uses: actions/setup-python@v5 |
| 49 | + with: |
| 50 | + python-version: "3.10" |
| 51 | + |
| 52 | + - name: Install Dependencies |
| 53 | + run: | |
| 54 | + python -m pip install --upgrade pip |
| 55 | + pip install .[lint,test] |
| 56 | +
|
| 57 | + - name: Run MyPy |
| 58 | + run: mypy . |
| 59 | + |
| 60 | + functional: |
| 61 | + runs-on: ${{ matrix.os }} |
| 62 | + |
| 63 | + strategy: |
| 64 | + matrix: |
| 65 | + os: [ubuntu-latest, macos-latest] # eventually add `windows-latest` |
| 66 | + python-version: [3.9, "3.10", "3.11", "3.12", "3.13"] |
| 67 | + |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v4 |
| 70 | + |
| 71 | + - name: Setup Python |
| 72 | + uses: actions/setup-python@v5 |
| 73 | + with: |
| 74 | + python-version: ${{ matrix.python-version }} |
| 75 | + |
| 76 | + - name: Install Dependencies |
| 77 | + run: | |
| 78 | + python -m pip install --upgrade pip |
| 79 | + pip install .[test] |
| 80 | +
|
| 81 | + - name: Run Tests |
| 82 | + run: pytest -m "not fuzzing" -n 0 -s --cov |
| 83 | + |
| 84 | +# NOTE: uncomment this block after you've marked tests with @pytest.mark.fuzzing |
| 85 | +# fuzzing: |
| 86 | +# runs-on: ubuntu-latest |
| 87 | +# |
| 88 | +# strategy: |
| 89 | +# fail-fast: true |
| 90 | +# |
| 91 | +# steps: |
| 92 | +# - uses: actions/checkout@v4 |
| 93 | +# |
| 94 | +# - name: Setup Python |
| 95 | +# uses: actions/setup-python@v5 |
| 96 | +# with: |
| 97 | +# python-version: "3.10" |
| 98 | +# |
| 99 | +# - name: Install Dependencies |
| 100 | +# run: pip install .[test] |
| 101 | +# |
| 102 | +# - name: Run Tests |
| 103 | +# run: pytest -m "fuzzing" --no-cov -s |
0 commit comments