Skip to content

Commit 86b7060

Browse files
committed
Merge branch 'main' into abhineetjain/workspace-errors
2 parents 2b905e7 + 56ee105 commit 86b7060

File tree

94 files changed

+1329
-540
lines changed

Some content is hidden

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

94 files changed

+1329
-540
lines changed

.github/workflows/chromatic.yaml

Lines changed: 0 additions & 68 deletions
This file was deleted.

.github/workflows/coder.yaml

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,28 @@ concurrency:
3030
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
3131

3232
jobs:
33+
typos:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v2
38+
- name: typos-action
39+
uses: crate-ci/typos@v1.0.4
40+
with:
41+
config: .github/workflows/typos.toml
42+
- name: Fix Helper
43+
if: ${{ failure() }}
44+
run: |
45+
echo "::notice:: you can automatically fix typos from your CLI:
46+
cargo install typos-cli
47+
typos -c .github/workflows/typos.toml -w"
48+
3349
changes:
3450
runs-on: ubuntu-latest
3551
outputs:
3652
docs-only: ${{ steps.filter.outputs.docs_count == steps.filter.outputs.all_count }}
3753
sh: ${{ steps.filter.outputs.sh }}
54+
ts: ${{ steps.filter.outputs.ts }}
3855
steps:
3956
- uses: actions/checkout@v3
4057
# For pull requests it's not necessary to checkout the code
@@ -50,6 +67,11 @@ jobs:
5067
# - '.github/**'
5168
sh:
5269
- "**.sh"
70+
ts:
71+
- "**.tsx?"
72+
- "**.jsx?"
73+
- "**.lock"
74+
- "**.json"
5375
- id: debug
5476
run: |
5577
echo "${{ toJSON(steps.filter )}}"
@@ -269,7 +291,11 @@ jobs:
269291
echo ::set-output name=cover::false
270292
fi
271293
set -x
272-
gotestsum --junitfile="gotests.xml" --packages="./..." -- -parallel=8 -timeout=5m -short -failfast $COVERAGE_FLAGS
294+
test_timeout=5m
295+
if [[ "${{ matrix.os }}" == windows* ]]; then
296+
test_timeout=10m
297+
fi
298+
gotestsum --junitfile="gotests.xml" --packages="./..." -- -parallel=8 -timeout=$test_timeout -short -failfast $COVERAGE_FLAGS
273299
274300
- name: Upload DataDog Trace
275301
if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
@@ -603,3 +629,47 @@ jobs:
603629
DD_CATEGORY: e2e
604630
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
605631
run: go run scripts/datadog-cireport/main.go site/test-results/junit.xml
632+
chromatic:
633+
# REMARK: this is only used to build storybook and deploy it to Chromatic.
634+
runs-on: ubuntu-latest
635+
needs:
636+
- changes
637+
if: needs.changes.outputs.ts == 'true'
638+
steps:
639+
- uses: actions/checkout@v3
640+
with:
641+
# Required by Chromatic for build-over-build history, otherwise we
642+
# only get 1 commit on shallow checkout.
643+
fetch-depth: 0
644+
645+
- name: Install dependencies
646+
run: cd site && yarn
647+
648+
# This step is not meant for mainline because any detected changes to
649+
# storybook snapshots will require manual approval/review in order for
650+
# the check to pass. This is desired in PRs, but not in mainline.
651+
- name: Publish to Chromatic (non-mainline)
652+
if: github.ref != 'refs/heads/main' && github.repository_owner == 'coder'
653+
uses: chromaui/action@v1
654+
with:
655+
buildScriptName: "storybook:build"
656+
exitOnceUploaded: true
657+
# Chromatic states its fine to make this token public. See:
658+
# https://www.chromatic.com/docs/github-actions#forked-repositories
659+
projectToken: 695c25b6cb65
660+
workingDir: "./site"
661+
662+
# This is a separate step for mainline only that auto accepts and changes
663+
# instead of holding CI up. Since we squash/merge, this is defensive to
664+
# avoid the same changeset from requiring review once squashed into
665+
# main. Chromatic is supposed to be able to detect that we use squash
666+
# commits, but it's good to be defensive in case, otherwise CI remains
667+
# infinitely "in progress" in mainline unless we re-review each build.
668+
- name: Publish to Chromatic (mainline)
669+
if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder'
670+
uses: chromaui/action@v1
671+
with:
672+
autoAcceptChanges: true
673+
buildScriptName: "storybook:build"
674+
projectToken: 695c25b6cb65
675+
workingDir: "./site"

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
103103
# build and (maybe) push Docker images for each architecture
104104
images=()
105-
for arch in amd64 armv7 arm64; do
105+
for arch in amd64; do
106106
img="$(
107107
./scripts/build_docker.sh \
108108
${{ (!github.event.inputs.dry_run && !github.event.inputs.snapshot) && '--push' || '' }} \

