Skip to content

Commit f68b493

Browse files
author
Teffen
authored
Merge branch 'main' into openvsx-switch
2 parents 6a53c2b + 1b60ef4 commit f68b493

Some content is hidden

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

55 files changed

+2414
-3115
lines changed

.github/lock.yml

-37
This file was deleted.

.github/workflows/ci.yaml

+34-34
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ jobs:
1919
name: Pre-build checks
2020
runs-on: ubuntu-latest
2121
timeout-minutes: 15
22-
env:
23-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2422
steps:
2523
- name: Checkout repo
2624
uses: actions/checkout@v2
@@ -33,14 +31,18 @@ jobs:
3331
- name: Install helm
3432
uses: azure/setup-helm@v1.1
3533

36-
- name: Fetch dependencies from cache
37-
id: cache-yarn
38-
uses: actions/cache@v2
39-
with:
40-
path: "**/node_modules"
41-
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
42-
restore-keys: |
43-
yarn-build-
34+
# NOTE@jsjoeio
35+
# disabling this until we can audit the build process
36+
# and the usefulness of this step
37+
# See: https://github.com/cdr/code-server/issues/4287
38+
# - name: Fetch dependencies from cache
39+
# id: cache-yarn
40+
# uses: actions/cache@v2
41+
# with:
42+
# path: "**/node_modules"
43+
# key: yarn-build-${{ hashFiles('**/yarn.lock') }}
44+
# restore-keys: |
45+
# yarn-build-
4446

4547
- name: Install dependencies
4648
# if: steps.cache-yarn.outputs.cache-hit != 'true'
@@ -54,19 +56,11 @@ jobs:
5456
run: yarn lint
5557
if: success()
5658

57-
- name: Run code-server unit tests
58-
run: yarn test:unit
59-
if: success()
60-
61-
- name: Upload coverage report to Codecov
62-
run: yarn coverage
63-
if: success()
64-
6559
audit-ci:
6660
name: Run audit-ci
6761
needs: prebuild
6862
runs-on: ubuntu-latest
69-
timeout-minutes: 5
63+
timeout-minutes: 15
7064
steps:
7165
- name: Checkout repo
7266
uses: actions/checkout@v2
@@ -98,6 +92,8 @@ jobs:
9892
needs: prebuild
9993
runs-on: ubuntu-latest
10094
timeout-minutes: 30
95+
env:
96+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
10197
steps:
10298
- uses: actions/checkout@v2
10399
with:
@@ -146,14 +142,25 @@ jobs:
146142
path: |
147143
vendor/modules/code-oss-dev/.build
148144
vendor/modules/code-oss-dev/out-build
149-
vendor/modules/code-oss-dev/out-vscode
150-
vendor/modules/code-oss-dev/out-vscode-min
151-
key: vscode-build-${{ steps.vscode-rev.outputs.rev }}
145+
vendor/modules/code-oss-dev/out-vscode-reh-web
146+
vendor/modules/code-oss-dev/out-vscode-reh-web-min
147+
key: vscode-reh-build-${{ steps.vscode-rev.outputs.rev }}
152148

153149
- name: Build vscode
154150
if: steps.cache-vscode.outputs.cache-hit != 'true'
155151
run: yarn build:vscode
156152

153+
# Our code imports code from VS Code's `out` directory meaning VS Code
154+
# must be built before running these tests.
155+
# TODO: Move to its own step?
156+
- name: Run code-server unit tests
157+
run: yarn test:unit
158+
if: success()
159+
160+
- name: Upload coverage report to Codecov
161+
run: yarn coverage
162+
if: success()
163+
157164
# The release package does not contain any native modules
158165
# and is neutral to architecture/os/libc version.
159166
- name: Create release package
@@ -283,7 +290,7 @@ jobs:
283290
echo "$HOME/.local/bin" >> $GITHUB_PATH
284291
285292
- name: Install cross-compiler
286-
run: sudo apt install $PACKAGE
293+
run: sudo apt update && sudo apt install $PACKAGE
287294
env:
288295
PACKAGE: ${{ format('g++-{0}', matrix.prefix) }}
289296

@@ -371,9 +378,6 @@ jobs:
371378
with:
372379
node-version: "14"
373380

374-
- name: Install playwright OS dependencies
375-
run: npx playwright install-deps
376-
377381
- name: Fetch dependencies from cache
378382
id: cache-yarn
379383
uses: actions/cache@v2
@@ -399,14 +403,10 @@ jobs:
399403
if: steps.cache-yarn.outputs.cache-hit != 'true'
400404
run: yarn --frozen-lockfile
401405

