Skip to content

Commit be032cf

Browse files
committed
Add NPM package, debs, rpms and refactor CI/build process
Closes many issues that I'll prune after adding more docs for users.
1 parent 4875f6a commit be032cf

Some content is hidden

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

42 files changed

+865
-629
lines changed

.dockerignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
**
2-
!release
2+
!release-github
3+
!ci

.gitignore

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
*.tsbuildinfo
1+
.tsbuildinfo
22
.cache
3-
build
43
dist*
54
out*
65
release/
7-
release-upload/
6+
release-static/
7+
release-github/
8+
release-gcp/
89
node_modules
9-
binaries

.travis.yml

+33-15
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
1-
language: minimal
1+
language: node_js
2+
node_js: node
23

34
jobs:
45
include:
56
- name: Test
67
if: tag IS blank
7-
script: ./ci/image/run.sh "yarn && git submodule update --init && yarn vscode:patch && ./ci/ci.sh"
8+
script: ./ci/container/exec.sh ./ci/steps/test.sh
89
deploy: null
10+
install: null
911
- name: Linux Release
1012
if: tag IS present
11-
script:
12-
- travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh && ./ci/build-test.sh"
13-
- ./ci/release-image/push.sh
14-
- name: Linux ARM64 Release
13+
script: ./ci/steps/linux-release.sh
14+
install: null
15+
- name: Linux Release
1516
if: tag IS present
16-
script:
17-
- ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh && ./ci/build-test.sh"
18-
- ./ci/release-image/push.sh
1917
arch: arm64
18+
script: |
19+
sudo apt-get update && sudo apt-get install -y jq || exit 1
20+
./ci/steps/linux-release.sh
21+
install: null
2022
- name: MacOS Release
2123
if: tag IS present
2224
os: osx
23-
language: node_js
25+
# node 13/14 crashes in the build process for some reason.
2426
node_js: 12
25-
script: yarn && yarn vscode && travis_wait 60 ci/release.sh && ./ci/build-test.sh
27+
script: |
28+
HOMEBREW_NO_INSTALL_CLEANUP=1 HOMEBREW_NO_AUTO_UPDATE=1 brew install jq || exit 1
29+
travis_wait 60 ./ci/steps/static-release.sh || exit 1
30+
install: null
2631

