Compare commits

...

4 Commits
main ... pure

Author SHA1 Message Date
Asher a3a6d4d701
Replace Docker script with pure 2021-02-11 16:45:40 -06:00
Asher d193d19756
[wip] keep modules 2021-02-11 16:45:39 -06:00
Asher 164e8ac0a1
Move archive workaround into ci.yaml
This lets us use the scripts locally without the extra steps.
2021-02-11 14:41:52 -06:00
Asher 1f36c34267
Remove vscode:reset script
It's no longer applicable with the switch to a subtree.
2021-02-10 15:20:42 -06:00
10 changed files with 85 additions and 108 deletions

View File

@ -49,6 +49,11 @@ jobs:
uses: ./ci/images/debian10 uses: ./ci/images/debian10
with: with:
args: ./ci/steps/release.sh args: ./ci/steps/release.sh
# https://github.com/actions/upload-artifact/issues/38
- name: Create npm package artifact
run: |
mkdir -p release-npm-package
tar -czf release-npm-package/package.tar.gz release
- name: Upload npm package artifact - name: Upload npm package artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
@ -60,11 +65,14 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Download npm package - name: Download npm package artifact
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:
name: npm-package name: npm-package
path: ./release-npm-package path: ./release-npm-package
# https://github.com/actions/upload-artifact/issues/38
- name: Extract npm package artifact
run: tar -xzf release-npm-package/package.tar.gz
- name: Run ./ci/steps/release-packages.sh - name: Run ./ci/steps/release-packages.sh
uses: ./ci/images/centos7 uses: ./ci/images/centos7
with: with:
@ -80,11 +88,14 @@ jobs:
runs-on: ubuntu-arm64-latest runs-on: ubuntu-arm64-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Download npm package - name: Download npm package artifact
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:
name: npm-package name: npm-package
path: ./release-npm-package path: ./release-npm-package
# https://github.com/actions/upload-artifact/issues/38
- name: Extract npm package artifact
run: tar -xzf release-npm-package/package.tar.gz
- name: Run ./ci/steps/release-packages.sh - name: Run ./ci/steps/release-packages.sh
uses: ./ci/images/centos7 uses: ./ci/images/centos7
with: with:
@ -100,11 +111,14 @@ jobs:
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Download npm package - name: Download npm package artifact
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:
name: npm-package name: npm-package
path: ./release-npm-package path: ./release-npm-package
# https://github.com/actions/upload-artifact/issues/38
- name: Extract npm package artifact
run: tar -xzf release-npm-package/package.tar.gz
- run: ./ci/steps/release-packages.sh - run: ./ci/steps/release-packages.sh
env: env:
# Otherwise we get rate limited when fetching the ripgrep binary. # Otherwise we get rate limited when fetching the ripgrep binary.

13
.npmignore Normal file
View File

@ -0,0 +1,13 @@
# Ignored by default but not sure it applies to sub-directories.
# TODO: test
# node_modules
# Doesn't need to be included as it will be downloaded during postinstall.
/lib/coder-cloud-agent
# Node and the code-server entry script are not used for the npm version since
# the user already has Node.
/bin
/lib/node
/code-server
/node

View File