.github/workflows/typos.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[default.extend-identifiers]
2+
alog = "alog"
3+
Jetbrains = "JetBrains"
4+
IST = "IST"
5+
6+
[default.extend-words]
7+
8+
[files]
9+
extend-exclude = [
10+
"**.svg",
11+
"**.lock",
12+
"go.sum",
13+
"go.mod",
14+
# These files contain base64 strings that confuse the detector
15+
"**XService**.ts",
16+
"**identity.go",
17+
]

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"mattn",
4343
"mitchellh",
4444
"moby",
45+
"namesgenerator",
4546
"nfpms",
4647
"nhooyr",
4748
"nolint",

agent/agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ func (a *agent) createCommand(ctx context.Context, rawCommand string, env []stri
402402
// These should override all variables we manually specify.
403403
for envKey, value := range metadata.EnvironmentVariables {
404404
// Expanding environment variables allows for customization
405-
// of the $PATH, among other variables. Customers can prepand
405+
// of the $PATH, among other variables. Customers can prepend
406406
// or append to the $PATH, so allowing expand is required!
407407
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", envKey, os.ExpandEnv(value)))
408408
}

agent/agent_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838
"github.com/coder/coder/peerbroker/proto"
3939
"github.com/coder/coder/provisionersdk"
4040
"github.com/coder/coder/pty/ptytest"
41+
"github.com/coder/coder/testutil"
4142
)
4243

4344
func TestMain(m *testing.M) {
@@ -257,7 +258,7 @@ func TestAgent(t *testing.T) {
257258
}
258259
gotContent = string(content)
259260
return true
260-
}, 15*time.Second, 100*time.Millisecond)
261+
}, testutil.WaitMedium, testutil.IntervalMedium)
261262
require.Equal(t, content, strings.TrimSpace(gotContent))
262263
})
263264

agent/reaper/reaper_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/stretchr/testify/require"
1313

1414
"github.com/coder/coder/agent/reaper"
15+
"github.com/coder/coder/testutil"
1516
)
1617

