Skip to content

Commit 973a21d

Browse files
authored
Merge pull request #247 from jongio/patrol/ci-workflow-fixes
ci: workflow and pipeline improvements
2 parents 8f23582 + 96d2c43 commit 973a21d

4 files changed

Lines changed: 88 additions & 113 deletions

File tree

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,15 @@ updates:
1212
interval: "weekly"
1313
commit-message:
1414
prefix: "ci"
15+
- package-ecosystem: "npm"
16+
directory: "/cli/dashboard"
17+
schedule:
18+
interval: "weekly"
19+
commit-message:
20+
prefix: "deps"
21+
- package-ecosystem: "npm"
22+
directory: "/web"
23+
schedule:
24+
interval: "weekly"
25+
commit-message:
26+
prefix: "deps"

.github/workflows/ci.yml

Lines changed: 67 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: CI
22

33
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'cli/**'
8+
- '.github/workflows/ci.yml'
49
pull_request:
510
branches: [ main ]
611
paths:
@@ -53,19 +58,19 @@ jobs:
5358
version: 9
5459

5560
- name: Install Mage
56-
run: go install github.com/magefile/mage@latest
61+
run: go install github.com/magefile/mage@v1.15.0
5762

5863
- name: Install golangci-lint
59-
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
64+
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
6065

6166
- name: Install staticcheck
62-
run: go install honnef.co/go/tools/cmd/staticcheck@latest
67+
run: go install honnef.co/go/tools/cmd/staticcheck@v0.6.1
6368

6469
- name: Install gosec
65-
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
70+
run: go install github.com/securego/gosec/v2/cmd/gosec@v2.22.4
6671

6772
- name: Install govulncheck
68-
run: go install golang.org/x/vuln/cmd/govulncheck@latest
73+
run: go install golang.org/x/vuln/cmd/govulncheck@v1.1.4
6974

7075
- name: Install Azure Developer CLI (azd)
7176
run: curl -fsSL https://aka.ms/install-azd.sh | bash
@@ -75,9 +80,41 @@ jobs:
7580
env:
7681
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7782

83+
dashboard:
84+
name: Build Dashboard
85+
runs-on: ubuntu-latest
86+
timeout-minutes: 10
87+
steps:
88+
- name: Checkout code
89+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
90+
91+
- name: Set up Node.js
92+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
93+
with:
94+
node-version: '22'
95+
96+
- name: Install pnpm
97+
uses: pnpm/action-setup@5b4374b04084dc1f9032b52464284b769ac5059e # v4
98+
with:
99+
version: 9
100+
101+
- name: Build dashboard
102+
working-directory: cli/dashboard
103+
run: |
104+
pnpm install
105+
pnpm run build
106+
107+
- name: Upload dashboard dist
108+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
109+
with:
110+
name: dashboard-dist
111+
path: cli/dashboard/dist/
112+
retention-days: 1
113+
78114
test:
79115
name: Test
80116
runs-on: ${{ matrix.os }}
117+
needs: [dashboard]
81118
timeout-minutes: 30
82119
strategy:
83120
matrix:
@@ -94,22 +131,11 @@ jobs:
94131
cache: true
95132
cache-dependency-path: cli/go.sum
96133

97-
- name: Set up Node.js
98-
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
134+
- name: Download dashboard dist
135+
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
99136
with:
100-
node-version: '22'
101-
102-
- name: Install pnpm
103-
uses: pnpm/action-setup@5b4374b04084dc1f9032b52464284b769ac5059e # v4
104-
with:
105-
version: 9
106-
107-
- name: Build dashboard
108-
run: |
109-
cd dashboard
110-
pnpm install
111-
pnpm run build
112-
cd ..
137+
name: dashboard-dist
138+
path: cli/dashboard/dist/
113139

114140
- name: Install Aspire CLI
115141
shell: pwsh
@@ -138,12 +164,9 @@ jobs:
138164
mkdir -p ../coverage
139165
# Exclude tests/test-tool (it's a standalone main package with no tests)
140166
PACKAGES=$(go list ./... | grep -v '/tests/test-tool')
141-
# Race detector not supported on macOS without additional setup
142-
if [ "${{ matrix.os }}" = "macos-latest" ]; then
143-
go test -short -v -coverprofile=../coverage/coverage.out $PACKAGES
144-
else
145-
go test -short -v -race -coverprofile=../coverage/coverage.out $PACKAGES
146-
fi
167+
go test -short -v -race -coverprofile=../coverage/coverage.out $PACKAGES
168+
env:
169+
CGO_ENABLED: '1'
147170

148171
- name: Upload coverage to Codecov
149172
if: github.repository == 'jongio/azd-app'
@@ -172,6 +195,7 @@ jobs:
172195
lint:
173196
name: Lint
174197
runs-on: ubuntu-latest
198+
needs: [dashboard]
175199
timeout-minutes: 30
176200

177201
steps:
@@ -185,33 +209,22 @@ jobs:
185209
cache: true
186210
cache-dependency-path: cli/go.sum
187211

188-
- name: Set up Node.js
189-
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
190-
with:
191-
node-version: '22'
192-
193-
- name: Install pnpm
194-
uses: pnpm/action-setup@5b4374b04084dc1f9032b52464284b769ac5059e # v4
212+
- name: Download dashboard dist
213+
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
195214
with:
196-
version: 9
197-
198-
- name: Build dashboard assets
199-
run: |
200-
cd dashboard
201-
pnpm install
202-
pnpm run build
203-
cd ..
215+
name: dashboard-dist
216+
path: cli/dashboard/dist/
204217

