Skip to content

Commit 54fa260

Browse files
authored
Merge branch 'main' into sidebar-icons
2 parents fde44d9 + 17aaa8b commit 54fa260

Some content is hidden

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

52 files changed

+612
-277
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
* @coder/code-server-reviewers
22

33
ci/helm-chart/ @Matthew-Beckett @alexgorbatchev
4+
5+
docs/install.md @GNUxeava

.github/workflows/ci.yaml

Lines changed: 93 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ jobs:
156156
uses: actions/cache@v3
157157
with:
158158
path: lib/vscode-reh-web-*
159-
key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ steps.version.outputs.version }}-${{ hashFiles('patches/*.diff') }}
159+
key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ steps.version.outputs.version }}-${{ hashFiles('patches/*.diff', 'ci/build/build-vscode.sh') }}
160160

161161
- name: Build vscode
162162
if: steps.cache-vscode.outputs.cache-hit != 'true'
@@ -198,9 +198,9 @@ jobs:
198198
# This environment "npm" requires someone from
199199
# coder/code-server-reviewers to approve the PR before this job runs.
200200
environment: npm
201-
# Only run if PR comes from base repo
201+
# Only run if PR comes from base repo or event is not a PR
202202
# Reason: forks cannot access secrets and this will always fail
203-
if: github.event.pull_request.head.repo.full_name == github.repository
203+
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
204204
runs-on: ubuntu-latest
205205
steps:
206206
- name: Checkout repo
@@ -461,7 +461,6 @@ jobs:
461461
uses: actions/checkout@v3
462462
with:
463463
fetch-depth: 0
464-
submodules: true
465464

466465
- name: Install Node.js v16
467466
uses: actions/setup-node@v3
@@ -491,15 +490,15 @@ jobs:
491490
492491
- name: Install dependencies
493492
if: steps.cache-yarn.outputs.cache-hit != 'true'
494-
run: yarn --frozen-lockfile
493+
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
495494

496495
- name: Install Playwright OS dependencies
497496
run: |
498497
./test/node_modules/.bin/playwright install-deps
499498
./test/node_modules/.bin/playwright install
500499
501500
- name: Run end-to-end tests
502-
run: yarn test:e2e
501+
run: yarn test:e2e --global-timeout 840000
503502

504503
- name: Upload test artifacts
505504
if: always()
@@ -511,6 +510,93 @@ jobs:
511510
- name: Remove release packages and test artifacts
512511
run: rm -rf ./release-packages ./test/test-results
513512

