Files
sencho/.github/workflows/ci.yml
dependabot[bot] fb55fc258b chore(deps): bump the all-actions group across 2 directories with 7 updates (#2140)
Bumps the all-actions group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/setup-node](https://github.com/actions/setup-node) | `7.0.0` | `7.1.0` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `7.0.1` | `7.0.2` |
| [github/codeql-action/init](https://github.com/github/codeql-action) | `4.38.2` | `4.38.3` |
| [github/codeql-action/autobuild](https://github.com/github/codeql-action) | `4.38.2` | `4.38.3` |
| [github/codeql-action/analyze](https://github.com/github/codeql-action) | `4.38.2` | `4.38.3` |
| [ossf/scorecard-action](https://github.com/ossf/scorecard-action) | `2.4.4` | `2.5.0` |
| [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) | `4.38.2` | `4.38.3` |

Bumps the all-actions group with 1 update in the /.github/actions/start-app directory: [actions/setup-node](https://github.com/actions/setup-node).


Updates `actions/setup-node` from 7.0.0 to 7.1.0
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/820762786026740c76f36085b0efc47a31fe5020...949feb2413d6458794dcd2491c4babbbce0c15c1)

Updates `actions/upload-artifact` from 7.0.1 to 7.0.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/043fb46d1a93c77aae656e7c1c64a875d1fc6a0a...cf430e030ddbb5b0abf93d22962f4752f3646cd9)

Updates `github/codeql-action/init` from 4.38.2 to 4.38.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2...24c54180a607b1449ed407dd24f251e4e9147c8d)

Updates `github/codeql-action/autobuild` from 4.38.2 to 4.38.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2...24c54180a607b1449ed407dd24f251e4e9147c8d)

Updates `github/codeql-action/analyze` from 4.38.2 to 4.38.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2...24c54180a607b1449ed407dd24f251e4e9147c8d)

Updates `ossf/scorecard-action` from 2.4.4 to 2.5.0
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](https://github.com/ossf/scorecard-action/compare/2d1146689b8cda280b9bc96326124645441f03bc...fa7117db83c52d787ae5a89f350999701505d78e)

Updates `github/codeql-action/upload-sarif` from 4.38.2 to 4.38.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2...24c54180a607b1449ed407dd24f251e4e9147c8d)

Updates `actions/setup-node` from 7.0.0 to 7.1.0
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/820762786026740c76f36085b0efc47a31fe5020...949feb2413d6458794dcd2491c4babbbce0c15c1)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: github/codeql-action/init
  dependency-version: 4.38.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: github/codeql-action/autobuild
  dependency-version: 4.38.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.38.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: ossf/scorecard-action
  dependency-version: 2.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.38.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-actions
- dependency-name: actions/setup-node
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-17 13:47:24 -04:00

366 lines
14 KiB
YAML