205218
- name: Install golangci-lint
206-
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
219+
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
207220

208221
- name: Run golangci-lint
209222
run: golangci-lint run --timeout=5m
210223

211224
build:
212225
name: Build
213226
runs-on: ubuntu-latest
214-
needs: [preflight, test, lint]
227+
needs: [preflight, test, lint, dashboard]
215228
timeout-minutes: 30
216229

217230
defaults:
@@ -229,22 +242,11 @@ jobs:
229242
cache: true
230243
cache-dependency-path: cli/go.sum
231244

232-
- name: Set up Node.js
233-
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
234-
with:
235-
node-version: '22'
236-
237-
- name: Install pnpm
238-
uses: pnpm/action-setup@5b4374b04084dc1f9032b52464284b769ac5059e # v4
245+
- name: Download dashboard dist
246+
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
239247
with:
240-
version: 9
241-
242-
- name: Build dashboard
243-
run: |
244-
cd dashboard
245-
pnpm install
246-
pnpm run build
247-
cd ..
248+
name: dashboard-dist
249+
path: cli/dashboard/dist/
248250

249251
- name: Build for multiple platforms
250252
run: |
@@ -262,7 +264,7 @@ jobs:
262264
integration:
263265
name: Integration Tests
264266
runs-on: ${{ matrix.os }}
265-
needs: [preflight, test]
267+
needs: [preflight, test, dashboard]
266268
timeout-minutes: 30
267269
strategy:
268270
fail-fast: false
@@ -280,6 +282,12 @@ jobs:
280282
cache: true
281283
cache-dependency-path: cli/go.sum
282284

285+
- name: Download dashboard dist
286+
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
287+
with:
288+
name: dashboard-dist
289+
path: cli/dashboard/dist/
290+
283291
- name: Set up Node.js
284292
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
285293
with:
@@ -336,13 +344,6 @@ jobs:
336344
done
337345
shell: bash
338346

339-
- name: Build dashboard assets
340-
run: |
341-
cd dashboard
342-
pnpm install
343-
pnpm run build
344-
cd ..
345-
346347
- name: Run port manager integration tests
347348
shell: bash
348349
timeout-minutes: 8

.github/workflows/release.yml

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,19 @@ jobs:
6262
version: 9
6363

6464
- name: Install Mage
65-
run: go install github.com/magefile/mage@latest
65+
run: go install github.com/magefile/mage@v1.15.0
6666

6767
- name: Install golangci-lint
68-
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
68+
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
6969

7070
- name: Install staticcheck
71-
run: go install honnef.co/go/tools/cmd/staticcheck@latest
71+
run: go install honnef.co/go/tools/cmd/staticcheck@v0.6.1
7272

7373
- name: Install gosec
74-
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
74+
run: go install github.com/securego/gosec/v2/cmd/gosec@v2.22.4
7575

7676
- name: Install govulncheck
77-
run: go install golang.org/x/vuln/cmd/govulncheck@latest
77+
run: go install golang.org/x/vuln/cmd/govulncheck@v1.1.4
7878

7979
- name: Install azd
8080
run: curl -fsSL https://aka.ms/install-azd.sh | bash
@@ -153,12 +153,9 @@ jobs:
153153
mkdir -p ../coverage
154154
# Exclude tests/test-tool (it's a standalone main package with no tests)
155155
PACKAGES=$(go list ./... | grep -v '/tests/test-tool')
156-
# Race detector not supported on macOS without additional setup
157-
if [ "${{ matrix.os }}" = "macos-latest" ]; then
158-
go test -short -v -coverprofile=../coverage/coverage.out $PACKAGES
159-
else
160-
go test -short -v -race -coverprofile=../coverage/coverage.out $PACKAGES
161-
fi
156+
go test -short -v -race -coverprofile=../coverage/coverage.out $PACKAGES
157+
env:
158+
CGO_ENABLED: '1'
162159

163160
- name: Upload coverage to Codecov
164161
if: github.repository == 'jongio/azd-app'
@@ -171,30 +168,6 @@ jobs:
171168
fail_ci_if_error: false
172169
verbose: true
173170

174-
- name: Set up Go
175-
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
176-
with:
177-
go-version: '${{ env.GO_VERSION }}'
178-
cache: true
179-
cache-dependency-path: cli/go.sum
180-
181-
- name: Set up Node.js
182-
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
183-
with:
184-
node-version: '22'
185-
186-
- name: Install pnpm
187-
uses: pnpm/action-setup@5b4374b04084dc1f9032b52464284b769ac5059e # v4
188-
with:
189-
version: 9
190-
191-
- name: Build dashboard
192-
run: |
193-
cd dashboard
194-
pnpm install
195-
pnpm run build
196-
cd ..
197-
198171
- name: Build for multiple platforms
199172
if: matrix.os == 'ubuntu-latest'
200173
run: |

.golangci.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,11 @@ linters:
9393
- path: _test\.go
9494
linters:
9595
- dupl
96-
- errcheck
9796
- goconst
9897
- unparam
99-
- forcetypeassert
98+
- prealloc
10099
- noctx
101100
- exhaustive
102-
- prealloc
103-
- gosec
104-
- revive
105-
- misspell
106-
- bodyclose
107-
- nilerr
108-
- gocritic
109-
- nolintlint
110-
- wastedassign
111-
- staticcheck
112101
- path: magefile\.go
113102
linters:
114103
- unparam

0 commit comments

Comments
 (0)