* ci: add zizmor workflow audit Runs zizmor over this repository's workflows and Dependabot config on every pull request, on pushes to the default branch and weekly, through owncloud/reusable-workflows' zizmor.yml. Any finding fails the check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <323649642+oc-tmueller@users.noreply.github.com> * fix(ci): resolve zizmor findings - excessive-permissions: workflows without a permissions block ran with the repository default, which is read/write. They now default to contents: read; only create-github-release gets contents: write, for softprops/action-gh-release. audit-release only GETs the published release, which read covers. - cache-poisoning: the release workflow's setup-node steps opt out of package-manager caching, so a tag build cannot restore a cache that a branch build wrote. - artipacked: checkouts do not persist credentials. No job runs a git operation after checkout. - dependabot-cooldown: every ecosystem waits 7 days, as github-actions already does. - ref-version-mismatch: setup-php's tag is 2.40.0, without the v. - self-repository: local reusable workflows and actions are called as $/... instead of ./... . - Suppressed inline, with the reason on the line: the unpinned `npm install -g yarn npx` in the release workflow (pre-existing, left to the maintainers), the version-pinned gherlint install, and the softprops release step, which CI cannot exercise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <323649642+oc-tmueller@users.noreply.github.com> * fix(ci): undo two zizmor auto-fix slips, keep scheduled runs - zizmor's template-injection auto-fix read `${{ }}` inside a shell comment in determine-release-type as an expansion: it added an env entry reading that job's own output, which is always empty, and rewrote the comment to describe something no longer true. The entry is gone and the comment describes the env indirection the later jobs now use, with the version check as a second safeguard. - Only pull request runs of the zizmor audit cancel each other now; a push to master and the weekly run share a ref. The previous commit's message is incomplete: it lists a self-repository change this repository did not need, and omits the auto-fixed template-injection findings (expressions in run: moved to env: in release.yml, release-npm-packages.yml and acceptance-tests.yml) and the cache-poisoning fix also turning off setup-go's cache in the release jobs, so a tag build cannot restore a cache a branch build wrote. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <323649642+oc-tmueller@users.noreply.github.com> --------- Signed-off-by: Thomas Müller <323649642+oc-tmueller@users.noreply.github.com> Co-authored-by: Thomas Müller <323649642+oc-tmueller@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
145 lines
4.5 KiB
YAML
145 lines
4.5 KiB
YAML
name: Web Tests
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [master, stable-*]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
detect-web-changes:
|
|
name: detect-web-changes
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
outputs:
|
|
web-changed: ${{ steps.check.outputs.web-changed }}
|
|
full-run: ${{ steps.check.outputs.full-run }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Check if web/ changed
|
|
id: check
|
|
env:
|
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
run: |
|
|
# full-run: push to master/stable-* or an explicit [full-ci] request always run
|
|
# everything, unscoped - same as before Nx. A normal PR gets the affected-scoped
|
|
# path instead (see web-build-test), since only those two cases actually need every
|
|
# project checked.
|
|
if [[ "${{ github.event_name }}" == "push" ]]; then
|
|
echo "web-changed=true" >> "$GITHUB_OUTPUT"
|
|
echo "full-run=true" >> "$GITHUB_OUTPUT"
|
|
exit 0
|
|
fi
|
|
|
|
if echo "$PR_TITLE" | grep -qi "\[full-ci\]"; then
|
|
echo "web-changed=true" >> "$GITHUB_OUTPUT"
|
|
echo "full-run=true" >> "$GITHUB_OUTPUT"
|
|
exit 0
|
|
fi
|
|
|
|
echo "full-run=false" >> "$GITHUB_OUTPUT"
|
|
|
|
CHANGED_FILES=$(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" 2>/dev/null || git diff --name-only HEAD~1)
|
|
|
|
WEB_CHANGED=false
|
|
while IFS= read -r file; do
|
|
case "$file" in
|
|
web/*) WEB_CHANGED=true; break ;;
|
|
.github/workflows/web-tests.yml) WEB_CHANGED=true; break ;;
|
|
esac
|
|
done <<< "$CHANGED_FILES"
|
|
|
|
echo "web-changed=$WEB_CHANGED" >> "$GITHUB_OUTPUT"
|
|
echo "web/ changed: $WEB_CHANGED"
|
|
|
|
web-build-test:
|
|
name: web-build-test
|
|
needs: [detect-web-changes]
|
|
if: needs.detect-web-changes.outputs.web-changed == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
defaults:
|
|
run:
|
|
working-directory: web
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
# nx affected --base=<pr-base-sha> (used below) needs that commit present locally
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
|
|
with:
|
|
version: 10.33.3
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
with:
|
|
node-version: 24.15.0
|
|
cache: pnpm
|
|
cache-dependency-path: web/pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Check licenses
|
|
run: pnpm licenses:check
|
|
|
|
- name: Save licenses
|
|
run: pnpm licenses:csv && pnpm licenses:save
|
|
|
|
- name: Check types
|
|
# Whole-repo, unconditional: only 5/27 projects have a per-project typecheck target
|
|
# (nx/vite's typecheck inference needs a project's own vite.config.ts, which most
|
|
# web-app-* packages don't have), so `nx affected -t typecheck` can't safely stand
|
|
# in for this yet.
|
|
run: pnpm check:types
|
|
|
|
- name: Check format
|
|
run: pnpm check:format
|
|
|
|
- name: Lint
|
|
env:
|
|
FULL_RUN: ${{ needs.detect-web-changes.outputs.full-run }}
|
|
run: |
|
|
if [[ "$FULL_RUN" == "true" ]]; then
|
|
pnpm lint
|
|
else
|
|
pnpm exec nx affected -t lint --base="${{ github.event.pull_request.base.sha }}"
|
|
fi
|
|
|
|
- name: Run unit tests
|
|
env:
|
|
FULL_RUN: ${{ needs.detect-web-changes.outputs.full-run }}
|
|
run: |
|
|
if [[ "$FULL_RUN" == "true" ]]; then
|
|
pnpm test:unit --coverage
|
|
else
|
|
pnpm exec nx affected -t test --base="${{ github.event.pull_request.base.sha }}"
|
|
fi
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
web-tests-passed:
|
|
name: web-tests-passed
|
|
needs: [detect-web-changes, web-build-test]
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
if: always()
|
|
steps:
|
|
- name: Check web-build-test passed or was skipped
|
|
run: |
|
|
if [[ "${{ needs.web-build-test.result }}" == "failure" || "${{ needs.web-build-test.result }}" == "cancelled" ]]; then
|
|
exit 1
|
|
fi
|