Skip to content

Commit 79d1e17

Browse files
authored
Merge pull request #1761 from cdr/static
Stop bundling libraries in release
2 parents 9a3b9fc + c00f931 commit 79d1e17

30 files changed

+146
-218
lines changed

.github/workflows/ci.yaml

+8-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
steps:
99
- uses: actions/checkout@v1
1010
- name: Run ./ci/steps/fmt.sh
11-
uses: ./ci/container
11+
uses: ./ci/images/debian8
1212
with:
1313
args: ./ci/steps/fmt.sh
1414

@@ -17,7 +17,7 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v1
1919
- name: Run ./ci/steps/lint.sh
20-
uses: ./ci/container
20+
uses: ./ci/images/debian8
2121
with:
2222
args: ./ci/steps/lint.sh
2323

@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727
- uses: actions/checkout@v1
2828
- name: Run ./ci/steps/test.sh
29-
uses: ./ci/container
29+
uses: ./ci/images/debian8
3030
with:
3131
args: ./ci/steps/test.sh
3232

@@ -35,7 +35,7 @@ jobs:
3535
steps:
3636
- uses: actions/checkout@v1
3737
- name: Run ./ci/steps/release.sh
38-
uses: ./ci/container
38+
uses: ./ci/images/debian8
3939
with:
4040
args: ./ci/steps/release.sh
4141
- name: Upload npm package artifact
@@ -55,7 +55,7 @@ jobs:
5555
name: npm-package
5656
path: ./release-npm-package
5757
- name: Run ./ci/steps/release-packages.sh
58-
uses: ./ci/container
58+
uses: ./ci/images/centos7
5959
with:
6060
args: ./ci/steps/release-packages.sh
6161
- name: Upload release artifacts
@@ -75,7 +75,7 @@ jobs:
7575
name: npm-package
7676
path: ./release-npm-package
7777
- name: Run ./ci/steps/release-packages.sh
78-
uses: ./ci/container/arm64
78+
uses: ./ci/images/centos7
7979
with:
8080
args: ./ci/steps/release-packages.sh
8181
- name: Upload release artifacts
@@ -94,8 +94,6 @@ jobs:
9494
with:
9595
name: npm-package
9696
path: ./release-npm-package
97-
- run: brew unlink node@12
98-
- run: brew install node
9997
- run: ./ci/steps/release-packages.sh
10098
env:
10199
# Otherwise we get rate limited when fetching the ripgrep binary.
@@ -118,7 +116,7 @@ jobs:
118116
name: release-packages
119117
path: ./release-packages
120118
- name: Run ./ci/steps/build-docker-image.sh
121-
uses: ./ci/container
119+
uses: ./ci/images/debian8
122120
with:
123121
args: ./ci/steps/build-docker-image.sh
124122
- name: Upload release image
@@ -138,7 +136,7 @@ jobs:
138136
name: release-packages
139137
path: ./release-packages
140138
- name: Run ./ci/steps/build-docker-image.sh
141-
uses: ./ci/container/arm64
139+
uses: ./ci/images/centos7
142140
with:
143141
args: ./ci/steps/build-docker-image.sh
144142
- name: Upload release image

.github/workflows/publish.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v1
1212
- name: Run ./ci/steps/publish-npm.sh
13-
uses: ./ci/container
13+
uses: ./ci/images/debian8
1414
with:
1515
args: ./ci/steps/publish-npm.sh
1616
env:
@@ -22,7 +22,7 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@v1
2424
- name: Run ./ci/steps/push-docker-manifest.sh
25-
uses: ./ci/container
25+
uses: ./ci/images/debian8
2626
with:
2727
args: ./ci/steps/push-docker-manifest.sh
2828
env:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ release-packages/
99
release-gcp/
1010
release-images/
1111
node_modules
12+
node-*

.ignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib

