Repository navigation
157 lines (124 loc) · 4.29 KB
/
Copy pathbuild.yml
File metadata and controls
157 lines (124 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Build
defaults:
run:
shell: bash
permissions:
contents: read
concurrency:
group: build-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
on:
workflow_call: # the Release workflow runs the full gate on the exact commit it releases
push:
branches: [ "main" ]
pull_request:
branches: [ "*" ]
paths:
- "**"
- "!**.md"
jobs:
build-wasm:
name: Build (WASM)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
# the plugin (pure Ruby) + the prebuilt ruby.wasm interpreter, packed into one self-contained module
- name: Build WASM plugin
run: ./scripts/wasm/build.sh
- name: upload wasm plugin as artifact
uses: actions/upload-artifact@v7
with:
name: wasm-file
path: dist/plugin.wasm
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Ruby syntax and warnings (plugin and scripts)
run: |
set -e
for file in $(git ls-files '*.rb' ':!examples' ':!test/golden'); do
ruby -wc "${file}" > /dev/null
done
# the code generated into examples/ has to stay RuboCop-clean
- name: RuboCop (generated code)
run: bundle exec rake rubocop
codegen-tests:
name: Codegen Tests
needs: [build-wasm]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- name: Load tool versions
run: grep -E '^[A-Z_]+=' scripts/tool-versions.env >> "$GITHUB_ENV"
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- uses: sqlc-dev/setup-sqlc@v5
with:
sqlc-version: '${{ env.SQLC_VERSION }}'
- uses: actions/download-artifact@v8
with:
name: wasm-file
path: dist
- name: Updating plugin sha
run: ./scripts/wasm/update_sha.sh sqlc.ci.yaml
# examples/ is the plugin's output for examples/authors: it must be committed in sync with the plugin
- name: Verify pushed generated code is synced (WASM plugin)
run: sqlc -f sqlc.ci.yaml diff
- name: Verify pushed generated code is synced (process plugin)
run: sqlc -f sqlc.local.yaml diff
- name: Steep check
run: bundle exec rake steep
codegen-options:
name: Codegen Options (ruby ${{ matrix.ruby-version }}, types=${{ matrix.generate-types }}, gemfile=${{ matrix.generate-gemfile }})
needs: [build-wasm]
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- { ruby-version: '3.1', generate-types: 'true', generate-gemfile: 'true' }
- { ruby-version: '3.2', generate-types: 'false', generate-gemfile: 'false' }
- { ruby-version: '3.3', generate-types: 'true', generate-gemfile: 'false' }
- { ruby-version: '3.3', generate-types: 'false', generate-gemfile: 'true' }
- { ruby-version: '4.0', generate-types: 'true', generate-gemfile: 'true' }
steps:
- uses: actions/checkout@v7
- name: Load tool versions
run: grep -E '^[A-Z_]+=' scripts/tool-versions.env >> "$GITHUB_ENV"
# the generated code for rubyVersion X is checked with a Ruby X interpreter
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- uses: sqlc-dev/setup-sqlc@v5
with:
sqlc-version: '${{ env.SQLC_VERSION }}'
- uses: actions/download-artifact@v8
with:
name: wasm-file
path: dist
- name: Updating plugin sha
run: ./scripts/wasm/update_sha.sh sqlc.ci.yaml
- name: Generate with these options and check the output
run: >-
./scripts/tests/run_codegen.rb sqlc.ci.yaml
"${{ matrix.ruby-version }}" ${{ matrix.generate-types }} ${{ matrix.generate-gemfile }}
cross-platform:
name: Cross-platform
needs: [build-wasm]
uses: ./.github/workflows/cross-platform.yml