25
25
uses : actions/checkout@v3
26
26
27
27
- name : Set up .NET
28
- uses : actions/setup-dotnet@v1
28
+ uses : actions/setup-dotnet@v3
29
29
with :
30
30
dotnet-version : " 8.0.x"
31
31
@@ -38,12 +38,16 @@ jobs:
38
38
GeneratedProtobuf
39
39
MySqlConnectorExample
40
40
NpgsqlExample
41
-
41
+
42
+ - name : Verify pushed Dockerfile is synced
43
+ run : |
44
+ ./scripts/generate_dockerfile.sh /tmp/Dockerfile
45
+ diff /tmp/Dockerfile Dockerfile
42
46
43
- ci :
44
- name : CI
47
+ build :
48
+ name : Build & Generate
45
49
runs-on : ${{ matrix.os }}
46
- if : ${{ always() }}
50
+ needs : [lint]
47
51
strategy :
48
52
matrix :
49
53
os : [ 'ubuntu-latest' ]
82
86
- name : Dotnet Wasm Publish
83
87
run : |
84
88
WASI_SDK_PATH="$(pwd)/wasi-sdk-22.0" dotnet publish WasmRunner -c release
85
- ./scripts/wasm/copy_to_dist.sh
86
- ./scripts/wasm/update_sha.sh
87
-
88
- - name : Verify pushed Dockerfile is synced
89
- run : |
90
- ./scripts/generate_dockerfile.sh /tmp/Dockerfile
91
- diff /tmp/Dockerfile Dockerfile
89
+ ./scripts/wasm/copy_plugin_to.sh dist
92
90
93
91
- uses : sqlc-dev/setup-sqlc@v4
94
92
with :
@@ -97,42 +95,64 @@ jobs:
97
95
- name : Updating configuration
98
96
env :
99
97
FILE_PER_QUERY : ${{ matrix.file-per-query }}
100
- run : ./scripts/update_config.sh $FILE_PER_QUERY
101
-
102
- - name : Verify pushed generated code is synced
103
- if : matrix.file-per-query == 'false'
104
- run : sqlc -f sqlc.wasm.yaml diff
98
+ run : |
99
+ ./scripts/wasm/update_sha.sh sqlc.ci.yaml
100
+ ./scripts/update_config.sh sqlc.ci.yaml $FILE_PER_QUERY
105
101
106
102
- name : Sqlc generate using Wasm plugin
107
103
run : |
108
104
rm MySqlConnectorExample/*.cs NpgsqlExample/*.cs
109
- sqlc -f sqlc.wasm.yaml generate
105
+ sqlc -f sqlc.ci.yaml generate
106
+
107
+ - name : upload wasm plugin as artifact
108
+ if : matrix.file-per-query == 'false' && matrix.architecture == 'arm64'
109
+ uses : actions/upload-artifact@v4
110
+ with :
111
+ name : wasm-file
112
+ path : dist/plugin.wasm
113
+
114
+ test :
115
+ name : Test
116
+ runs-on : ubuntu-latest
117
+ needs : [build]
110
118
119
+ steps :
120
+ - uses : actions/checkout@v4
121
+ - uses : actions/download-artifact@v4
122
+ with :
123
+ name : wasm-file
124
+ path : dist
125
+
126
+ - uses : sqlc-dev/setup-sqlc@v4
127
+ with :
128
+ sqlc-version : ' 1.25.0'
129
+
130
+ - name : Verify pushed generated code is synced
131
+ run : |
132
+ ./scripts/wasm/update_sha.sh sqlc.ci.yaml
133
+ sqlc -f sqlc.ci.yaml diff
134
+
111
135
- name : Docker compose
112
- if : matrix.file-per-query == 'false'
113
136
uses :
hoverkraft-tech/[email protected]
114
137
with :
115
138
services : |
116
139
mysqldb
117
140
postgresdb
118
141
plugin-tests
119
-
142
+
143
+ - name : Load .env file
144
+
145
+ with :
146
+ load-mode : strict
147
+
120
148
- name : Test generated code
121
- if : matrix.file-per-query == 'false'
122
149
run : ./scripts/run_tests.sh
123
-
124
- - name : upload wasm plugin as artifact
125
- uses : actions/upload-artifact@v2
126
- if : github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[release]')
127
- with :
128
- name : wasm-file
129
- path : dist/plugin.wasm
130
-
150
+
131
151
release :
132
152
name : Release
133
153
runs-on : ubuntu-latest
134
154
if : github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[release]')
135
- needs : [ci ]
155
+ needs : [build, test ]
136
156
steps :
137
157
- name : Check out Git repository
138
158
uses : actions/checkout@v4
@@ -142,7 +162,7 @@ jobs:
142
162
- uses : actions/download-artifact@v2
143
163
with :
144
164
name : wasm-file
145
-
165
+
146
166
- name : Bump version and create new tag
147
167
id : bump_version
148
168
run : |
0 commit comments