ci/README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ Make sure you have `$GITHUB_TOKEN` set and [hub](https://github.com/github/hub)
3535
10. Wait for the npm package to be published.
3636
11. Update the homebrew package.
3737
- Send a pull request to [homebrew-core](https://github.com/Homebrew/homebrew-core) with the URL in the [formula](https://github.com/Homebrew/homebrew-core/blob/master/Formula/code-server.rb) updated.
38+
12. Make sure to add a release without the `v` prefix for autoupdate from `3.2.0`.
3839

3940
## dev
4041

4142
This directory contains scripts used for the development of code-server.
4243

43-
- [./ci/dev/container](./dev/container)
44+
- [./ci/dev/image](./dev/image)
4445
- See [./doc/CONTRIBUTING.md](../doc/CONTRIBUTING.md) for docs on the development container.
4546
- [./ci/dev/fmt.sh](./dev/fmt.sh) (`yarn fmt`)
4647
- Runs formatters.
@@ -104,17 +105,17 @@ You can disable minification by setting `MINIFY=`.
104105
- Post install script for the npm package.
105106
- Bundled by`yarn release`.
106107

107-
## release-container
108+
## release-image
108109

109-
This directory contains the release docker container.
110+
This directory contains the release docker container image.
110111

111-
- [./release-container/build.sh](./release-container/build.sh)
112+
- [./release-image/build.sh](./release-image/build.sh)
112113
- Builds the release container with the tag `codercom/code-server-$ARCH:$VERSION`.
113114
- Assumes debian releases are ready in `./release-packages`.
114115

115-
## container
116+
## images
116117

117-
This directory contains the container for CI.
118+
This directory contains the images for CI.
118119

119120
## steps
120121

ci/build/build-packages.sh

+7
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,16 @@ release_archive() {
3030
local release_name="code-server-$VERSION-$OS-$ARCH"
3131
if [[ $OS == "linux" ]]; then
3232
tar -czf "release-packages/$release_name.tar.gz" --transform "s/^\.\/release-standalone/$release_name/" ./release-standalone
33+
elif [[ $OS == "darwin" && $ARCH == "x86_64" ]]; then
34+
# Just exists to make autoupdating from 3.2.0 work again.
35+
mv ./release-standalone "./$release_name"
36+
zip -r "release-packages/$release_name.zip" "./$release_name"
37+
mv "./$release_name" ./release-standalone
38+
return
3339
else
3440
tar -czf "release-packages/$release_name.tar.gz" -s "/^release-standalone/$release_name/" release-standalone
3541
fi
42+
3643
echo "done (release-packages/$release_name)"
3744

3845
release_gcp

ci/build/build-standalone-release.sh

-21
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ main() {
1717
mkdir -p "$RELEASE_PATH/bin"
1818
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
1919
rsync "$node_path" "$RELEASE_PATH/lib/node"
20-
if [[ $OS == "linux" ]]; then
21-
bundle_dynamic_lib libstdc++
22-
bundle_dynamic_lib libgcc_s
23-
elif [[ $OS == "macos" ]]; then
24-
bundle_dynamic_lib libicui18n
25-
bundle_dynamic_lib libicuuc
26-
bundle_dynamic_lib libicudata
27-
fi
2820

2921
ln -s "./bin/code-server" "$RELEASE_PATH/code-server"
3022
ln -s "./lib/node" "$RELEASE_PATH/node"
@@ -33,17 +25,4 @@ main() {
3325
yarn --production --frozen-lockfile
3426
}
3527

36-
bundle_dynamic_lib() {
37-
local lib_name="$1"
38-
local lib_path
39-
40-
if [[ $OS == "linux" ]]; then
41-
lib_path="$(ldd "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $3 }')"
42-
elif [[ $OS == "macos" ]]; then
43-
lib_path="$(otool -L "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $1 }')"
44-
fi
45-
46-
cp "$lib_path" "$RELEASE_PATH/lib"
47-
}
48-
4928
main "$@"

ci/build/code-server.sh

+29-18
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
11
#!/bin/sh
2+
set -eu
23

34
# This script is intended to be bundled into the standalone releases.
45
# Runs code-server with the bundled node binary.
56

6-
# More complicated than readlink -f or realpath to support macOS.
7-
# See https://github.com/cdr/code-server/issues/1537
8-
bin_dir() {
9-
# We read the symlink, which may be relative from $0.
10-
dst="$(readlink "$0")"
11-
# We cd into the $0 directory.
12-
cd "$(dirname "$0")" || exit 1
13-
# Now we can cd into the dst directory.
14-
cd "$(dirname "$dst")" || exit 1
15-
# Finally we use pwd -P to print the absolute path of the directory of $dst.
16-
pwd -P || exit 1
7+
_realpath() {
8+
# See https://github.com/cdr/code-server/issues/1537 on why no realpath or readlink -f.
9+
10+
script="$1"
11+
cd "$(dirname "$script")"
12+
13+
while [ -L "$(basename "$script")" ]; do
14+
if [ -L "./node" ] && [ -L "./code-server" ] &&
15+
[ -f "package.json" ] &&
16+
cat package.json | grep -q '^ "name": "code-server",$'; then
17+
echo "***** Please use the script in bin/code-server instead!" >&2
18+
echo "***** This script will soon be removed!" >&2
19+
echo "***** See the release notes at https://github.com/cdr/code-server/releases/tag/v3.4.0" >&2
20+
fi
21+
22+
script="$(readlink "$(basename "$script")")"
23+
cd "$(dirname "$script")"
24+
done
25+
26+
echo "$PWD/$(basename "$script")"
27+
}
28+
29+
root() {
30+
script="$(_realpath "$0")"
31+
bin_dir="$(dirname "$script")"
32+
dirname "$bin_dir"
1733
}
1834

19-
BIN_DIR=$(bin_dir)
20-
if [ "$(uname)" = "Linux" ]; then
21-
export LD_LIBRARY_PATH="$BIN_DIR/../lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
22-
elif [ "$(uname)" = "Darwin" ]; then
23-
export DYLD_LIBRARY_PATH="$BIN_DIR/../lib${DYLD_LIBRARY_PATH+:$DYLD_LIBRARY_PATH}"
24-
fi
25-
exec "$BIN_DIR/../lib/node" "$BIN_DIR/.." "$@"
35+
ROOT="$(root)"
36+
exec "$ROOT/lib/node" "$ROOT" "$@"

ci/build/test-standalone-release.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ main() {
1515
./release-standalone/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --install-extension ms-python.python
1616
local installed_extensions
1717
installed_extensions="$(./release-standalone/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --list-extensions 2>&1)"
18-
if [[ $installed_extensions != "ms-python.python" ]]; then
18+
if [[ $installed_extensions != "info Using config file ~/.config/code-server/config.yaml
19+
ms-python.python" ]]; then
1920
echo "Unexpected output from listing extensions:"
2021
echo "$installed_extensions"
2122
exit 1

ci/container/arm64/Dockerfile

-53
This file was deleted.

ci/container/arm64/README.md

-6
This file was deleted.

ci/dev/fmt.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44
main() {
55
cd "$(dirname "$0")/../.."
66

7-
shfmt -i 2 -w -s -sr $(git ls-files "*.sh")
7+
shfmt -i 2 -w -sr $(git ls-files "*.sh")
88

99
local prettierExts
1010
prettierExts=(
@@ -24,6 +24,8 @@ main() {
2424
doctoc --title '# FAQ' doc/FAQ.md > /dev/null
2525
doctoc --title '# Setup Guide' doc/guide.md > /dev/null
2626
doctoc --title '# Install' doc/install.md > /dev/null
27+
doctoc --title '# npm Install Requirements' doc/npm.md > /dev/null
28+
doctoc --title '# Contributing' doc/CONTRIBUTING.md > /dev/null
2729

2830
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
2931
echo "Files need generation or are formatted incorrectly:"
File renamed without changes.

ci/dev/container/exec.sh renamed to ci/dev/image/exec.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ run() {
4242

4343
build() {
4444
echo "--- Building $container_name"
45-
docker build -t $container_name ./ci/dev/container > /dev/null
45+
docker build -t $container_name ./ci/dev/image > /dev/null
4646
}
4747

4848
main "$@"

ci/dev/lint.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ main() {
77
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js")
88
stylelint $(git ls-files "*.css")
99
tsc --noEmit
10-
# See comment in ./ci/container/Dockerfile
10+
# See comment in ./ci/image/debian8
1111
if [[ ! ${CI-} ]]; then
12-
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090 $(git ls-files "*.sh")
12+
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh")
1313
fi
1414
}
1515

ci/images/centos7/Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM centos:7
2+
3+
RUN ARCH="$(uname -m | sed 's/86_64/64/; s/aarch64/arm64/')" && \
4+
curl -fsSL "https://nodejs.org/dist/v14.4.0/node-v14.4.0-linux-$ARCH.tar.xz" | tar -C /usr/local -xJ && \
5+
mv /usr/local/node-v14.4.0-linux-$ARCH /usr/local/node-v14.4.0
6+
ENV PATH=/usr/local/node-v14.4.0/bin:$PATH
7+
RUN npm install -g yarn
8+
9+
RUN yum groupinstall -y 'Development Tools'
10+
RUN yum install -y python2 libsecret-devel libX11-devel libxkbfile-devel
11+
12+
RUN npm config set python python2
13+
14+
RUN yum install -y epel-release && yum install -y jq
15+
RUN yum install -y rsync
16+
17+
# Copied from ../debian8/Dockerfile
18+
# Install Go dependencies
19+
RUN ARCH="$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" && \
20+
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
21+
ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH
22+
ENV GO111MODULE=on
23+
RUN go get mvdan.cc/sh/v3/cmd/shfmt
24+
RUN go get github.com/goreleaser/nfpm/cmd/nfpm
25+
26+
RUN curl -fsSL https://get.docker.com | sh

ci/container/Dockerfile renamed to ci/images/debian8/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ RUN ARCH="$(dpkg --print-architecture)" && \
4343
# rm -R shellcheck*
4444

4545
# Install Go dependencies
46-
RUN ARCH="$(dpkg --print-architecture)" && \
46+
RUN ARCH="$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" && \
4747
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
4848
ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH
4949
ENV GO111MODULE=on
File renamed without changes.

0 commit comments

Comments
 (0)