-
Notifications
You must be signed in to change notification settings - Fork 5
189 lines (165 loc) · 4.71 KB
/
ci.yml
File metadata and controls
189 lines (165 loc) · 4.71 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
name: LSTK CI
on:
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
workflow_dispatch:
workflow_call:
permissions:
contents: read
pull-requests: write
checks: write
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version-file: .tool-versions
goreleaser-check:
name: GoReleaser Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Run GoReleaser check
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: "~> v2"
args: check
test-unit:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Run unit tests
run: make test
env:
CREATE_JUNIT_REPORT: "true"
- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: unit-test-results
path: test-results.xml
- name: Test report
uses: dorny/test-reporter@v3
if: always()
with:
name: Unit Test Results
path: test-results.xml
reporter: java-junit
test-integration:
name: Integration Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: |
go.sum
test/integration/go.sum
# Install lstk via Homebrew so the Homebrew update integration test
# (TestUpdateHomebrew) can locate a real Caskroom binary path.
- name: Install lstk via Homebrew
if: matrix.os == 'macos-latest'
run: brew install localstack/tap/lstk
- name: Run integration tests
run: make test-integration
env:
CREATE_JUNIT_REPORT: "true"
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
LSTK_TEST_HOMEBREW: ${{ matrix.os == 'macos-latest' && '1' || '0' }}
LSTK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: integration-test-results-${{ matrix.os }}
path: test-integration-results.xml
- name: Test report
uses: dorny/test-reporter@v3
if: always()
with:
name: Integration Test Results (${{ matrix.os }})
path: test-integration-results.xml
reporter: java-junit
release:
name: Build and Publish Release
if: startsWith(github.ref, 'refs/tags/')
needs:
- lint
- goreleaser-check
- test-unit
- test-integration
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Validate version tag
run: |
if [[ ! "${GITHUB_REF_NAME}" =~ ^v0\.[0-9]+\.[0-9]+$ ]]; then
echo "Tag '${GITHUB_REF_NAME}' does not match version format v0.minor.patch"
exit 1
fi
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_TOKEN: ${{ secrets.PRO_ACCESS_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Publish to NPM
uses: evg4b/goreleaser-npm-publisher-action@v1
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
prefix: "@localstack"
license: Apache-2.0
description: "LocalStack CLI v2 - Start and manage LocalStack emulators"
keywords: |
localstack
cli
aws
emulator
docker