Skip to content

Commit 5890ff1

Browse files
authored
Merge branch 'main' into bryphe/refactor/add-stability-workflow
2 parents 14345df + 64f9e69 commit 5890ff1

File tree

200 files changed

+10785
-7349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+10785
-7349
lines changed

.github/workflows/coder.yaml

Lines changed: 104 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ jobs:
3737
name: style/lint/golangci
3838
runs-on: ubuntu-latest
3939
steps:
40-
- uses: actions/checkout@v2
40+
- uses: actions/checkout@v3
41+
- uses: actions/setup-go@v2
42+
with:
43+
go-version: "^1.17"
4144
- name: golangci-lint
42-
uses: golangci/golangci-lint-action@v2
45+
uses: golangci/golangci-lint-action@v3.1.0
4346
with:
4447
version: v1.43.0
4548

@@ -48,7 +51,7 @@ jobs:
4851
runs-on: ubuntu-latest
4952
steps:
5053
- name: Checkout
51-
uses: actions/checkout@v2
54+
uses: actions/checkout@v3
5255

5356
- name: Cache Node
5457
id: cache-node
@@ -58,6 +61,8 @@ jobs:
5861
**/node_modules
5962
.eslintcache
6063
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
64+
restore-keys: |
65+
js-${{ runner.os }}-
6166
6267
- name: Install node_modules
6368
run: ./scripts/yarn_install.sh
@@ -70,7 +75,7 @@ jobs:
7075
name: "style/gen"
7176
runs-on: ubuntu-latest
7277
steps:
73-
- uses: actions/checkout@v2
78+
- uses: actions/checkout@v3
7479
- name: Install Protoc
7580
uses: arduino/setup-protoc@v1
7681
with:
@@ -92,7 +97,7 @@ jobs:
9297
runs-on: ubuntu-latest
9398
steps:
9499
- name: Checkout
95-
uses: actions/checkout@v2
100+
uses: actions/checkout@v3
96101
with:
97102
fetch-depth: 0
98103
submodules: true
@@ -105,6 +110,8 @@ jobs:
105110
**/node_modules
106111
.eslintcache
107112
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
113+
restore-keys: |
114+
js-${{ runner.os }}-
108115
109116
- name: Install node_modules
110117
run: ./scripts/yarn_install.sh
@@ -122,7 +129,7 @@ jobs:
122129
- macos-latest
123130
- windows-2022
124131
steps:
125-
- uses: actions/checkout@v2
132+
- uses: actions/checkout@v3
126133

127134
- uses: actions/setup-go@v2
128135
with:
@@ -154,20 +161,23 @@ jobs:
154161
GOMAXPROCS: ${{ runner.os == 'Windows' && 1 || 2 }}
155162
run: gotestsum --junitfile="gotests.xml" --packages="./..." --
156163
-covermode=atomic -coverprofile="gotests.coverage"
164+
-coverpkg=./...,github.com/coder/coder/codersdk
157165
-timeout=3m -count=$GOCOUNT -race -short -failfast
158166

159167
- name: Upload DataDog Trace
160168
if: (success() || failure()) && github.actor != 'dependabot[bot]'
161169
env:
162170
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
163171
DD_DATABASE: fake
172+
DD_CATEGORY: unit
164173
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
165174
run: go run scripts/datadog-cireport/main.go gotests.xml
166175

167176
- name: Test with PostgreSQL Database
168177
if: runner.os == 'Linux'
169178
run: DB=true gotestsum --junitfile="gotests.xml" --packages="./..." --
170179
-covermode=atomic -coverprofile="gotests.coverage" -timeout=3m
180+
-coverpkg=./...,github.com/coder/coder/codersdk
171181
-count=1 -race -parallel=2 -failfast
172182

173183
- name: Upload DataDog Trace
@@ -194,7 +204,7 @@ jobs:
194204
contents: read
195205
id-token: write
196206
steps:
197-
- uses: actions/checkout@v2
207+
- uses: actions/checkout@v3
198208