name: Sencho CI
on:
pull_request:
branches: [main]
# Cancel previous runs on the same branch/PR
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
# Least-privilege default for every job.
permissions:
contents: read
# ---------------------------------------------------------------------------
# Build & Validation (PRs only, gated by change detection)
# ---------------------------------------------------------------------------
jobs:
# Decides whether the PR touches anything the build/test jobs exercise.
# PRs that only touch docs/, .claude/, .opencode/ or markdown anywhere
# skip them; a skipped job satisfies a required check, so merging is not
# blocked. The release-please PR is treated as no-code (it only touches
# version metadata).
changes:
name: Detect code changes
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
pull-requests: read
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- name: Classify changed files
id: filter
env:
GH_TOKEN: ${{ github.token }}
HEAD_REF: ${{ github.head_ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail
if [ "$HEAD_REF" = 'release-please--branches--main--components--sencho' ]; then
echo "code=false" >> "$GITHUB_OUTPUT"
exit 0
fi
# Rename sources count too, so moving code into docs/ still runs CI.
files=$(gh api --paginate "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/files" \
-q '.[] | .filename, (.previous_filename // empty)')
# An empty file list is suspicious, not proof of a docs-only PR. The
# here-string (not a pipe) keeps grep -q safe under pipefail.
if [ -z "$files" ] || grep -Evq '^(docs/|\.claude/|\.opencode/)|\.mdx?$' <<<"$files"; then
code=true
else
code=false
fi
echo "code=$code" >> "$GITHUB_OUTPUT"
echo "code=$code"; printf '%s\n' "$files"
backend:
name: Backend unit tests (Build, Test, Lint)
runs-on: ubuntu-latest
timeout-minutes: 10
needs: changes
# Runs unless detection positively found no code: a failed detection job
# runs every gate instead of skipping them.
if: ${{ !cancelled() && needs.changes.outputs.code != 'false' }}
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
with:
node-version-file: '.node-version'
cache: 'npm'
cache-dependency-path: backend/package-lock.json
- name: Install Dependencies
working-directory: ./backend
run: npm ci
- name: Free loopback SSH port 22 for default-port integration
run: bash scripts/ci-free-loopback-ssh-port.sh 22
- name: Build (TypeScript)
working-directory: ./backend
run: npm run build
- name: Unit Tests (Vitest)
working-directory: ./backend
run: npm test
- name: Lint (ESLint)
working-directory: ./backend
run: npm run lint
- name: Audit Dependencies
working-directory: ./backend
run: node ../scripts/audit-with-vex.mjs
# Real-Docker integration tests, split out of the backend job so their
# ~1 minute of serial container work runs alongside the unit tests instead
# of after them.
backend-docker-integration:
name: Backend Docker integration
runs-on: ubuntu-latest
timeout-minutes: 10
needs: changes
if: ${{ !cancelled() && needs.changes.outputs.code != 'false' }}
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
with:
node-version-file: '.node-version'
cache: 'npm'
cache-dependency-path: backend/package-lock.json
- name: Install Dependencies
working-directory: ./backend
run: npm ci
- name: Docker integration tests (dedicated Vitest config)
working-directory: ./backend
run: npm run test:docker-integration
# Single status for branch protection, which requires this exact job name.
# Passes when both backend jobs passed, or both were skipped because change
# detection succeeded and found no code.
backend-result:
name: Backend (Build, Test, Lint)
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [changes, backend, backend-docker-integration]
if: always()
steps:
- name: Check backend results
env:
CHANGES: ${{ needs.changes.result }}
UNIT: ${{ needs.backend.result }}
DOCKER: ${{ needs.backend-docker-integration.result }}
run: |
echo "Change detection: $CHANGES, unit: $UNIT, docker integration: $DOCKER"
[ "$CHANGES" = success ] || exit 1
for r in "$UNIT" "$DOCKER"; do
[ "$r" = success ] || [ "$r" = skipped ] || exit 1
done
frontend:
name: Frontend (Build, Lint)
runs-on: ubuntu-latest
timeout-minutes: 10
needs: changes
# Runs unless detection positively found no code: a failed detection job
# runs every gate instead of skipping them.
if: ${{ !cancelled() && needs.changes.outputs.code != 'false' }}
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
with:
node-version-file: '.node-version'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install Dependencies
working-directory: ./frontend
run: npm ci
- name: Build (Vite/React)
working-directory: ./frontend
run: npm run build
- name: Unit Tests (Vitest)
working-directory: ./frontend
run: npm test
- name: Lint (ESLint)
working-directory: ./frontend
run: npm run lint
- name: Audit Dependencies
working-directory: ./frontend
run: node ../scripts/audit-with-vex.mjs
docker-validate:
name: Docker Build & Scan
runs-on: ubuntu-latest
timeout-minutes: 15
needs: changes
# Runs unless detection positively found no code: a failed detection job
# runs every gate instead of skipping them.
if: ${{ !cancelled() && needs.changes.outputs.code != 'false' }}
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@594f3bf4285d9ea8dc53c9a0c9c4092420091003 # v4
# Computed once per job run. Feeds Dockerfile's APK_CACHE_BUST arg so
# the `apk upgrade` layer rebuilds at least once per calendar day, even
# when every other input to the layer is cached. See Dockerfile:115-122
# for the rationale.
- name: Compute daily apk cache bust value
id: apk-bust
run: echo "date=$(date -u +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
- name: Build Docker image (validation only)
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7
with:
context: .
push: false
load: true
tags: sencho:pr-test
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
APK_CACHE_BUST=${{ steps.apk-bust.outputs.date }}
- name: Scan image for vulnerabilities (Trivy)
# Hard-fails the PR on any HIGH or CRITICAL finding not suppressed by
# the OpenVEX document at security/vex/sencho.openvex.json (loaded via
# trivy.yaml). The VEX document is the canonical triage record and is
# also attached as a cosign attestation on the published image.
# If a new CVE must be triaged, add a VEX statement with a
# justification — do NOT recreate .trivyignore.
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
image-ref: sencho:pr-test
exit-code: '1'
severity: 'CRITICAL,HIGH'
format: 'table'
trivy-config: trivy.yaml
# Mirror of the release-time pre-publish smoke gate in docker-publish.yml.
# Catches the class of failure where the source-built Docker CLI or
# Compose plugin compiles cleanly but does not exec at runtime (e.g. -o
# pointed at a non-main Go package, ABI breakage in a base image bump).
# The release workflow additionally polls /api/health; PR CI keeps just
# the binary check to bound job duration without losing the gate.
- name: Smoke test built image (binaries)
run: |
set -euo pipefail
docker run --rm --entrypoint sh sencho:pr-test -c \
'docker --version && docker compose version && git --version'
# ---------------------------------------------------------------------------
# E2E Tests (PRs only, gated by change detection)
# ---------------------------------------------------------------------------
# Sharded across runners: each shard starts its own app and database, so the
# suite's single-worker constraint (shared DB state) holds within a shard
# while shards run in parallel. Playwright shards by whole file
# (fullyParallel is off), so serial groups stay intact. It does not wait on
# the backend job; building the backend here is cheaper than queueing behind
# the full unit-test run.
e2e:
name: E2E shard ${{ matrix.shard }}/4
runs-on: ubuntu-latest
# Backstop only. Each shard bounds itself with Playwright's `globalTimeout`
# (see playwright.config.ts), which fails the test step while the job is
# still alive to upload the report. This ceiling stays above that value so
# a cascading or wedged run produces evidence instead of a bare
# cancellation; a job cancelled by its own timeout runs no further steps.
timeout-minutes: 20
needs: changes
# Runs unless detection positively found no code: a failed detection job
# runs every gate instead of skipping them.
if: ${{ !cancelled() && needs.changes.outputs.code != 'false' }}
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Start app & install Playwright
uses: ./.github/actions/start-app
env:
NODE_EXTRA_CA_CERTS: ${{ github.workspace }}/e2e/fixtures/git-ca.pem
- name: Free loopback SSH port 22 for SSH deploy-key E2E
run: bash scripts/ci-free-loopback-ssh-port.sh 22
- name: Run E2E tests
# `--project=chromium` is explicit because playwright.config.ts also
# defines a `screenshots` project that captures docs/images/ for
# manual review. That project must not run in CI: its output would
# be discarded after the run, wasting minutes per PR. Keep this
# flag; do not "simplify" back to `npx playwright test`.
run: npx playwright test --project=chromium --shard=${{ matrix.shard }}/4
- name: Upload E2E report and service logs
# `cancelled()` covers a run stopped by the concurrency group, where
# GitHub re-evaluates conditions for the job's unfinished steps.
if: failure() || cancelled()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: playwright-report-shard-${{ matrix.shard }}
path: |
e2e/report/
test-results/
ci-logs/
retention-days: 7
# Single status for branch protection, which requires this exact job name.
# Passes when every shard passed, or E2E was skipped because change
# detection succeeded and found no code. A failed detection job fails this
# check so it cannot turn every gate into a silent skip.
e2e-result:
name: E2E Tests (Playwright)
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [changes, e2e]
if: always()
steps:
- name: Check shard results
env:
CHANGES: ${{ needs.changes.result }}
RESULT: ${{ needs.e2e.result }}
run: |
echo "Change detection: $CHANGES, E2E shards: $RESULT"
[ "$CHANGES" = success ] || exit 1
[ "$RESULT" = success ] || [ "$RESULT" = skipped ]
# ---------------------------------------------------------------------------
# Changelog Credit Script (PRs only, skipped for release-please PRs)
# ---------------------------------------------------------------------------
changelog-script:
name: Changelog credit script
runs-on: ubuntu-latest
timeout-minutes: 5
if: >-
github.event_name == 'pull_request'
&& github.head_ref != 'release-please--branches--main--components--sencho'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
with:
node-version-file: '.node-version'
- name: Validate workflows
uses: docker://rhysd/actionlint@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667 # v1.7.12
with:
args: .github/workflows/release-please.yml .github/workflows/ci.yml .github/workflows/pr-title.yml
- name: Syntax check
run: |
node --check scripts/credit-changelog-contributors.mjs
node --check scripts/release-notes-from-changelog.mjs
node --check scripts/audit-with-vex.mjs
node --check scripts/check-pr-title.mjs
- name: Unit tests
run: |
node --test scripts/credit-changelog-contributors.test.mjs
node --test scripts/release-notes-from-changelog.test.mjs
node --test scripts/audit-with-vex.test.mjs
node --test scripts/check-pr-title.test.mjs