@ -6,10 +6,6 @@ set -euo pipefail
# MINIFY controls whether minified vscode is bundled. # MINIFY controls whether minified vscode is bundled.
MINIFY="${MINIFY-true}" MINIFY="${MINIFY-true}"
# KEEP_MODULES controls whether the script cleans all node_modules requiring a yarn install
# to run first.
KEEP_MODULES="${KEEP_MODULES-0}"
main() { main() {
cd "$(dirname "${0}")/../.." cd "$(dirname "${0}")/../.."
source ./ci/lib.sh source ./ci/lib.sh
@ -61,11 +57,9 @@ EOF
rsync yarn.lock "$RELEASE_PATH" rsync yarn.lock "$RELEASE_PATH"
rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh" rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh"
if [ "$KEEP_MODULES" = 1 ]; then
rsync node_modules/ "$RELEASE_PATH/node_modules" rsync node_modules/ "$RELEASE_PATH/node_modules"
mkdir -p "$RELEASE_PATH/lib" mkdir -p "$RELEASE_PATH/lib"
rsync ./lib/coder-cloud-agent "$RELEASE_PATH/lib" rsync ./lib/coder-cloud-agent "$RELEASE_PATH/lib"
fi
} }
bundle_vscode() { bundle_vscode() {
@ -74,11 +68,7 @@ bundle_vscode() {
rsync "$VSCODE_SRC_PATH/out-vscode${MINIFY:+-min}/" "$VSCODE_OUT_PATH/out" rsync "$VSCODE_SRC_PATH/out-vscode${MINIFY:+-min}/" "$VSCODE_OUT_PATH/out"
rsync "$VSCODE_SRC_PATH/.build/extensions/" "$VSCODE_OUT_PATH/extensions" rsync "$VSCODE_SRC_PATH/.build/extensions/" "$VSCODE_OUT_PATH/extensions"
if [ "$KEEP_MODULES" = 0 ]; then
rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules"
else
rsync "$VSCODE_SRC_PATH/node_modules/" "$VSCODE_OUT_PATH/node_modules" rsync "$VSCODE_SRC_PATH/node_modules/" "$VSCODE_OUT_PATH/node_modules"
fi
rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions" rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions"
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions" rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions"
rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions" rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions"

View File

@ -1,31 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
main() {
cd "$(dirname "$0")/../../.."
source ./ci/lib.sh
mkdir -p .home
docker run \
-it \
--rm \
-v "$PWD:/src" \
-e HOME="/src/.home" \
-e USER="coder" \
-e GITHUB_TOKEN \
-e KEEP_MODULES \
-e MINIFY \
-w /src \
-p 127.0.0.1:8080:8080 \
-u "$(id -u):$(id -g)" \
-e CI \
"$(docker_build ./ci/images/"${IMAGE-debian10}")" \
"$@"
}
docker_build() {
docker build "$@" >&2
docker build -q "$@"
}
main "$@"

View File

@ -1,12 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
main() {
cd "$(dirname "$0")/../.."
cd ./lib/vscode
git add -A
git reset --hard
}
main "$@"

View File

@ -15,9 +15,6 @@ main() {
fi fi
PATH="$PWD/node-$NODE_VERSION-$NODE_OS-$NODE_ARCH/bin:$PATH" PATH="$PWD/node-$NODE_VERSION-$NODE_OS-$NODE_ARCH/bin:$PATH"
# https://github.com/actions/upload-artifact/issues/38
tar -xzf release-npm-package/package.tar.gz
yarn release:standalone yarn release:standalone
yarn test:standalone-release yarn test:standalone-release
yarn package yarn package

View File

@ -8,10 +8,6 @@ main() {
yarn build yarn build
yarn build:vscode yarn build:vscode
yarn release yarn release
# https://github.com/actions/upload-artifact/issues/38
mkdir -p release-npm-package
tar -czf release-npm-package/package.tar.gz release
} }
main "$@" main "$@"

View File

@ -50,8 +50,8 @@ yarn watch
To develop inside an isolated Docker container: To develop inside an isolated Docker container:
```shell ```shell
./ci/dev/image/run.sh yarn pure yarn
./ci/dev/image/run.sh yarn watch pure yarn watch
``` ```
`yarn watch` will live reload changes to the source. `yarn watch` will live reload changes to the source.
@ -63,7 +63,6 @@ If you need to update VS Code, you can update the subtree with one line. Here's
```shell ```shell
# Add vscode as a new remote if you haven't already and fetch # Add vscode as a new remote if you haven't already and fetch
git remote add -f vscode https://github.com/microsoft/vscode.git git remote add -f vscode https://github.com/microsoft/vscode.git
git subtree pull --prefix lib/vscode vscode release/1.52 --squash --message "Update VS Code to 1.52" git subtree pull --prefix lib/vscode vscode release/1.52 --squash --message "Update VS Code to 1.52"
``` ```
@ -72,50 +71,42 @@ git subtree pull --prefix lib/vscode vscode release/1.52 --squash --message "Upd
You can build using: You can build using:
```shell ```shell
./ci/dev/image/run.sh ./ci/steps/release.sh pure release
``` ```
Run your build with: This builds the release into the `release` directory. You can run this built
release directly with:
```shell ```shell
cd release
yarn --production
# Runs the built JavaScript with Node.
node .
```
Build the release packages (make sure that you run `./ci/steps/release.sh` first):
```shell
IMAGE=centos7 ./ci/dev/image/run.sh ./ci/steps/release-packages.sh
# The standalone release is in ./release-standalone
# .deb, .rpm and the standalone archive are in ./release-packages
```
The `release.sh` script is equal to running:
```shell
yarn
yarn build
yarn build:vscode
yarn release
```
And `release-packages.sh` is equal to:
```shell
yarn release:standalone
yarn test:standalone-release
yarn package
```
For a faster release build, you can run instead:
```shell
KEEP_MODULES=1 ./ci/steps/release.sh
node ./release node ./release
``` ```
Build the release packages (make sure that you run `pure release` first):
```shell
pure package
```
The standalone release will be in `./release-standalone` The `.deb`, `.rpm` and
the standalone archive will be in `./release-packages`.
Running `pure release` is equal to running:
```shell
pure yarn --frozen-lockfile
pure yarn build
pure yarn build:vscode
pure yarn release
```
And `pure package` is equal to:
```shell
pure yarn release:standalone
pure yarn test:standalone-release
pure yarn package
```
## Structure ## Structure
The `code-server` script serves an HTTP API for login and starting a remote VS Code process. The `code-server` script serves an HTTP API for login and starting a remote VS Code process.

View File

@ -10,7 +10,6 @@
"repository": "https://github.com/cdr/code-server", "repository": "https://github.com/cdr/code-server",
"scripts": { "scripts": {
"clean": "./ci/build/clean.sh", "clean": "./ci/build/clean.sh",
"vscode:reset": "./ci/dev/reset-vscode.sh",
"build": "./ci/build/build-code-server.sh", "build": "./ci/build/build-code-server.sh",
"build:vscode": "./ci/build/build-vscode.sh", "build:vscode": "./ci/build/build-vscode.sh",
"release": "./ci/build/build-release.sh", "release": "./ci/build/build-release.sh",

20
pure.yaml Normal file
View File

@ -0,0 +1,20 @@
commands:
yarn:
image: ./ci/images/centos7/Dockerfile
usage: Install dependencies
run: yarn
env:
- YARN_CACHE=/yarn-cache # YARN_CACHE: /yarn-cache
ports:
- 8080
caches:
- key: yarn-cache
path: /yarn-cache
release:
image: ./ci/images/centos7/Dockerfile
usage: Build a release
run: ./ci/steps/release.sh
package:
image: ./ci/images/centos7/Dockerfile
usage: Package a release
run: ./ci/steps/release-packages.sh