199209
- name: Authenticate to Google Cloud
200210
uses: google-github-actions/auth@v0
@@ -208,7 +218,7 @@ jobs:
208218
- name: Configure Docker for Google Artifact Registry
209219
run: gcloud auth configure-docker us-docker.pkg.dev
210220

211-
- uses: actions/setup-node@v2
221+
- uses: actions/setup-node@v3
212222
with:
213223
node-version: "14"
214224

@@ -219,6 +229,10 @@ jobs:
219229
with:
220230
go-version: "^1.17"
221231

232+
- uses: goreleaser/goreleaser-action@v2
233+
with:
234+
install-only: true
235+
222236
- run: make docker/image/coder
223237

224238
- run: docker push us-docker.pkg.dev/coder-blacktriangle-dev/ci/coder:latest
@@ -230,7 +244,7 @@ jobs:
230244
name: "test/js"
231245
runs-on: ubuntu-latest
232246
steps:
233-
- uses: actions/checkout@v2
247+
- uses: actions/checkout@v3
234248

235249
- name: Cache Node
236250
id: cache-node
@@ -240,13 +254,15 @@ jobs:
240254
**/node_modules
241255
.eslintcache
242256
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
257+
restore-keys: |
258+
js-${{ runner.os }}-
243259
244260
# Go is required for uploading the test results to datadog
245261
- uses: actions/setup-go@v2
246262
with:
247263
go-version: "^1.17"
248264

249-
- uses: actions/setup-node@v2
265+
- uses: actions/setup-node@v3
250266
with:
251267
node-version: "14"
252268

@@ -276,6 +292,82 @@ jobs:
276292
if: (success() || failure()) && github.actor != 'dependabot[bot]'
277293
env:
278294
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
279-
DD_DATABASE: postgresql
295+
DD_CATEGORY: unit
296+
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
297+
run: go run scripts/datadog-cireport/main.go site/test-results/junit.xml
298+
299+
test-e2e:
300+
name: "test/e2e/${{ matrix.os }}"
301+
runs-on: ${{ matrix.os }}
302+
strategy:
303+
matrix:
304+
os:
305+
- ubuntu-latest
306+
- macos-latest
307+
# TODO: Get `make build` running on Windows 2022
308+
# https://github.com/coder/coder/issues/384
309+
# - windows-2022
310+
steps:
311+
- uses: actions/checkout@v2
312+
313+
- name: Cache Node
314+
id: cache-node
315+
uses: actions/cache@v2
316+
with:
317+
path: |
318+
**/node_modules
319+
.eslintcache
320+
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
321+
restore-keys: |
322+
js-${{ runner.os }}-
323+
324+
# Go is required for uploading the test results to datadog
325+
- uses: actions/setup-go@v2
326+
with:
327+
go-version: "^1.17"
328+
329+
- uses: hashicorp/setup-terraform@v1
330+
with:
331+
terraform_version: 1.1.2
332+
terraform_wrapper: false
333+
334+
- uses: actions/setup-node@v3
335+
with:
336+
node-version: "14"
337+
338+
- uses: goreleaser/goreleaser-action@v2
339+
with:
340+
install-only: true
341+
342+
- uses: actions/cache@v2
343+
with:
344+
# Go mod cache, Linux build cache, Mac build cache, Windows build cache
345+
path: |
346+
~/go/pkg/mod
347+
~/.cache/go-build
348+
~/Library/Caches/go-build
349+
%LocalAppData%\go-build
350+
key: ${{ matrix.os }}-go-${{ hashFiles('**/go.sum') }}
351+
restore-keys: |
352+
${{ matrix.os }}-go-
353+
354+
- run: make build
355+
356+
- run: yarn playwright:install
357+
working-directory: site
358+
359+
- run: yarn playwright:install-deps
360+
working-directory: site
361+
362+
- run: yarn playwright:test
363+
env:
364+
DEBUG: pw:api
365+
working-directory: site
366+
367+
- name: Upload DataDog Trace
368+
if: (success() || failure()) && github.actor != 'dependabot[bot]' && runner.os == 'Linux'
369+
env:
370+
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
371+
DD_CATEGORY: e2e
280372
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
281-
run: go run scripts/datadog-cireport/main.go site/test_results/junit.xml
373+
run: go run scripts/datadog-cireport/main.go site/test-results/junit.xml

