CI: scan job for secrets (gitleaks), workflows (actionlint) and shell (shellcheck)
CI / Test (jest) (push) Successful in 16s
CI / Lint (eslint) (push) Successful in 17s
CI / Security (npm audit) (push) Successful in 10s
CI / Scan (secrets, workflows, shell) (push) Successful in 13s
CI / Integration (api) (push) Successful in 1m28s
CI / Lint (eslint) (pull_request) Successful in 13s
CI / Test (jest) (pull_request) Successful in 19s
CI / UI (playwright) (push) Successful in 1m43s
CI / Deploy (push) Skipped
CI / Security (npm audit) (pull_request) Successful in 8s
CI / Notify (push) Skipped
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 18s
CI / Integration (api) (pull_request) Successful in 1m30s
CI / UI (playwright) (pull_request) Successful in 1m48s
CI / Deploy (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / Test (jest) (push) Successful in 16s
CI / Lint (eslint) (push) Successful in 17s
CI / Security (npm audit) (push) Successful in 10s
CI / Scan (secrets, workflows, shell) (push) Successful in 13s
CI / Integration (api) (push) Successful in 1m28s
CI / Lint (eslint) (pull_request) Successful in 13s
CI / Test (jest) (pull_request) Successful in 19s
CI / UI (playwright) (push) Successful in 1m43s
CI / Deploy (push) Skipped
CI / Security (npm audit) (pull_request) Successful in 8s
CI / Notify (push) Skipped
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 18s
CI / Integration (api) (pull_request) Successful in 1m30s
CI / UI (playwright) (pull_request) Successful in 1m48s
CI / Deploy (pull_request) Skipped
CI / Notify (pull_request) Skipped
All three pass on main today: gitleaks found no leaks in 88 commits, and actionlint's one warning (an unused loop variable in the deploy health check) is fixed here. Tool downloads are pinned to a version and verified by SHA-256. Deploy now also waits for the scan. Part of #45 phase 4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4f32bd1363
commit
1f75a4a63a
2 files changed
+35
-7
No files matched your search
+31
-5
@@ -1,6 +1,6 @@
|
||||
name: CI
|
||||
|
||||
# One pipeline: lint, unit tests, audit, integration and UI tests must all pass before main deploys (#45).
|
||||
# One pipeline: lint, unit tests, audit, scans, integration and UI tests must all pass before main deploys (#45).
|
||||
# Actions are pinned to full commit SHAs (version in the trailing comment).
|
||||
|
||||
on:
|
||||
@@ -87,6 +87,32 @@ jobs:
|
||||
if: always()
|
||||
run: tail -n 200 .ui-stack/*.log || true
|
||||
|
||||
scan:
|
||||
name: Scan (secrets, workflows, shell)
|
||||
runs-on: ubuntu-latest
|
||||
container: node:20-bookworm
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
fetch-depth: 0 # gitleaks scans the whole history, not just this commit
|
||||
- name: Install scanners (pinned versions, verified checksums)
|
||||
run: |
|
||||
cd /tmp
|
||||
curl -fsSLo gitleaks.tgz https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz
|
||||
echo "551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb gitleaks.tgz" | sha256sum -c
|
||||
curl -fsSLo actionlint.tgz https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz
|
||||
echo "8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 actionlint.tgz" | sha256sum -c
|
||||
tar -xzf gitleaks.tgz -C /usr/local/bin gitleaks
|
||||
tar -xzf actionlint.tgz -C /usr/local/bin actionlint
|
||||
apt-get update -qq
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends shellcheck >/dev/null
|
||||
- name: Secrets in code and history (gitleaks)
|
||||
run: gitleaks git --no-banner --redact --exit-code 1 .
|
||||
- name: Workflow files (actionlint, with shellcheck on run scripts)
|
||||
run: actionlint .gitea/workflows/*.yml
|
||||
- name: Shell scripts (shellcheck)
|
||||
run: git ls-files -z '*.sh' | xargs -0 shellcheck
|
||||
|
||||
ui:
|
||||
name: UI (playwright)
|
||||
runs-on: ubuntu-latest
|
||||
@@ -125,7 +151,7 @@ jobs:
|
||||
deploy:
|
||||
name: Deploy
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test, audit, integration, ui]
|
||||
needs: [lint, test, audit, scan, integration, ui]
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
# Never run two deploys at once; queue instead of cancelling a deploy mid-way.
|
||||
concurrency:
|
||||
@@ -159,7 +185,7 @@ jobs:
|
||||
# this exact sha, runs npm ci and restarts, and rolls back if /healthz
|
||||
# never reports it. Succeed only when production reports this sha with
|
||||
# a working database (up to 4 minutes, covering npm ci).
|
||||
for i in $(seq 1 48); do
|
||||
for _ in $(seq 1 48); do
|
||||
body=$(curl -fsS --connect-timeout 5 --max-time 5 http://10.10.10.65:8080/healthz || true)
|
||||
if echo "$body" | grep -q "\"sha\":\"${GIT_SHA}\"" && echo "$body" | grep -q '"db":true'; then
|
||||
echo "Production is healthy on ${GIT_SHA}: ${body}"
|
||||
@@ -184,7 +210,7 @@ jobs:
|
||||
notify:
|
||||
name: Notify
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test, audit, integration, ui, deploy]
|
||||
needs: [lint, test, audit, scan, integration, ui, deploy]
|
||||
# Alert on any failure on main or in the weekly audit, and on every deploy outcome.
|
||||
if: >-
|
||||
always() && (
|
||||
@@ -198,7 +224,7 @@ jobs:
|
||||
REPO: ${{ github.repository }}
|
||||
BRANCH: ${{ github.ref_name }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
RESULTS: "lint=${{ needs.lint.result }} test=${{ needs.test.result }} audit=${{ needs.audit.result }} integration=${{ needs.integration.result }} ui=${{ needs.ui.result }} deploy=${{ needs.deploy.result }}"
|
||||
RESULTS: "lint=${{ needs.lint.result }} test=${{ needs.test.result }} audit=${{ needs.audit.result }} scan=${{ needs.scan.result }} integration=${{ needs.integration.result }} ui=${{ needs.ui.result }} deploy=${{ needs.deploy.result }}"
|
||||
DEPLOYED: ${{ needs.deploy.result == 'success' }}
|
||||
run: |
|
||||
if [ -z "$MATRIX_WEBHOOK_URL" ] || [ "$MATRIX_WEBHOOK_URL" = "CONFIGURE_ME" ]; then exit 0; fi
|
||||
|
||||
@@ -589,13 +589,15 @@ Everything runs from `.gitea/workflows/ci.yml`:
|
||||
| `Lint (eslint)` | `npm run lint`, plus a check that fails on em or en dashes in Pulse-owned files | Every push and PR |
|
||||
| `Test (jest)` | `npm test`: unit tests for `lib/` and the deploy-script sandbox tests | Every push and PR |
|
||||
| `Security (npm audit)` | `npm audit --audit-level=high` | Every push and PR, and weekly (Monday 06:00) |
|
||||
| `Scan (secrets, workflows, shell)` | gitleaks over the whole git history, actionlint on the workflow files (with shellcheck on their scripts), and shellcheck on every `*.sh` | Every push and PR |
|
||||
| `Integration (api)` | Starts the real server and three workers on Node 20 against MariaDB, then runs `tests/integration/` over HTTP and WebSocket: the Gandalf API contract, HTTP and WebSocket auth, and execution reliability (worker crash, capacity, abort) | Every push and PR |
|
||||
| `UI (playwright)` | Starts the real server and three workers against a MariaDB service container, then runs the Playwright tests in `tests/ui/` (desktop and phone) | Every push and PR |
|
||||
| `Deploy` | Calls the `pulse-deploy` webhook on CT 122, waits until `/healthz` reports the tested commit, then tags it `deploy-*` | Push to `main`, only after all five checks pass |
|
||||
| `Deploy` | Calls the `pulse-deploy` webhook on CT 122, waits until `/healthz` reports the tested commit, then tags it `deploy-*` | Push to `main`, only after all six checks pass |
|
||||
| `Notify` | Matrix alert on any failure on `main` or in the weekly audit, and on every deploy | As needed |
|
||||
|
||||
Branch protection on `main` requires `CI / Lint (eslint) (push)`, `CI / Test (jest) (push)`,
|
||||
`CI / Security (npm audit) (push)`, `CI / Integration (api) (push)` and `CI / UI (playwright) (push)`. Actions are pinned to commit
|
||||
`CI / Security (npm audit) (push)`, `CI / Scan (secrets, workflows, shell) (push)`,
|
||||
`CI / Integration (api) (push)` and `CI / UI (playwright) (push)`. Actions are pinned to commit
|
||||
SHAs and builds use `npm ci`. The plan for the rest of the pipeline is tracked in #45.
|
||||
|
||||
### Integration tests
|
||||
|
||||
Reference in new issue
Block a user