Skip to content

Commit 9d71eaa

Browse files
committed
fix: restructure CLI CI workflows for strict checks
1 parent 06254f9 commit 9d71eaa

4 files changed

Lines changed: 123 additions & 26 deletions

File tree

‎.github/workflows/_go-checks.yaml‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Reusable Go Checks
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
runner:
7+
description: Cirrus runner image
8+
required: false
9+
default: ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm
10+
type: string
11+
12+
jobs:
13+
quality:
14+
runs-on: ${{ inputs.runner }}
15+
timeout-minutes: 35
16+
permissions:
17+
contents: read
18+
steps:
19+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
20+
21+
- name: Setup Hermit
22+
uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1
23+
with:
24+
cache: "true"
25+
26+
- name: Run quality gate (fmt, lint, unit tests)
27+
run: task do
28+
29+
- name: Verify generated code is up to date (offline checks)
30+
run: |
31+
set -euo pipefail
32+
33+
# Regenerate API client from committed schema snapshot.
34+
(cd internal/api/gen && go run github.com/Khan/genqlient)
35+
36+
# Regenerate SQLite reflection/sqlc artifacts from embedded schema snapshot.
37+
go generate ./internal/sqlite
38+
39+
if [ -n "$(git status --porcelain)" ]; then
40+
echo "Generated artifacts are out of date. Run generation locally and commit results."
41+
git status --short
42+
git diff
43+
exit 1
44+
fi
45+
46+
powersync-replay:
47+
runs-on: ${{ inputs.runner }}
48+
timeout-minutes: 20
49+
permissions:
50+
contents: read
51+
steps:
52+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
53+
54+
- name: Setup Hermit
55+
uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1
56+
with:
57+
cache: "true"
58+
59+
- name: Run PowerSync replay correctness test
60+
run: task test:correctness:powersync-replay

‎.github/workflows/ci.yaml‎

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,23 @@
1-
---
2-
name: ci
1+
name: CI
32

43
on:
5-
pull_request:
64
push:
7-
branches:
8-
- main
9-
10-
permissions:
11-
contents: read
5+
branches: [master]
6+
workflow_dispatch:
127

138
concurrency:
14-
group: ci-${{ github.workflow }}-${{ github.ref }}
15-
cancel-in-progress: true
9+
group: ci-${{ github.sha }}
10+
cancel-in-progress: false
1611

1712
jobs:
18-
test:
19-
runs-on: ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm
20-
timeout-minutes: 30
21-
13+
check:
14+
uses: ./.github/workflows/_go-checks.yaml
15+
secrets: inherit
16+
17+
gate:
18+
needs: [check]
19+
if: ${{ !failure() && !cancelled() }}
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 1
2222
steps:
23-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
24-
25-
- name: Setup Hermit
26-
uses: cashapp/activate-hermit@e49f5cb4dd64ff0b0b659d1d8df499595451155a # v1
27-
with:
28-
cache: "true"
29-
30-
- name: Run Unit Tests (Task + Hermit)
31-
run: task test
32-
33-
- name: Run PowerSync Replay Correctness Test
34-
run: task test:correctness:powersync-replay
23+
- run: echo "Push checks passed"

‎.github/workflows/pr-ci.yaml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: PR CI
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: pr-ci-${{ github.event.pull_request.number || github.sha }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
check:
14+
uses: ./.github/workflows/_go-checks.yaml
15+
secrets: inherit
16+
17+
gate:
18+
needs: [check]
19+
if: ${{ !failure() && !cancelled() }}
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 1
22+
steps:
23+
- run: echo "PR checks passed"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Workflow Lint
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
paths:
7+
- .github/workflows/**
8+
- .github/actions/**
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: workflow-lint-${{ github.event.pull_request.number || github.sha }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
actionlint:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 5
19+
steps:
20+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
21+
22+
- name: Run actionlint
23+
uses: reviewdog/action-actionlint@f45e6423f07e6ea6fce879bbdb0d74407c1fbf55 # v1
24+
with:
25+
fail_level: any

0 commit comments

Comments
 (0)