513+
test-e2e-proxy:
514+
name: End-to-end tests behind proxy
515+
needs: package-linux-amd64
516+
runs-on: ubuntu-latest
517+
timeout-minutes: 25
518+
env:
519+
# Since we build code-server we might as well run tests from the release
520+
# since VS Code will load faster due to the bundling.
521+
CODE_SERVER_TEST_ENTRY: "./release-packages/code-server-linux-amd64"
522+
steps:
523+
- name: Checkout repo
524+
uses: actions/checkout@v3
525+
with:
526+
fetch-depth: 0
527+
528+
- name: Install Node.js v16
529+
uses: actions/setup-node@v3
530+
with:
531+
node-version: "16"
532+
533+
- name: Fetch dependencies from cache
534+
id: cache-yarn
535+
uses: actions/cache@v3
536+
with:
537+
path: "**/node_modules"
538+
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
539+
restore-keys: |
540+
yarn-build-
541+
542+
- name: Download release packages
543+
uses: actions/download-artifact@v3
544+
with:
545+
name: release-packages
546+
path: ./release-packages
547+
548+
- name: Untar code-server release
549+
run: |
550+
cd release-packages
551+
tar -xzf code-server*-linux-amd64.tar.gz
552+
mv code-server*-linux-amd64 code-server-linux-amd64
553+
554+
- name: Install dependencies
555+
if: steps.cache-yarn.outputs.cache-hit != 'true'
556+
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
557+
558+
- name: Install Playwright OS dependencies
559+
run: |
560+
./test/node_modules/.bin/playwright install-deps
561+
./test/node_modules/.bin/playwright install
562+
563+
- name: Cache Caddy
564+
uses: actions/cache@v2
565+
id: caddy-cache
566+
with:
567+
path: |
568+
~/.cache/caddy
569+
key: cache-caddy-2.5.2
570+
571+
- name: Install Caddy
572+
env:
573+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
574+
if: steps.caddy-cache.outputs.cache-hit != 'true'
575+
run: |
576+
gh release download v2.5.2 --repo caddyserver/caddy --pattern "caddy_2.5.2_linux_amd64.tar.gz"
577+
mkdir -p ~/.cache/caddy
578+
tar -xzf caddy_2.5.2_linux_amd64.tar.gz --directory ~/.cache/caddy
579+
580+
- name: Start Caddy
581+
run: sudo ~/.cache/caddy/caddy start --config ./ci/Caddyfile
582+
583+
- name: Run end-to-end tests
584+
run: yarn test:e2e:proxy
585+
586+
- name: Stop Caddy
587+
if: always()
588+
run: sudo ~/.cache/caddy/caddy stop --config ./ci/Caddyfile
589+
590+
- name: Upload test artifacts
591+
if: always()
592+
uses: actions/upload-artifact@v3
593+
with:
594+
name: failed-test-videos-proxy
595+
path: ./test/test-results
596+
597+
- name: Remove release packages and test artifacts
598+
run: rm -rf ./release-packages ./test/test-results
599+
514600
trivy-scan-repo:
515601
permissions:
516602
contents: read # for actions/checkout to fetch code
@@ -523,7 +609,7 @@ jobs:
523609
fetch-depth: 0
524610

525611
- name: Run Trivy vulnerability scanner in repo mode
526-
uses: aquasecurity/trivy-action@81b9a6f5abb1047d697af7a3ca18c13f55a97315
612+
uses: aquasecurity/trivy-action@cb606dfdb0d2b3698ace62192088ef4f5360b24f
527613
with:
528614
scan-type: "fs"
529615
scan-ref: "."

.github/workflows/installer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
alpine:
4040
name: Test installer on Alpine
4141
runs-on: ubuntu-latest
42-
container: "alpine:3.14"
42+
container: "alpine:3.16"
4343
steps:
4444
- name: Checkout repo
4545
uses: actions/checkout@v3

.github/workflows/scripts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
name: Run script unit tests
3939
runs-on: ubuntu-latest
4040
# This runs on Alpine to make sure we're testing with actual sh.
41-
container: "alpine:3.14"
41+
container: "alpine:3.16"
4242
steps:
4343
- name: Checkout repo
4444
uses: actions/checkout@v3

.github/workflows/trivy-docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
uses: actions/checkout@v3
5252

5353
- name: Run Trivy vulnerability scanner in image mode
54-
uses: aquasecurity/trivy-action@81b9a6f5abb1047d697af7a3ca18c13f55a97315
54+
uses: aquasecurity/trivy-action@cb606dfdb0d2b3698ace62192088ef4f5360b24f
5555
with:
5656
image-ref: "docker.io/codercom/code-server:latest"
5757
ignore-unfixed: true

ci/Caddyfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
admin localhost:4444
3+
}
4+
:8000 {
5+
@portLocalhost path_regexp port ^/([0-9]+)\/ide
6+
handle @portLocalhost {
7+
uri strip_prefix {re.port.1}/ide
8+
reverse_proxy localhost:{re.port.1}
9+
}
10+
11+
handle {
12+
respond "Bad hostname" 400
13+
}
14+
15+
}

ci/build/build-release.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ bundle_vscode() {
110110
rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json"
111111
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions/yarn.lock"
112112
rsync "$VSCODE_SRC_PATH/extensions/postinstall.mjs" "$VSCODE_OUT_PATH/extensions/postinstall.mjs"
113-
114-
pushd "$VSCODE_OUT_PATH"
115-
symlink_asar
116-
popd
117113
}
118114

