| name: Security Checks | |
| on: | |
| push: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - python-version: 3.13 | |
| toxenv: safety | |
| - python-version: 3.13 | |
| toxenv: bandit | |
| steps: | |
| - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
| with: | |
| submodules: recursive | |
| - name: Setup python | |
| uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade virtualenv | |
| pip install tox | |
| - name: Run security checks | |
| env: | |
| TOXENV: ${{ matrix.toxenv }} | |
| run: tox | |
| # Branch protection on master requires a check named "Security Checks" (see | |
| # .asf.yaml), but the matrix jobs above report as "build (<python>, <toxenv>)". | |
| # This job reports their combined result under the required name. It runs even | |
| # when a build job fails or is cancelled, so the check fails instead of being | |
| # skipped (a skipped required check counts as passing). | |
| security-checks: | |
| name: Security Checks | |
| needs: build | |
| if: ${{ always() }} | |
| runs-on: ubuntu-latest | |
| permissions: {} | |
| steps: | |
| - name: Check that every build job passed | |
| env: | |
| BUILD_RESULT: ${{ needs.build.result }} | |
| run: | | |
| echo "build jobs: $BUILD_RESULT" | |
| test "$BUILD_RESULT" = "success" |