.github/workflows/release.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
jobs:
7+
goreleaser:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 0
13+
- uses: actions/setup-go@v2
14+
with:
15+
go-version: "^1.17"
16+
17+
- name: Run GoReleaser
18+
uses: goreleaser/goreleaser-action@v2.9.1
19+
with:
20+
version: latest
21+
args: release --rm-dist
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ site/.eslintcache
2020
site/.next/
2121
site/node_modules/
2222
site/storybook-static/
23-
site/test_results/
23+
site/test-results/
2424
site/yarn-error.log
2525
coverage/
2626

2727
# Build
28-
bin/
28+
dist/
2929
site/out/

.goreleaser.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
archives:
2+
- builds:
3+
- coder
4+
files:
5+
- README.md
6+
7+
before:
8+
hooks:
9+
- go mod tidy
10+
- rm -f site/out/bin/coder*
11+
12+
builds:
13+
- id: coder-slim
14+
dir: cmd/coder
15+
flags: [-tags=slim]
16+
ldflags: ["-s -w"]
17+
env: [CGO_ENABLED=0]
18+
goos: [darwin, linux, windows]
19+
goarch: [amd64, arm64]
20+
hooks:
21+
# The "trimprefix" appends ".exe" on Windows.
22+
post: |
23+
cp {{.Path}} site/out/bin/coder_{{ .Os }}_{{ .Arch }}{{ trimprefix .Name "coder" }}
24+
25+
- id: coder
26+
dir: cmd/coder
27+
ldflags: ["-s -w"]
28+
env: [CGO_ENABLED=0]
29+
goos: [darwin, linux, windows]
30+
goarch: [amd64, arm64]
31+
32+
nfpms:
33+
- vendor: Coder
34+
homepage: https://coder.com
35+
maintainer: Coder <support@coder.com>
36+
description: |
37+
Provision development environments with infrastructure with code
38+
formats:
39+
- apk
40+
- deb
41+
- rpm
42+
suggests:
43+
- postgresql
44+
builds:
45+
- coder
46+
47+
release:
48+
ids: [coder]

.vscode/settings.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"go.lintFlags": ["--fast"],
77
"go.lintOnSave": "package",
88
"go.coverOnSave": true,
9+
// The codersdk is used by coderd another other packages extensively.
10+
// To reduce redundancy in tests, it's covered by other packages.
11+
"go.testFlags": ["-coverpkg=./.,github.com/coder/coder/codersdk"],
912
"go.coverageDecorator": {
1013
"type": "gutter",
1114
"coveredHighlightColor": "rgba(64,128,128,0.5)",
@@ -32,24 +35,29 @@
3235
"drpcmux",
3336
"drpcserver",
3437
"fatih",
38+
"goarch",
3539
"goleak",
3640
"gossh",
3741
"hashicorp",
3842
"httpmw",
3943
"idtoken",
44+
"incpatch",
4045
"isatty",
4146
"Jobf",
4247
"kirsle",
48+
"ldflags",
4349
"manifoldco",
4450
"mattn",
4551
"mitchellh",
4652
"moby",
53+
"nfpms",
4754
"nhooyr",
4855
"nolint",
4956
"nosec",
5057
"ntqry",
5158
"oneof",
5259
"parameterscopeid",
60+
"pqtype",
5361
"promptui",
5462
"protobuf",
5563
"provisionerd",
@@ -62,9 +70,11 @@
6270
"tcpip",
6371
"tfexec",
6472
"tfstate",
73+
"trimprefix",
6574
"unconvert",
6675
"webrtc",
6776
"xerrors",
6877
"yamux"
69-
]
78+
],
79+
"eslint.workingDirectories": ["./site"]
7080
}

0 commit comments

Comments
 (0)