Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcc58690

Browse files
committed
add sqlc push action on releases
1 parente52d848 commitcc58690

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

‎.github/workflows/release.yaml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,3 +542,27 @@ jobs:
542542
CHOCO_API_KEY:${{ secrets.CHOCO_API_KEY }}
543543
# We need a GitHub token for the gh CLI to function under GitHub Actions
544544
GH_TOKEN:${{ secrets.CDRCI_GITHUB_TOKEN }}
545+
546+
# publish-sqlc pushes the latest schema to sqlc cloud.
547+
# At present these pushes cannot be tagged, so the last push is always the latest.
548+
publish-sqlc:
549+
name:"Publish to schema sqlc cloud"
550+
runs-on:'ubuntu-latest'
551+
needs:release
552+
if:${{ !inputs.dry_run }}
553+
steps:
554+
-name:Checkout
555+
uses:actions/checkout@v4
556+
with:
557+
fetch-depth:1
558+
559+
# We need golang to run the migration main.go
560+
-name:Setup Go
561+
uses:./.github/actions/setup-go
562+
563+
-name:Setup sqlc
564+
uses:./.github/actions/setup-sqlc
565+
566+
-name:Push schema to sqlc cloud
567+
run:|
568+
make sqlc-push

‎Makefile‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,27 @@ test:
708708
gotestsum --format standard-quiet -- -v -short -count=1 ./...
709709
.PHONY: test
710710

711+
# sqlc-cloud-is-setup will fail if no SQLc auth token is set. Use this as a
712+
# dependency for any sqlc-cloud related targets.
713+
sqlc-cloud-is-setup:
714+
if [["$(SQLC_AUTH_TOKEN)"=="" ]];then
715+
echo"ERROR: 'SQLC_AUTH_TOKEN' must be set to auth with sqlc cloud before running verify."1>&2
716+
exit 1
717+
fi
718+
.PHONY: sqlc-cloud-is-setup
719+
720+
sqlc-push: sqlc-cloud-is-setup test-postgres-docker
721+
echo"--- sqlc push"
722+
SQLC_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/$(shell go run scripts/migrate-ci/main.go)"\
723+
sqlc push -f coderd/database/sqlc.yaml&&echo"Passed sqlc push"
724+
.PHONY: sqlc-push
725+
726+
sqlc-verify: sqlc-cloud-is-setup test-postgres-docker
727+
echo"--- sqlc verify"
728+
SQLC_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/$(shell go run scripts/migrate-ci/main.go)"\
729+
sqlc verify -f coderd/database/sqlc.yaml&&echo"Passed sqlc verify"
730+
.PHONY: sqlc-verify
731+
711732
sqlc-vet: test-postgres-docker
712733
echo"--- sqlc vet"
713734
SQLC_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/$(shell go run scripts/migrate-ci/main.go)"\

‎coderd/database/sqlc.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# It was chosen to ensure type-safety when interacting with
33
# the database.
44
version:"2"
5+
cloud:
6+
# This is the static ID for the coder project.
7+
project:'01HEP08N3WKWRFZT3ZZ9Q37J8X'
58
# Ideally renames & overrides would go under the sql section, but there is a
69
# bug in sqlc that only global renames & overrides are currently being applied.
710
overrides:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp