Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,29 @@ env:
GO_VERSION: 1.20.3

jobs:
########################
# SQLC code gen check
########################
sqlc-check:
name: Sqlc check
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3

- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'

- name: docker image cache
uses: satackey/action-docker-layer-caching@v0.0.11
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true

- name: Generate sql models
run: make sqlc-check

########################
# RPC and mobile compilation check
########################
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,14 @@ list:
grep -v Makefile | \
sort

sqlc:
@$(call print, "Generating sql models and queries in Go")
./scripts/gen_sqlc_docker.sh

sqlc-check: sqlc
@$(call print, "Verifying sql code generation.")
if test -n "$$(git status --porcelain '*.go')"; then echo "SQL models not properly generated!"; git status --porcelain '*.go'; exit 1; fi

rpc:
@$(call print, "Compiling protos.")
cd ./lnrpc; ./gen_protos_docker.sh
Expand Down
3 changes: 3 additions & 0 deletions docs/release-notes/release-notes-0.17.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
implementation](https://github.com/lightningnetwork/lnd/pull/7377) logic in
different update types.

* Add [invoice SQL schema and
queries](https://github.com/lightningnetwork/lnd/pull/7354)

## Watchtowers

* Let the task pipeline [only carry
Expand Down
19 changes: 19 additions & 0 deletions scripts/gen_sqlc_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e

# Directory of the script file, independent of where it's called from.
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
# Use the user's cache directories
GOCACHE=`go env GOCACHE`
GOMODCACHE=`go env GOMODCACHE`

echo "Generating sql models and queries in go..."

docker run \
--rm \
--user "$UID:$(id -g)" \
-e UID=$UID \
-v "$DIR/../:/build" \
-w /build \
kjconroy/sqlc:1.18.0 generate
10 changes: 10 additions & 0 deletions sqlc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "2"
sql:
- engine: "postgresql"
Comment thread
positiveblue marked this conversation as resolved.
Outdated
schema: "sqldb/sqlc/migrations"
queries: "sqldb/sqlc/queries"
gen:
go:
out: sqldb/sqlc
package: sqlc
emit_interface: true
Loading