1+ name : Build
2+ defaults :
3+ run :
4+ shell : bash
5+
6+ env :
7+ SQLC_VERSION : 1.27.0
8+ WASI_SDK_VERSION : 22
9+
10+ on :
11+ push :
12+ branches : [ "main" ]
13+ pull_request :
14+ branches : [ "*" ]
15+ paths :
16+ - " **"
17+ - " !**.md"
18+
19+ jobs :
20+ lint :
21+ name : Lint
22+ runs-on : ubuntu-latest
23+
24+ steps :
25+ - name : Check out Git repository
26+ uses : actions/checkout@v4
27+
28+ - name : Set up .NET
29+ uses : actions/setup-dotnet@v4
30+ with :
31+ dotnet-version : " 8.0.x"
32+
33+ - name : .NET Lint
34+ uses : zyactions/dotnet-lint@v1
35+ with :
36+ implicit-restore : true
37+ workspace : sqlc-gen-csharp.sln
38+ exclude : |
39+ GeneratedProtobuf
40+ examples
41+
42+ build-wasm :
43+ name : Build (WASM)
44+ needs : [lint]
45+ runs-on : ubuntu-latest
46+
47+ steps :
48+ - uses : actions/checkout@v4
49+
50+ - name : Load .env file
51+ 52+ with :
53+ load-mode : strict
54+
55+ - name : Setup Dotnet
56+ uses : actions/setup-dotnet@v4
57+ with :
58+ dotnet-version : ' 8.0.x'
59+
60+ - name : install Wasi workload
61+ run : dotnet workload install wasi-experimental
62+
63+ - name : Setup Derived Variables
64+ run : |
65+ echo "WASI_SDK_FOLDER_NAME=wasi-sdk-${{ env.WASI_SDK_VERSION }}.0" >> $GITHUB_ENV
66+ echo "WASI_SDK_FILENAME=wasi-sdk-${{ env.WASI_SDK_VERSION }}.0-linux.tar.gz" >> $GITHUB_ENV
67+
68+ - name : Download Wasi SDK
69+ run : |
70+ wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{ env.WASI_SDK_VERSION }}/${{ env.WASI_SDK_FILENAME }}
71+ tar xf ${{ env.WASI_SDK_FILENAME }}
72+ chmod -R 755 ${{ env.WASI_SDK_FILENAME }}
73+
74+ - name : Dotnet Wasm Publish
75+ shell : bash
76+ run : |
77+ set -e
78+ WASI_SDK_PATH="$(pwd)/${{ env.WASI_SDK_FOLDER_NAME }}" dotnet publish WasmRunner -c release
79+ ./scripts/wasm/copy_plugin_to.sh dist
80+
81+ - name : upload wasm plugin as artifact
82+ uses : actions/upload-artifact@v4
83+ with :
84+ name : wasm-file
85+ path : dist/plugin.wasm
86+
87+ codegen-tests :
88+ name : Codegen Tests
89+ runs-on : ubuntu-latest
90+ needs : [build-wasm]
91+
92+ steps :
93+ - uses : actions/checkout@v4
94+
95+ - uses : actions/download-artifact@v4
96+ with :
97+ name : wasm-file
98+ path : dist
99+
100+ - name : Load .env file
101+ 102+ with :
103+ load-mode : strict
104+
105+ - uses : sqlc-dev/setup-sqlc@v4
106+ with :
107+ sqlc-version : ' ${{ env.SQLC_VERSION }}'
108+
109+ - name : Updating plugin sha
110+ run : ./scripts/wasm/update_sha.sh sqlc.ci.yaml
111+
112+ - name : Verify pushed generated code is synced
113+ run : |
114+ ./scripts/wasm/update_sha.sh sqlc.ci.yaml
115+ sqlc -f sqlc.ci.yaml diff
0 commit comments