Repository navigation
ci: give pip-audit a cache folder the runner owns #4757
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Linters | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| push: | |
| branches: [ main ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| # One job: the commit check and the rule scans each take under a minute, and | |
| # a second job mostly waits in the org-wide runner queue. | |
| linters: | |
| name: Linters | |
| runs-on: frappe-arc | |
| timeout-minutes: 15 | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 200 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.14' | |
| # Same scheme as the bench action's package cache, so the two share entries. | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: packages-linters-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }} | |
| restore-keys: | | |
| packages- | |
| # pre-commit's own Node (for prettier and eslint) needs libatomic, which frappe-arc runners lack. | |
| - name: Install libatomic | |
| run: sudo apt-get update -qq && sudo apt-get install -y -qq --no-install-recommends libatomic1 | |
| - name: Install and Run Pre-commit | |
| uses: pre-commit/action@v3.0.1 | |
| - name: Test the changed-test classifier | |
| run: .github/helper/test-changed-tests.sh | |
| - name: Download Semgrep rules | |
| run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules | |
| - name: Download semgrep | |
| run: pip install semgrep | |
| - name: Run Semgrep rules | |
| run: semgrep ci --config ./frappe-semgrep-rules/rules | |
| - name: Run LMS security Semgrep rules | |
| # `semgrep ci` is diff-aware on its own: in a PR it fetches and computes | |
| # the branch-off point itself, so only findings this PR introduces | |
| # block. Passing --baseline-commit instead would fail here, because the | |
| # checkout above is shallow and `git cat-file -e <base sha>` misses. | |
| # The fixtures are deliberate positives and must not be scanned. | |
| run: semgrep ci --config ./.github/semgrep/security.yml --exclude '.github/semgrep/fixtures' | |
| - name: Run Vue directive Semgrep rules | |
| # --error for the same reason as the RTL step below: a bare | |
| # `semgrep scan` prints its findings and still exits 0. The tree is at | |
| # 0 findings, so no baseline is needed. | |
| run: semgrep scan --error --config ./.github/semgrep/vue-directives.yml frontend/src | |
| - name: Run RTL Semgrep rules | |
| # --error is required: a bare `semgrep scan` prints its findings and | |
| # still exits 0, so without it this step could never fail. | |
| run: semgrep scan --error --config ./.github/semgrep/tailwind-rtl.yml | |
| # Last, so a bad commit subject still gets the lint findings above. | |
| # --no-save and --ignore-scripts keep the tree the scans just saw clean: | |
| # a plain install rewrites package.json and runs the frontend install. | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| check-latest: true | |
| - name: Check commit titles | |
| run: | | |
| npm install --no-save --ignore-scripts @commitlint/cli @commitlint/config-conventional | |
| npx commitlint --verbose --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} | |
| deps-vulnerable-check: | |
| name: 'Vulnerable Dependency Check' | |
| runs-on: frappe-arc | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.14' | |
| - name: Install and run pip-audit | |
| run: | | |
| pip install pip-audit | |
| # Its default cache sits under the home folder, which platformdirs refuses on this | |
| # self-hosted runner ("writable by another user"); the job's own temp folder is fine. | |
| pip-audit --desc on --cache-dir "$RUNNER_TEMP/pip-audit-cache" . |