2732
before_deploy:
2833
- echo "$JSON_KEY" | base64 --decode > ./ci/key.json
@@ -36,23 +41,36 @@ deploy:
3641
target_commitish: $TRAVIS_COMMIT
3742
name: $TRAVIS_TAG
3843
file:
39-
- release/*.tar.gz
40-
- release/*.zip
44+
- release-github/*.tar.gz
45+
- release-github/*.zip
46+
- release-github/*.deb
47+
- release-github/*.rpm
4148
on:
4249
tags: true
4350
- provider: gcs
4451
edge: true
4552
bucket: "codesrv-ci.cdr.sh"
4653
upload_dir: "releases"
4754
key_file: ./ci/key.json
48-
local_dir: release-upload
55+
local_dir: ./release-gcp
4956
on:
5057
tags: true
5158
# TODO: The gcs provider fails to install on arm64.
52-
condition: $TRAVIS_CPU_ARCH = amd64
59+
condition: $TRAVIS_CPU_ARCH == amd64
60+
- provider: script
61+
edge: true
62+
# We do not use the travis npm deploy integration as it does not allow us to
63+
# deploy a subpath and and v2 which should, just errors out that the src does not exist
64+
script: ./ci/steps/publish-npm.sh
65+
on:
66+
tags: true
67+
condition: $TRAVIS_CPU_ARCH == amd64 && $TRAVIS_OS_NAME == linux
5368

5469
cache:
5570
timeout: 600
5671
yarn: true
5772
directories:
73+
- .cache
74+
- out
75+
- dist
5876
- lib/vscode/.build/extensions

ci/README.md

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# ci
2+
3+
This directory contains scripts used for code-server's continuous integration infrastructure.
4+
5+
Many of these scripts contain more detailed documentation and options in comments at the top.
6+
7+
Any file and directory added into this tree should be documented here.
8+
9+
## dev
10+
11+
This directory contains scripts used for the development of code-server.
12+
13+
- [./dev/container](./dev/container)
14+
- See [CONTRIBUTING.md](../doc/CONTRIBUTING.md) for docs on the development container
15+
- [./dev/ci.sh](./dev/ci.sh) (`yarn ci`)
16+
- Runs formatters, linters and tests
17+
- [./dev/fmt.sh](./dev/fmt.sh) (`yarn fmt`)
18+
- Runs formatters
19+
- [./dev/lint.sh](./dev/lint.sh) (`yarn lint`)
20+
- Runs linters
21+
- [./dev/test.sh](./dev/test.sh) (`yarn test`)
22+
- Runs tests
23+
- [./dev/vscode.sh](./dev/vscode.sh) (`yarn vscode`)
24+
- Ensures `lib/vscode` is cloned, patched and dependencies are installed
25+
- [./dev/vscode.patch](./dev/vscode.patch)
26+
- Our patch of VS Code to enable remote browser access
27+
- Generate it with `yarn vscode:diff` and apply with `yarn vscode:patch`
28+
- [./dev/watch.ts](./dev/watch.ts) (`yarn watch`)
29+
- Starts a process to build and launch code-server and restart on any code changes
30+
- Example usage in [CONTRIBUTING.md](../doc/CONTRIBUTING.md)
31+
32+
## build
33+
34+
This directory contains the scripts used to build code-server.
35+
36+
- [./build/build-code-server.sh](./build/build-code-server.sh) (`yarn build`)
37+
- Builds code-server into ./out and bundles the frontend into ./dist.
38+
- [./build/build-vscode.sh](./build/build-vscode.sh) (`yarn build:vscode`)
39+
- Builds vscode into ./lib/vscode/out-vscode.
40+
- [./build/build-release.sh](./build/build-release.sh) (`yarn release`)
41+
- Bundles the output of the above two scripts into a single node module at ./release.
42+
- Will build a static release with node/node_modules into `./release-static`
43+
if `STATIC=1` is set.
44+
- [./build/clean.sh](./build/clean.sh) (`yarn clean`)
45+
- Removes all git ignored files like build artifacts.
46+
- Will also `git reset --hard lib/vscode`
47+
- Useful to do a clean build.
48+
- [./build/code-server.sh](./build/code-server.sh)
49+
- Copied into static releases to run code-server with the bundled node binary.
50+
- [./build/archive-static-release.sh](./build/archive-static-release.sh)
51+
- Archives `./release-static` into a tar/zip for CI with the proper directory name scheme
52+
- [./build/test-release.sh](./build/test-static-release.sh)
53+
- Ensures code-server in the `./release-static` directory runs
54+
- [./build/build-static-pkgs.sh](./build/build-static-pkgs.sh) (`yarn pkg`)
55+
- Uses [nfpm](https://github.com/goreleaser/nfpm) to generate .deb and .rpm from a static release
56+
- [./build/nfpm.yaml](./build/nfpm.yaml)
57+
- Used to configure [nfpm](https://github.com/goreleaser/nfpm) to generate .deb and .rpm
58+
- [./build/code-server-nfpm.sh](./build/code-server-nfpm.sh)
59+
- Entrypoint script for code-server for .deb and .rpm
60+
61+
## release-container
62+
63+
This directory contains the release docker container.
64+
65+
## container
66+
67+
This directory contains the container for CI.
68+
69+
## steps
70+
71+
This directory contains a few scripts used in CI. Just helps avoid clobbering .travis.yml.
72+
73+
- [./steps/test.sh](./steps/test.sh)
74+
- Runs `yarn ci` after ensuring VS Code is patched
75+
- [./steps/static-release.sh](./steps/static-release.sh)
76+
- Runs the full static build process for CI
77+
- [./steps/linux-release.sh](./steps/linux-release.sh)
78+
- Runs the full static build process for CI
79+
- Packages the release into a .deb and .rpm
80+
- Builds and pushes a docker release
81+
- [./steps/publish-npm.sh](./steps/publish-npm.sh)
82+
- Authenticates yarn and publishes the built package from `./release`

0 commit comments

Comments
 (0)