1718
func TestReap(t *testing.T) {
@@ -52,10 +53,9 @@ func TestReap(t *testing.T) {
5253

5354
expectedPIDs := []int{cmd.Process.Pid, cmd2.Process.Pid}
5455

55-
deadline := time.NewTimer(time.Second * 5)
5656
for i := 0; i < len(expectedPIDs); i++ {
5757
select {
58-
case <-deadline.C:
58+
case <-time.After(testutil.WaitShort):
5959
t.Fatalf("Timed out waiting for process")
6060
case pid := <-pids:
6161
require.Contains(t, expectedPIDs, pid)

cli/cliui/cliui.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var Styles = struct {
3434
Placeholder,
3535
Prompt,
3636
FocusedPrompt,
37-
Fuschia,
37+
Fuchsia,
3838
Logo,
3939
Warn,
4040
Wrap lipgloss.Style
@@ -48,10 +48,10 @@ var Styles = struct {
4848
Field: defaultStyles.Code.Copy().Foreground(lipgloss.AdaptiveColor{Light: "#000000", Dark: "#FFFFFF"}),
4949
Keyword: defaultStyles.Keyword,
5050
Paragraph: defaultStyles.Paragraph,
51-
Placeholder: lipgloss.NewStyle().Foreground(lipgloss.Color("240")),
51+
Placeholder: lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#585858", Dark: "#005fff"}),
5252
Prompt: defaultStyles.Prompt.Foreground(lipgloss.AdaptiveColor{Light: "#9B9B9B", Dark: "#5C5C5C"}),
5353
FocusedPrompt: defaultStyles.FocusedPrompt.Foreground(lipgloss.Color("#651fff")),
54-
Fuschia: defaultStyles.SelectedMenuItem.Copy(),
54+
Fuchsia: defaultStyles.SelectedMenuItem.Copy(),
5555
Logo: defaultStyles.Logo.SetString("Coder"),
5656
Warn: lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#04B575", Dark: "#ECFD65"}),
5757
Wrap: lipgloss.NewStyle().Width(80),

cli/cliui/prompt_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"os"
88
"os/exec"
99
"testing"
10-
"time"
1110

1211
"github.com/spf13/cobra"
1312
"github.com/stretchr/testify/assert"
@@ -16,6 +15,7 @@ import (
1615
"github.com/coder/coder/cli/cliui"
1716
"github.com/coder/coder/pty"
1817
"github.com/coder/coder/pty/ptytest"
18+
"github.com/coder/coder/testutil"
1919
)
2020

2121
func TestPrompt(t *testing.T) {
@@ -61,7 +61,7 @@ func TestPrompt(t *testing.T) {
6161
// Copy all data written out to a buffer. When we close the ptty, we can
6262
// no longer read from the ptty.Output(), but we can read what was
6363
// written to the buffer.
64-
dataRead, doneReading := context.WithTimeout(context.Background(), time.Second*2)
64+
dataRead, doneReading := context.WithTimeout(context.Background(), testutil.WaitShort)
6565
go func() {
6666
// This will throw an error sometimes. The underlying ptty
6767
// has its own cleanup routines in t.Cleanup. Instead of
@@ -193,7 +193,7 @@ func TestPasswordTerminalState(t *testing.T) {
193193
require.Eventually(t, func() bool {
194194
echo, err := ptyWithFlags.EchoEnabled()
195195
return err == nil && !echo
196-
}, 5*time.Second, 50*time.Millisecond, "echo is on while reading password")
196+
}, testutil.WaitShort, testutil.IntervalMedium, "echo is on while reading password")
197197

198198
err = process.Signal(os.Interrupt)
199199
require.NoError(t, err)
@@ -203,7 +203,7 @@ func TestPasswordTerminalState(t *testing.T) {
203203
require.Eventually(t, func() bool {
204204
echo, err := ptyWithFlags.EchoEnabled()
205205
return err == nil && echo
206-
}, 5*time.Second, 50*time.Millisecond, "echo is off after reading password")
206+
}, testutil.WaitShort, testutil.IntervalMedium, "echo is off after reading password")
207207
}
208208

209209
// nolint:unused

cli/create_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/coder/coder/provisioner/echo"
1717
"github.com/coder/coder/provisionersdk/proto"
1818
"github.com/coder/coder/pty/ptytest"
19+
"github.com/coder/coder/testutil"
1920
)
2021

2122
func TestCreate(t *testing.T) {
@@ -88,7 +89,7 @@ func TestCreate(t *testing.T) {
8889

8990
member := coderdtest.CreateAnotherUser(t, client, user.OrganizationID)
9091
clitest.SetupConfig(t, member, root)
91-
cmdCtx, done := context.WithTimeout(context.Background(), 10*time.Second)
92+
cmdCtx, done := context.WithTimeout(context.Background(), testutil.WaitLong)
9293
go func() {
9394
defer done()
9495
err := cmd.ExecuteContext(cmdCtx)

cli/list_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ package cli_test
33
import (
44
"context"
55
"testing"
6-
"time"
76

87
"github.com/stretchr/testify/assert"
98

109
"github.com/coder/coder/cli/clitest"
1110
"github.com/coder/coder/coderd/coderdtest"
1211
"github.com/coder/coder/pty/ptytest"
12+
"github.com/coder/coder/testutil"
1313
)
1414

1515
func TestList(t *testing.T) {
@@ -29,7 +29,7 @@ func TestList(t *testing.T) {
2929
cmd.SetIn(pty.Input())
3030
cmd.SetOut(pty.Output())
3131

32-
ctx, cancelFunc := context.WithTimeout(context.Background(), 5*time.Second)
32+
ctx, cancelFunc := context.WithTimeout(context.Background(), testutil.WaitLong)
3333
defer cancelFunc()
3434
done := make(chan any)
3535
go func() {

0 commit comments

Comments
 (0)