Skip to content

Commit 93ef5f0

Browse files
committed
Only run sqlc-vet when required by changes
1 parent 6ac0302 commit 93ef5f0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
ts: ${{ steps.filter.outputs.ts }}
3737
k8s: ${{ steps.filter.outputs.k8s }}
3838
ci: ${{ steps.filter.outputs.ci }}
39+
db: ${{ steps.filter.outputs.db }}
3940
offlinedocs-only: ${{ steps.filter.outputs.offlinedocs_count == steps.filter.outputs.all_count }}
4041
offlinedocs: ${{ steps.filter.outputs.offlinedocs }}
4142
steps:
@@ -57,6 +58,12 @@ jobs:
5758
- "examples/web-server/**"
5859
- "examples/monitoring/**"
5960
- "examples/lima/**"
61+
db:
62+
- "**.sql"
63+
- "coderd/database/queries/**"
64+
- "coderd/database/migrations"
65+
- "coderd/database/sqlc.yaml"
66+
- "coderd/database/dump.sql"
6067
go:
6168
- "**.sql"
6269
- "**.go"
@@ -315,7 +322,7 @@ jobs:
315322

316323
test-go-pg:
317324
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
318-
needs: sqlc-vet
325+
needs: changes
319326
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
320327
# This timeout must be greater than the timeout set by `go test` in
321328
# `make test-postgres` to ensure we receive a trace of running
@@ -915,8 +922,7 @@ jobs:
915922
sqlc-vet:
916923
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
917924
needs: changes
918-
# TODO: We should do this on any migration or query changes.
919-
# if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
925+
if: needs.changes.outputs.db == 'true' || github.ref == 'refs/heads/main'
920926
steps:
921927
- name: Checkout
922928
uses: actions/checkout@v4

0 commit comments

Comments
 (0)