402-
# HACK: this shouldn't need to exist, but put it here anyway
403-
# in an attempt to solve Playwright cache failures.
404-
- name: Reinstall playwright
405-
if: steps.cache-yarn.outputs.cache-hit == 'true'
406+
- name: Install Playwright OS dependencies
406407
run: |
407-
cd test/
408-
rm -r node_modules/playwright
409-
yarn install --check-files
408+
./test/node_modules/.bin/playwright install-deps
409+
./test/node_modules/.bin/playwright install
410410
411411
- name: Run end-to-end tests
412412
run: yarn test:e2e
@@ -428,7 +428,7 @@ jobs:
428428
uses: actions/checkout@v2
429429
- name: Run Trivy vulnerability scanner in repo mode
430430
#Commit SHA for v0.0.17
431-
uses: aquasecurity/trivy-action@8eccb5539730451af599c84f444c6d6cf0fc2bb0
431+
uses: aquasecurity/trivy-action@1ccef265f594a7555a720f623a461a3d69b45bf7
432432
with:
433433
scan-type: "fs"
434434
scan-ref: "."

.github/workflows/docker.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
workflow_dispatch:
77

88
release:
9-
types: [published]
9+
types: [released]
1010

1111
jobs:
1212
docker-images:

.github/workflows/installer.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ on:
55
branches:
66
- main
77
paths:
8-
- "installer.sh"
8+
- "install.sh"
99
pull_request:
1010
branches:
1111
- main
12+
paths:
13+
- "install.sh"
1214

1315
jobs:
1416
ubuntu:

.github/workflows/npm-brew.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
workflow_dispatch:
77

88
release:
9-
types: [published]
9+
types: [released]
1010

1111
jobs:
1212
# NOTE: this job requires curl, jq and yarn

.github/workflows/scripts.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ on:
55
branches:
66
- main
77
paths:
8-
- "installer.sh"
8+
- "**.sh"
9+
- "**.bats"
910
pull_request:
1011
branches:
1112
- main
13+
paths:
14+
- "**.sh"
15+
- "**.bats"
1216

1317
jobs:
1418
test:

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ vendor/modules
1212
node-*
1313
/plugins
1414
/lib/coder-cloud-agent
15-
/lib/linkup
1615
.home
1716
coverage
1817
**/.DS_Store

ci/build/build-code-server.sh

+2-9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ main() {
2020
source ./ci/lib.sh
2121
OS="$(uname | tr '[:upper:]' '[:lower:]')"
2222

23+
mkdir -p ./lib
24+
2325
if ! [ -f ./lib/coder-cloud-agent ]; then
2426
echo "Downloading the cloud agent..."
2527

@@ -28,15 +30,6 @@ main() {
2830
chmod +x ./lib/coder-cloud-agent
2931
set -e
3032
fi
31-
32-
if ! [ -f ./lib/linkup ]; then
33-
echo "Downloading Link agent..."
34-
35-
set +e
36-
curl -fsSL "https://storage.googleapis.com/coder-link-releases/latest/linkup-$OS-$ARCH" -o ./lib/linkup
37-
chmod +x ./lib/linkup
38-
set -e
39-
fi
4033
}
4134

4235
main "$@"

ci/build/build-release.sh

+5-6
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,13 @@ EOF
6161
rsync node_modules/ "$RELEASE_PATH/node_modules"
6262
mkdir -p "$RELEASE_PATH/lib"
6363
rsync ./lib/coder-cloud-agent "$RELEASE_PATH/lib"
64-
rsync ./lib/linkup "$RELEASE_PATH/lib"
6564
fi
6665
}
6766