119115
main "$@"

ci/build/build-standalone-release.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ main() {
2727
ln -s "./bin/code-server" "$RELEASE_PATH/code-server"
2828
ln -s "./lib/node" "$RELEASE_PATH/node"
2929

30-
cd "$RELEASE_PATH"
30+
pushd "$RELEASE_PATH"
3131
yarn --production --frozen-lockfile
32+
popd
3233
}
3334

3435
main "$@"

ci/build/build-vscode.sh

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,38 @@ set -euo pipefail
66
# MINIFY controls whether a minified version of vscode is built.
77
MINIFY=${MINIFY-true}
88

9+
delete-bin-script() {
10+
rm -f "lib/vscode-reh-web-linux-x64/bin/$1"
11+
}
12+
13+
copy-bin-script() {
14+
local script="$1"
15+
local dest="lib/vscode-reh-web-linux-x64/bin/$script"
16+
cp "lib/vscode/resources/server/bin/$script" "$dest"
17+
sed -i.bak "s/@@VERSION@@/$(vscode_version)/g" "$dest"
18+
sed -i.bak "s/@@COMMIT@@/$VSCODE_DISTRO_COMMIT/g" "$dest"
19+
sed -i.bak "s/@@APPNAME@@/code-server/g" "$dest"
20+
21+
# Fix Node path on Darwin and Linux.
22+
# We do not want expansion here; this text should make it to the file as-is.
23+
# shellcheck disable=SC2016
24+
sed -i.bak 's/^ROOT=\(.*\)$/VSROOT=\1\nROOT="$(dirname "$(dirname "$VSROOT")")"/g' "$dest"
25+
sed -i.bak 's/ROOT\/out/VSROOT\/out/g' "$dest"
26+
27+
# Fix Node path on Windows.
28+
sed -i.bak 's/^set ROOT_DIR=\(.*\)$/set ROOT_DIR=%~dp0..\\..\\..\\..\r\nset VSROOT_DIR=\1/g' "$dest"
29+
sed -i.bak 's/%ROOT_DIR%\\out/%VSROOT_DIR%\\out/g' "$dest"
30+
31+
chmod +x "$dest"
32+
rm "$dest.bak"
33+
}
34+
935
main() {
1036
cd "$(dirname "${0}")/../.."
1137

1238
source ./ci/lib.sh
1339

14-
cd lib/vscode
40+
pushd lib/vscode
1541

1642
# Set the commit Code will embed into the product.json. We need to do this
1743
# since Code tries to get the commit from the `.git` directory which will fail
@@ -58,13 +84,31 @@ main() {
5884
EOF
5985
) > product.json
6086

61-
# Any platform works since we have our own packaging step (for now).
87+
# Any platform here works since we will do our own packaging. We have to do
88+
# this because we have an NPM package that could be installed on any platform.
89+
# The correct platform dependencies and scripts will be installed as part of
90+
# the post-install during `npm install` or when building a standalone release.
6291
yarn gulp "vscode-reh-web-linux-x64${MINIFY:+-min}"
6392

6493
# Reset so if you develop after building you will not be stuck with the wrong
6594
# commit (the dev client will use `oss-dev` but the dev server will still use
6695
# product.json which will have `stable-$commit`).
6796
git checkout product.json
97+
98+
popd
99+
100+
# These provide a `code-server` command in the integrated terminal to open
101+
# files in the current instance.
102+
delete-bin-script remote-cli/code-server
103+
copy-bin-script remote-cli/code-darwin.sh
104+
copy-bin-script remote-cli/code-linux.sh
105+
copy-bin-script remote-cli/code.cmd
106+
107+
# These provide a way for terminal applications to open browser windows.
108+
delete-bin-script helpers/browser.sh
109+
copy-bin-script helpers/browser-darwin.sh
110+
copy-bin-script helpers/browser-linux.sh
111+
copy-bin-script helpers/browser.cmd
68112
}
69113

70114
main "$@"

0 commit comments

Comments
 (0)