Skip to content

Commit 70053b1

Browse files
1. verify sqlc generated code is up to date (sqlc diff) (#42)
tmp
1 parent 0f5288b commit 70053b1

File tree

10 files changed

+210
-84
lines changed

10 files changed

+210
-84
lines changed

.github/workflows/main.yml

+21-11
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,16 @@ jobs:
5353
uses: xom9ikk/[email protected]
5454
with:
5555
load-mode: strict
56-
- name: Setup dotnet ${{ matrix.dotnet-version }}
56+
57+
- name: Setup Dotnet ${{ matrix.dotnet-version }}
5758
uses: actions/setup-dotnet@v3
5859
with:
5960
dotnet-version: ${{ matrix.dotnet-version }}
60-
- name: install wasm workload
61+
62+
- name: install Wasi workload
6163
run: dotnet workload install wasi-experimental
62-
- name: Download WASI SDK on Ubuntu
64+
65+
- name: Download Wasi SDK on Ubuntu
6366
if: runner.os == 'Linux'
6467
run: |
6568
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0-linux.tar.gz
@@ -71,24 +74,31 @@ jobs:
7174
# curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0.m-mingw.tar.gz
7275
# tar xf wasi-sdk-22.0.m-mingw.tar.gz -C wasi-sdk-22.0
7376
# chmod -R 755 wasi-sdk-22.0
74-
- name: dotnet publish and build
75-
run: WASI_SDK_PATH="$(pwd)/wasi-sdk-22.0" dotnet publish SqlcGenCsharpWasm -c release
77+
78+
- name: Dotnet Wasm Publish
79+
run: |
80+
WASI_SDK_PATH="$(pwd)/wasi-sdk-22.0" dotnet publish SqlcGenCsharpWasm -c release
81+
./scripts/wasm/copy_to_dist.sh
82+
./scripts/wasm/update_sha.sh
83+
7684
- uses: sqlc-dev/setup-sqlc@v4
7785
with:
7886
sqlc-version: '1.25.0'
79-
- name: run update sha256 for builded wasm
80-
run: |
81-
chmod +x ./scripts/update_wasm_plugin.sh
82-
./scripts/update_wasm_plugin.sh
83-
- name: run sqlc with generated wasm plugin
87+
88+
- name: Verify pushed generated code is up to date
89+
run: sqlc -f sqlc.wasm.yaml diff
90+
91+
- name: Sqlc generate using Wasm plugin
8492
run: sqlc -f sqlc.wasm.yaml generate
93+
8594
- uses: hoverkraft-tech/[email protected]
8695
with:
8796
services: |
8897
mysqldb
8998
postgresdb
9099
plugin-tests
91-
- name: test dotnet output project
100+
101+
- name: Test generated code
92102
run: |
93103
chmod +x ./scripts/run_tests.sh
94104
./scripts/run_tests.sh

CodeGenerator/CodeGenerator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private static CompilationUnitSyntax AddResharperDisables(CompilationUnitSyntax
169169
private ClassDeclarationSyntax GetClassDeclaration(string className,
170170
IEnumerable<MemberDeclarationSyntax> classMembers)
171171
{
172-
var classDeclaration = (ClassDeclarationSyntax)(Options.DotnetFramework == DotnetFramework.DotnetStandard21
172+
var classDeclaration = (ClassDeclarationSyntax)(Options.DotnetFramework.LatestDotnetSupported()
173173
? GetWithPrimaryConstructor()
174174
: GetWithRegularConstructor());
175175
return classDeclaration.AddMembers(classMembers.ToArray());

0 commit comments

Comments
 (0)