-
Notifications
You must be signed in to change notification settings - Fork 80
234 lines (233 loc) · 9.14 KB
/
Copy pathpr_test.yml
File metadata and controls
234 lines (233 loc) · 9.14 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: Test
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
branches:
- main
permissions:
contents: read
# Stop any in-flight CI jobs when a new commit is pushed.
concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true
env:
GO_VERSION: 1.26.x
GOLANGCI_LINT_VERSION: v2.9
WASI_SDK_VERSION: 25
WASI_SDK_FULL_VERSION: "25.0"
jobs:
changelog:
name: Enforce changelog entry
if: github.event.pull_request.user.login != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: dangoslen/changelog-enforcer@8b5e9dc3121363bb7c0115f8533404d92af382de # v3.7.0
lint:
name: Lint (pinned golangci-lint version)
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
only-new-issues: true
test:
name: Test (${{ matrix.platform }})
strategy:
matrix:
tinygo-version: [0.31.2]
go-version: [1.26.x]
node-version: [18]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: "Checkout code"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Install Go"
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go-version }}
# IMPORTANT: Disable caching to prevent cache restore errors later.
cache: false
- uses: acifani/setup-tinygo@f51bf108c9895381060398804ce6cf6f62692106 # v3.0.1
with:
tinygo-version: ${{ matrix.tinygo-version }}
- name: "Install Rust"
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
with:
toolchain: stable
target: wasm32-wasip1
cache: false
rustflags: ""
- name: "Validate Rust toolchain"
run: rustup show && rustup target list --installed --toolchain stable
shell: bash
- name: "Install Node"
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.node-version }}
- name: "Install uv"
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
- name: "Install WASI SDK"
run: |
wget -q "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_FULL_VERSION}-x86_64-linux.tar.gz"
tar xzf "wasi-sdk-${WASI_SDK_FULL_VERSION}-x86_64-linux.tar.gz"
echo "$(pwd)/wasi-sdk-${WASI_SDK_FULL_VERSION}-x86_64-linux/bin" >> "$GITHUB_PATH"
shell: bash
- name: "Modify git cloned repo files 'modified' times"
run: go run ./scripts/go-test-cache/main.go
- name: "Test suite"
run: make test
shell: bash
env:
# NOTE: The following lets us focus the test run while debugging.
# TEST_ARGS: "-run TestBuild ./pkg/commands/compute/..."
TEST_COMPUTE_INIT: true
TEST_COMPUTE_BUILD: true
TEST_COMPUTE_DEPLOY: true
test-release:
name: Test release (${{ matrix.platform }})
if: contains(github.head_ref, 'release')
strategy:
matrix:
tinygo-version: [0.31.2]
go-version: [1.26.x]
node-version: [18]
platform: [macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: "Checkout code"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Install Go"
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go-version }}
# IMPORTANT: Disable caching to prevent cache restore errors later.
cache: false
- uses: acifani/setup-tinygo@f51bf108c9895381060398804ce6cf6f62692106 # v3.0.1
with:
tinygo-version: ${{ matrix.tinygo-version }}
- name: "Install Rust"
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
with:
toolchain: stable
target: wasm32-wasip1
cache: false
rustflags: ""
- name: "Validate Rust toolchain"
run: rustup show && rustup target list --installed --toolchain stable
shell: bash
- name: "Install Node"
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.node-version }}
- name: "Install uv"
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
- name: "Install WASI SDK (Ubuntu)"
if: matrix.platform == 'ubuntu-latest'
run: |
wget -q "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_FULL_VERSION}-x86_64-linux.tar.gz"
tar xzf "wasi-sdk-${WASI_SDK_FULL_VERSION}-x86_64-linux.tar.gz"
echo "$(pwd)/wasi-sdk-${WASI_SDK_FULL_VERSION}-x86_64-linux/bin" >> "$GITHUB_PATH"
shell: bash
- name: "Install WASI SDK (macOS)"
if: matrix.platform == 'macos-latest'
run: |
wget -q "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_FULL_VERSION}-arm64-macos.tar.gz"
tar xzf "wasi-sdk-${WASI_SDK_FULL_VERSION}-arm64-macos.tar.gz"
echo "$(pwd)/wasi-sdk-${WASI_SDK_FULL_VERSION}-arm64-macos/bin" >> "$GITHUB_PATH"
shell: bash
- name: "Install WASI SDK (Windows)"
if: matrix.platform == 'windows-latest'
run: |
Invoke-WebRequest -Uri "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${env:WASI_SDK_VERSION}/wasi-sdk-${env:WASI_SDK_FULL_VERSION}-x86_64-windows.tar.gz" -OutFile "wasi-sdk.tar.gz"
tar -xzf wasi-sdk.tar.gz
echo "$PWD/wasi-sdk-${env:WASI_SDK_FULL_VERSION}-x86_64-windows/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh
- name: "Modify git cloned repo files 'modified' times"
run: go run ./scripts/go-test-cache/main.go
- name: "Test suite"
run: make test
shell: bash
env:
# NOTE: The following lets us focus the test run while debugging.
# TEST_ARGS: "-run TestBuild ./pkg/commands/compute/..."
TEST_COMPUTE_INIT: true
TEST_COMPUTE_BUILD: true
TEST_COMPUTE_DEPLOY: true
docker-builds:
name: Build docker images
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Build docker images
run: |
for dockerFile in Dockerfile*; do docker build -f $dockerFile . ; done
tools-build:
name: "goreleaser tools build"
if: contains(github.event.pull_request.labels.*.name, 'tools')
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Install Go"
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: tools/go.mod
- name: "Test goreleaser tools build"
run: go tool -modfile=tools/go.mod goreleaser build --single-target --snapshot --skip=post-hooks --skip=validate
golangci-latest:
name: lint-latest (informational)
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ env.GO_VERSION }}
- name: Run golangci-lint@latest
id: lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: latest
only-new-issues: true
continue-on-error: true
- name: Report lint summary
env:
LINT_OUTCOME: ${{ steps.lint.outcome }}
run: |
if [ "$LINT_OUTCOME" = "success" ]; then
echo "✅ golangci-lint@latest passed." >> "$GITHUB_STEP_SUMMARY"
else
echo "⚠️ golangci-lint@latest failed (informational only)." >> "$GITHUB_STEP_SUMMARY"
fi