-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add CI worfklow and example test
- Loading branch information
1 parent
8931d51
commit db6edb7
Showing
9 changed files
with
199 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: go | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
jobs: | ||
test: | ||
name: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
- run: make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
*.wasm | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
all: sqlc-gen-go sqlc-gen-go.wasm | ||
.PHONY: build test | ||
|
||
sqlc-gen-go: | ||
cd plugin && go build -o ~/bin/sqlc-gen-go ./main.go | ||
build: | ||
go build ./... | ||
|
||
sqlc-gen-go.wasm: | ||
cd plugin && GOOS=wasip1 GOARCH=wasm go build -o sqlc-gen-go.wasm main.go | ||
openssl sha256 plugin/sqlc-gen-go.wasm | ||
test: bin/sqlc-gen-go.wasm | ||
go test ./... | ||
|
||
all: bin/sqlc-gen-go bin/sqlc-gen-go.wasm | ||
|
||
bin/sqlc-gen-go: bin go.mod go.sum $(wildcard **/*.go) | ||
cd plugin && go build -o ../bin/sqlc-gen-go ./main.go | ||
|
||
bin/sqlc-gen-go.wasm: bin/sqlc-gen-go | ||
cd plugin && GOOS=wasip1 GOARCH=wasm go build -o ../bin/sqlc-gen-go.wasm main.go | ||
|
||
bin: | ||
mkdir -p bin |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-- name: GetAuthor :one | ||
SELECT * FROM authors | ||
WHERE id = $1 LIMIT 1; | ||
|
||
-- name: ListAuthors :many | ||
SELECT * FROM authors | ||
ORDER BY name; | ||
|
||
-- name: CreateAuthor :one | ||
INSERT INTO authors ( | ||
name, bio | ||
) VALUES ( | ||
$1, $2 | ||
) | ||
RETURNING *; | ||
|
||
-- name: DeleteAuthor :exec | ||
DELETE FROM authors | ||
WHERE id = $1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CREATE TABLE authors ( | ||
id BIGSERIAL PRIMARY KEY, | ||
name text NOT NULL, | ||
bio text | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: '2' | ||
plugins: | ||
- name: golang | ||
wasm: | ||
url: file://../../../../bin/sqlc-gen-go.wasm | ||
sql: | ||
- schema: schema.sql | ||
queries: query.sql | ||
engine: postgresql | ||
codegen: | ||
- plugin: golang | ||
out: go | ||
options: | ||
package: querytest | ||
sql_package: pgx/v5 |