6867
bundle_vscode() {
6968
mkdir -p "$VSCODE_OUT_PATH"
7069
rsync "$VSCODE_SRC_PATH/yarn.lock" "$VSCODE_OUT_PATH"
71-
rsync "$VSCODE_SRC_PATH/out-vscode${MINIFY:+-min}/" "$VSCODE_OUT_PATH/out"
70+
rsync "$VSCODE_SRC_PATH/out-vscode-reh-web${MINIFY:+-min}/" "$VSCODE_OUT_PATH/out"
7271

7372
rsync "$VSCODE_SRC_PATH/.build/extensions/" "$VSCODE_OUT_PATH/extensions"
7473
if [ "$KEEP_MODULES" = 0 ]; then
@@ -80,17 +79,17 @@ bundle_vscode() {
8079
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions"
8180
rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions"
8281

83-
mkdir -p "$VSCODE_OUT_PATH/resources/"{linux,web}
84-
rsync "$VSCODE_SRC_PATH/resources/linux/" "$VSCODE_OUT_PATH/resources/linux/"
85-
rsync "$VSCODE_SRC_PATH/resources/web/" "$VSCODE_OUT_PATH/resources/web/"
82+
mkdir -p "$VSCODE_OUT_PATH/resources/"
83+
rsync "$VSCODE_SRC_PATH/resources/" "$VSCODE_OUT_PATH/resources/"
8684

8785
# Add the commit and date and enable telemetry. This just makes telemetry
8886
# available; telemetry can still be disabled by flag or setting.
8987
jq --slurp '.[0] * .[1]' "$VSCODE_SRC_PATH/product.json" <(
9088
cat << EOF
9189
{
9290
"enableTelemetry": true,
93-
"commit": "$(git rev-parse HEAD)",
91+
"commit": "$(cd "$VSCODE_SRC_PATH" && git rev-parse HEAD)",
92+
"quality": "stable",
9493
"date": $(jq -n 'now | todate')
9594
}
9695
EOF

ci/build/build-vscode.sh

+2-7
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@ main() {
1111

1212
cd vendor/modules/code-oss-dev
1313

14-
yarn gulp compile-build compile-extensions-build compile-extension-media compile-web
15-
16-
yarn gulp optimize --gulpfile ./coder.js
17-
18-
if [[ $MINIFY ]]; then
19-
yarn gulp minify --gulpfile ./coder.js
20-
fi
14+
# Any platform works since we have our own packaging step (for now).
15+
yarn gulp "vscode-reh-web-linux-x64${MINIFY:+-min}"
2116
}
2217

2318
main "$@"

ci/build/npm-postinstall.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,15 @@ main() {
5757
esac
5858

5959
OS="$(uname | tr '[:upper:]' '[:lower:]')"
60+
61+
mkdir -p ./lib
62+
6063
if curl -fsSL "https://github.com/cdr/cloud-agent/releases/latest/download/cloud-agent-$OS-$ARCH" -o ./lib/coder-cloud-agent; then
6164
chmod +x ./lib/coder-cloud-agent
6265
else
6366
echo "Failed to download cloud agent; --link will not work"
6467
fi
6568

66-
if curl -fsSL "https://storage.googleapis.com/coder-link-releases/latest/linkup-$OS-$ARCH" -o ./lib/linkup; then
67-
chmod +x ./lib/linkup
68-
else
69-
echo "Failed to download Link agent; the Link extension will not work"
70-
fi
71-
7269
if ! vscode_yarn; then
7370
echo "You may not have the required dependencies to build the native modules."
7471
echo "Please see https://github.com/cdr/code-server/blob/master/docs/npm.md"

ci/dev/postinstall.sh

+15-14
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,28 @@ main() {
66

77
echo "Installing code-server test dependencies..."
88

9+
local args=(install)
10+
if [[ ${CI-} ]]; then
11+
args+=(--frozen-lockfile)
12+
fi
13+
914
cd test
10-
yarn install
15+
yarn "${args[@]}"
1116
cd ..
1217

1318
cd vendor
1419
echo "Installing vendor dependencies..."
1520

16-
# * We install in 'modules' instead of 'node_modules' because VS Code's extensions
17-
# use a webpack config which cannot differentiate between its own node_modules
18-
# and itself being in a directory with the same name.
19-
#
20-
# * We ignore scripts because NPM/Yarn's default behavior is to assume that
21-
# devDependencies are not needed, and that even git repo based packages are
22-
# assumed to be compiled. Because the default behavior for VS Code's `postinstall`
23-
# assumes we're also compiled, this needs to be ignored.
21+
# We install in 'modules' instead of 'node_modules' because VS Code's
22+
# extensions use a webpack config which cannot differentiate between its own
23+
# node_modules and itself being in a directory with the same name.
24+
args+=(--modules-folder modules)
2425

25-
local args=(install --modules-folder modules --ignore-scripts)
26-
27-
if [[ ${CI-} ]]; then
28-
args+=("--frozen-lockfile")
29-
fi
26+
# We ignore scripts because NPM/Yarn's default behavior is to assume that
27+
# devDependencies are not needed, and that even git repo based packages are
28+
# assumed to be compiled. Because the default behavior for VS Code's
29+
# `postinstall` assumes we're also compiled, this needs to be ignored.
30+
args+=(--ignore-scripts)
3031

3132
yarn "${args[@]}"
3233

0 commit comments

Comments
 (0)