|
| 1 | +name: Python checks |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main", "major-release" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main", "major-release" ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 19 | + os: ["ubuntu-latest", "windows-latest", "macos-latest"] |
| 20 | + limited-dependencies: ["", "TRUE"] |
| 21 | + |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 26 | + |
| 27 | + - name: Set up Python ${{ matrix.python-version }} |
| 28 | + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 |
| 29 | + with: |
| 30 | + python-version: ${{ matrix.python-version }} |
| 31 | + |
| 32 | + - name: Install uv |
| 33 | + uses: install-pinned/uv@de03c60d508703a83d3f8f49afcf1249590ecda1 # 0.4.12 |
| 34 | + |
| 35 | + - name: Install dependencies |
| 36 | + env: |
| 37 | + PARSONS_LIMITED_DEPENDENCIES: ${{ matrix.limited-dependencies }} |
| 38 | + run: | |
| 39 | + uv pip install --system -e .[all] |
| 40 | + uv pip install --system -r requirements-dev.txt |
| 41 | +
|
| 42 | + - name: Test with pytest |
| 43 | + run: | |
| 44 | + pytest |
| 45 | +
|
| 46 | + ruff-format: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 51 | + |
| 52 | + - name: Set up Python 3.12 |
| 53 | + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 |
| 54 | + with: |
| 55 | + python-version: "3.12" |
| 56 | + |
| 57 | + - name: Install uv |
| 58 | + uses: install-pinned/uv@de03c60d508703a83d3f8f49afcf1249590ecda1 # 0.4.12 |
| 59 | + |
| 60 | + - name: Install dependencies |
| 61 | + run: | |
| 62 | + uv pip install --system -r requirements-dev.txt |
| 63 | +
|
| 64 | + - name: Run ruff format |
| 65 | + run: | |
| 66 | + ruff format --diff --target-version=py38 . |
| 67 | +
|
| 68 | + ruff: |
| 69 | + runs-on: ubuntu-latest |
| 70 | + |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 73 | + |
| 74 | + - name: Set up Python 3.12 |
| 75 | + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 |
| 76 | + with: |
| 77 | + python-version: "3.12" |
| 78 | + |
| 79 | + - name: Install uv |
| 80 | + uses: install-pinned/uv@de03c60d508703a83d3f8f49afcf1249590ecda1 # 0.4.12 |
| 81 | + |
| 82 | + - name: Install dependencies |
| 83 | + run: | |
| 84 | + uv pip install --system -r requirements-dev.txt |
| 85 | +
|
| 86 | + - name: Run ruff |
| 87 | + run: | |
| 88 | + ruff check --output-format=github . |
| 89 | +
|
| 90 | + bandit: |
| 91 | + runs-on: ubuntu-latest |
| 92 | + |
| 93 | + steps: |
| 94 | + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 95 | + |
| 96 | + - name: Set up Python 3.12 |
| 97 | + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 |
| 98 | + with: |
| 99 | + python-version: "3.12" |
| 100 | + |
| 101 | + - name: Install uv |
| 102 | + uses: install-pinned/uv@de03c60d508703a83d3f8f49afcf1249590ecda1 # 0.4.12 |
| 103 | + |
| 104 | + - name: Install bandit |
| 105 | + run: | |
| 106 | + uv pip install --system -r requirements-dev.txt |
| 107 | +
|
| 108 | + - name: Run bandit scan |
| 109 | + run: | |
| 110 | + bandit -c pyproject.toml -r . -ll -ii |
| 111 | +
|
| 112 | + coverage: |
| 113 | + runs-on: ubuntu-latest |
| 114 | + |
| 115 | + steps: |
| 116 | + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 117 | + |
| 118 | + - name: Set up Python 3.12 |
| 119 | + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 |
| 120 | + with: |
| 121 | + python-version: "3.12" |
| 122 | + |
| 123 | + - name: Install uv |
| 124 | + uses: install-pinned/uv@de03c60d508703a83d3f8f49afcf1249590ecda1 # 0.4.12 |
| 125 | + |
| 126 | + - name: Install dependencies |
| 127 | + run: | |
| 128 | + uv pip install --system -e .[all] |
| 129 | + uv pip install --system -r requirements-dev.txt |
| 130 | +
|
| 131 | + - name: Test with pytest |
| 132 | + run: | |
| 133 | + coverage run -m pytest |
| 134 | +
|
| 135 | + - name: Check coverage |
| 136 | + run: | |
| 137 | + coverage report -m --skip-covered --fail-under=75 |
| 138 | +
|
| 139 | + pip-install: |
| 140 | + strategy: |
| 141 | + fail-fast: false |
| 142 | + matrix: |
| 143 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 144 | + os: ["ubuntu-latest", "windows-latest", "macos-latest"] |
| 145 | + limited-dependencies: ["", "TRUE"] |
| 146 | + |
| 147 | + runs-on: ${{ matrix.os }} |
| 148 | + |
| 149 | + steps: |
| 150 | + - name: Harden Runner |
| 151 | + uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 |
| 152 | + with: |
| 153 | + egress-policy: audit |
| 154 | + |
| 155 | + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 156 | + |
| 157 | + - name: Set up Python ${{ matrix.python-version }} |
| 158 | + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 |
| 159 | + with: |
| 160 | + python-version: ${{ matrix.python-version }} |
| 161 | + cache: pip |
| 162 | + |
| 163 | + - name: Install dependencies |
| 164 | + env: |
| 165 | + PARSONS_LIMITED_DEPENDENCIES: ${{ matrix.limited-dependencies }} |
| 166 | + run: | |
| 167 | + pip install -r requirements-dev.txt |
| 168 | + pip install -e .[all] |
0 commit comments