Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e1c802b

Browse files
committed
Merge branch 'main' into mafredri/ci-release-via-actions
2 parents 29a33be + d5ab06e commit e1c802b

File tree

74 files changed

+287
-349
lines changed

Some content is hidden

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

74 files changed

+287
-349
lines changed

.github/workflows/packages.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
echo "Installer URL: $installer_url"
2828
2929
# The package version is the same as the tag minus the leading "v".
30-
$version = $env:CODER_VERSION -replace "^v", ""
30+
$version = $env:CODER_VERSION.Trim('v')
3131
3232
echo "Package version: $version"
3333

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ site/**/*.typegen.ts
2323
site/build-storybook.log
2424
site/coverage/
2525
site/storybook-static/
26-
site/test-results/
26+
site/test-results/*
27+
site/e2e/test-results/*
28+
site/e2e/storageState.json
29+
site/playwright-report/*
2730

2831
# Make target for updating golden files.
2932
cli/testdata/.gen-golden

.prettierignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ site/**/*.typegen.ts
2626
site/build-storybook.log
2727
site/coverage/
2828
site/storybook-static/
29-
site/test-results/
29+
site/test-results/*
30+
site/e2e/test-results/*
31+
site/e2e/storageState.json
32+
site/playwright-report/*
3033

3134
# Make target for updating golden files.
3235
cli/testdata/.gen-golden

examples/lima/coder.yaml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,16 @@ provision:
6565
# See: https://github.com/lima-vm/lima/issues/528
6666
chown ${LIMA_CIDATA_USER} /var/run/docker.sock
6767
chmod og+rwx /var/run/docker.sock
68-
- mode: system
69-
script: |
70-
#!/bin/bash
71-
set -eux -o pipefail
72-
command -v terraform >/dev/null 2>&1 && exit 0
73-
DEBIAN_FRONTEND=noninteractive apt-get install -qqy unzip
74-
rm -fv /tmp/terraform.zip || true
75-
wget -qO /tmp/terraform.zip "https://releases.hashicorp.com/terraform/1.3.0/terraform_1.3.0_linux_$(dpkg --print-architecture).zip"
76-
unzip /tmp/terraform.zip -d /usr/local/bin/
77-
chmod +x /usr/local/bin/terraform
78-
rm -fv /tmp/terraform.zip || true
7968
- mode: system
8069
script: |
8170
#!/bin/bash
8271
set -eux -o pipefail
8372
command -v coder >/dev/null 2>&1 && exit 0
8473
export DEBIAN_FRONTEND=noninteractive
8574
export HOME=/root
86-
curl -fsSL https://coder.com/install.sh | sh
75+
# Using install.sh --with-terraform requires unzip to be available.
76+
apt-get install -qqy unzip
77+
curl -fsSL https://coder.com/install.sh | sh -s -- --with-terraform
8778
# Ensure Coder has permissions on /var/run/docker.socket
8879
usermod -aG docker coder
8980
# Ensure coder listens on all interfaces
@@ -93,10 +84,8 @@ provision:
9384
# Ensure coder starts on boot
9485
systemctl enable coder
9586
systemctl start coder
96-
# Wait for Coder to have downloaded Terraform
97-
timeout 60s bash -c 'until /var/cache/coder/terraform version >/dev/null 2>&1; do sleep 1; done'
98-
# Coder restarts after downloading Terraform, wait for it to become available
99-
timeout 60s bash -c 'until nc -z localhost 3000 > /dev/null 2>&1; do sleep 1; done'
87+
# Wait for Terraform to be installed
88+
timeout 60s bash -c 'until /usr/local/bin/terraform version >/dev/null 2>&1; do sleep 1; done'
10089
- mode: user
10190
script: |
10291
#!/bin/bash
@@ -141,10 +130,10 @@ message: |
141130
All Done! Your Coder instance is accessible at http://localhost:3000
142131
143132
Username: "[email protected]"
144-
Password: Run `LIMA_INSTANCE=coder lima cat /home/${USER}.linux/.config/coderv2/password` 🤫
133+
Password: Run `LIMA_INSTANCE={{.Instance.Name}} lima cat /home/${USER}.linux/.config/coderv2/password` 🤫
145134
146135
Get started creating your own template now:
147136
------
148-
limactl shell coder
137+
limactl shell {{.Instance.Name}}
149138
cd && coder templates init
150139
------

helm/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ coder:
113113
- podAffinityTerm:
114114
labelSelector:
115115
matchExpressions:
116-
- key: app.coder.com
116+
- key: app.kubernetes.io/instance
117117
operator: In
118118
values:
119-
- "true"
119+
- "coder"
120120
topologyKey: kubernetes.io/hostname
121121
weight: 1
122122

site/.eslintignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ yarn-error.log
2626
build-storybook.log
2727
coverage/
2828
storybook-static/
29-
test-results/
29+
test-results/*
30+
e2e/test-results/*
31+
e2e/storageState.json
32+
playwright-report/*
3033

3134
# Make target for updating golden files.
3235
../cli/testdata/.gen-golden

site/.eslintrc.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@ rules:
122122
react/jsx-uses-react: "off"
123123
react/react-in-jsx-scope: "off"
124124
"unicorn/explicit-length-check": "error"
125+
# https://github.com/jsx-eslint/eslint-plugin-react/issues/2628#issuecomment-984160944
126+
no-restricted-syntax:
127+
[
128+
"error",
129+
{
130+
selector: "ImportDeclaration[source.value='react'][specifiers.0.type='ImportDefaultSpecifier']",
131+
message: "Default React import not allowed",
132+
},
133+
]
125134
settings:
126135
react:
127136
version: detect

site/.prettierignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ yarn-error.log
2626
build-storybook.log
2727
coverage/
2828
storybook-static/
29-
test-results/
29+
test-results/*
30+
e2e/test-results/*
31+
e2e/storageState.json
32+
playwright-report/*
3033

3134
# Make target for updating golden files.
3235
../cli/testdata/.gen-golden

site/e2e/globalSetup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import * as constants from "./constants"
44

55
const globalSetup = async (): Promise<void> => {
66
axios.defaults.baseURL = `http://localhost:${constants.basePort}`
7+
// Create a user
78
await createFirstUser({
89
email: constants.email,
9-
organization: constants.organization,
1010
username: constants.username,
1111
password: constants.password,
12+
trial: false,
1213
})
1314
}
1415

site/e2e/helpers.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Page } from "@playwright/test"
2+
3+
export const buttons = {
4+
starterTemplates: "Starter templates",
5+
dockerTemplate: "Develop in Docker",
6+
useTemplate: "Use template",
7+
createTemplate: "Create template",
8+
createWorkspace: "Create workspace",
9+
submitCreateWorkspace: "Create workspace",
10+
stopWorkspace: "Stop",
11+
startWorkspace: "Start",
12+
}
13+
14+
export const clickButton = async (page: Page, name: string): Promise<void> => {
15+
await page.getByRole("button", { name, exact: true }).click()
16+
}
17+
18+
export const fillInput = async (
19+
page: Page,
20+
label: string,
21+
value: string,
22+
): Promise<void> => {
23+
await page.fill(`text=${label}`, value)
24+
}

site/e2e/tests/basicFlow.spec.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { test } from "@playwright/test"
2+
import { email, password } from "../constants"
3+
import { SignInPage } from "../pom"
4+
import { clickButton, buttons, fillInput } from "../helpers"
5+
6+
test("Basic flow", async ({ baseURL, page }) => {
7+
test.slow()
8+
await page.goto(baseURL + "/", { waitUntil: "networkidle" })
9+
10+
// Log-in with the default credentials we set up in the development server
11+
const signInPage = new SignInPage(baseURL, page)
12+
await signInPage.submitBuiltInAuthentication(email, password)
13+
14+
// create Docker template
15+
await page.waitForSelector("text=Templates")
16+
await page.click("text=Templates")
17+
18+
await clickButton(page, buttons.starterTemplates)
19+
20+
await page.click(`text=${buttons.dockerTemplate}`)
21+
22+
await clickButton(page, buttons.useTemplate)
23+
24+
await clickButton(page, buttons.createTemplate)
25+
26+
// create workspace
27+
await clickButton(page, buttons.createWorkspace)
28+
29+
await fillInput(page, "Workspace Name", "my-workspace")
30+
await clickButton(page, buttons.submitCreateWorkspace)
31+
32+
// stop workspace
33+
await page.waitForSelector("text=Started")
34+
await clickButton(page, buttons.stopWorkspace)
35+
36+
// start workspace
37+
await page.waitForSelector("text=Stopped")
38+
await clickButton(page, buttons.startWorkspace)
39+
await page.waitForSelector("text=Started")
40+
})

site/e2e/tests/login.spec.ts

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

site/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"i18next": "21.9.1",
5858
"js-untar": "2.0.0",
5959
"just-debounce-it": "3.1.1",
60+
"playwright": "^1.29.2",
6061
"react": "18.2.0",
6162
"react-chartjs-2": "4.3.1",
6263
"react-color": "2.19.3",
@@ -81,7 +82,7 @@
8182
"yup": "0.32.11"
8283
},
8384
"devDependencies": {
84-
"@playwright/test": "1.26.1",
85+
"@playwright/test": "1.29.2",
8586
"@storybook/addon-actions": "6.5.9",
8687
"@storybook/addon-essentials": "6.5.12",
8788
"@storybook/addon-links": "6.5.9",

site/src/components/AppLink/AppLinkSkeleton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { makeStyles } from "@material-ui/core/styles"
22
import { Skeleton } from "@material-ui/lab"
3-
import React from "react"
3+
import { FC } from "react"
44
import { borderRadiusSm } from "theme/constants"
55

6-
export const AppLinkSkeleton: React.FC<{ width: number }> = ({ width }) => {
6+
export const AppLinkSkeleton: FC<{ width: number }> = ({ width }) => {
77
const styles = useStyles()
88
return (
99
<Skeleton

site/src/components/CopyableValue/CopyableValue.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { makeStyles } from "@material-ui/core/styles"
22
import Tooltip from "@material-ui/core/Tooltip"
33
import { useClickable } from "hooks/useClickable"
44
import { useClipboard } from "hooks/useClipboard"
5-
import React, { HTMLProps } from "react"
5+
import { FC, HTMLProps } from "react"
66
import { combineClasses } from "util/combineClasses"
77

88
interface CopyableValueProps extends HTMLProps<HTMLDivElement> {
99
value: string
1010
}
1111

12-
export const CopyableValue: React.FC<CopyableValueProps> = ({
12+
export const CopyableValue: FC<CopyableValueProps> = ({
1313
value,
1414
className,
1515
...props

site/src/components/DeploySettingsLayout/Badges.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { makeStyles } from "@material-ui/core/styles"
22
import { Stack } from "components/Stack/Stack"
3-
import React, { PropsWithChildren } from "react"
3+
import { PropsWithChildren, FC } from "react"
44
import { MONOSPACE_FONT_FAMILY } from "theme/constants"
55
import { combineClasses } from "util/combineClasses"
66

7-
export const EnabledBadge: React.FC = () => {
7+
export const EnabledBadge: FC = () => {
88
const styles = useStyles()
99
return (
1010
<span className={combineClasses([styles.badge, styles.enabledBadge])}>
@@ -13,7 +13,7 @@ export const EnabledBadge: React.FC = () => {
1313
)
1414
}
1515

16-
export const EntitledBadge: React.FC = () => {
16+
export const EntitledBadge: FC = () => {
1717
const styles = useStyles()
1818
return (
1919
<span className={combineClasses([styles.badge, styles.enabledBadge])}>
@@ -22,7 +22,7 @@ export const EntitledBadge: React.FC = () => {
2222
)
2323
}
2424

25-
export const DisabledBadge: React.FC = () => {
25+
export const DisabledBadge: FC = () => {
2626
const styles = useStyles()
2727
return (
2828
<span className={combineClasses([styles.badge, styles.disabledBadge])}>
@@ -31,7 +31,7 @@ export const DisabledBadge: React.FC = () => {
3131
)
3232
}
3333

34-
export const EnterpriseBadge: React.FC = () => {
34+
export const EnterpriseBadge: FC = () => {
3535
const styles = useStyles()
3636
return (
3737
<span className={combineClasses([styles.badge, styles.enterpriseBadge])}>
@@ -40,7 +40,7 @@ export const EnterpriseBadge: React.FC = () => {
4040
)
4141
}
4242

43-
export const VersionBadge: React.FC<{
43+
export const VersionBadge: FC<{
4444
version: string
4545
}> = ({ version }) => {
4646
const styles = useStyles()
@@ -51,7 +51,7 @@ export const VersionBadge: React.FC<{
5151
)
5252
}
5353

54-
export const Badges: React.FC<PropsWithChildren> = ({ children }) => {
54+
export const Badges: FC<PropsWithChildren> = ({ children }) => {
5555
const styles = useStyles()
5656
return (
5757
<Stack

site/src/components/DeploySettingsLayout/DeploySettingsLayout.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import { makeStyles } from "@material-ui/core/styles"
22
import { Margins } from "components/Margins/Margins"
33
import { Stack } from "components/Stack/Stack"
44
import { Sidebar } from "./Sidebar"
5-
import React, {
5+
import {
66
createContext,
77
PropsWithChildren,
88
Suspense,
99
useContext,
1010
useEffect,
11+
FC,
1112
} from "react"
1213
import { useActor } from "@xstate/react"
1314
import { XServiceContext } from "xServices/StateContext"
@@ -30,9 +31,7 @@ export const useDeploySettings = (): DeploySettingsContextValue => {
3031
return context
3132
}
3233

33-
export const DeploySettingsLayout: React.FC<PropsWithChildren> = ({
34-
children,
35-
}) => {
34+
export const DeploySettingsLayout: FC<PropsWithChildren> = ({ children }) => {
3635
const xServices = useContext(XServiceContext)
3736
const [state, send] = useActor(xServices.deploymentConfigXService)
3837
const styles = useStyles()

site/src/components/DeploySettingsLayout/Fieldset.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { makeStyles } from "@material-ui/core/styles"
2-
import React from "react"
2+
import { FC, ReactNode, FormEventHandler } from "react"
33
import Button from "@material-ui/core/Button"
44

5-
export const Fieldset: React.FC<{
6-
children: React.ReactNode
5+
export const Fieldset: FC<{
6+
children: ReactNode
77
title: string | JSX.Element
88
validation?: string | JSX.Element | false
99
button?: JSX.Element | false
10-
onSubmit: React.FormEventHandler<HTMLFormElement>
10+
onSubmit: FormEventHandler<HTMLFormElement>
1111
isSubmitting?: boolean
1212
}> = ({ title, children, validation, button, onSubmit, isSubmitting }) => {
1313
const styles = useStyles()

site/src/components/DeploySettingsLayout/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import Button from "@material-ui/core/Button"
22
import { makeStyles } from "@material-ui/core/styles"
33
import LaunchOutlined from "@material-ui/icons/LaunchOutlined"
44
import { Stack } from "components/Stack/Stack"
5-
import React from "react"
5+
import { FC } from "react"
66

7-
export const Header: React.FC<{
7+
export const Header: FC<{
88
title: string | JSX.Element
99
description?: string | JSX.Element
1010
secondary?: boolean

0 commit comments

Comments
 (0)