mirror of
https://github.com/danog/code-server.git
synced 2024-11-30 04:39:46 +01:00
Switch to a single job to build the npm package
The architecture specific jobs pull it in and then build releases. Much faster!
This commit is contained in:
parent
0ec1c69c06
commit
bc453b5f0d
44
.github/workflows/ci.yaml
vendored
44
.github/workflows/ci.yaml
vendored
@ -12,7 +12,7 @@ jobs:
|
||||
with:
|
||||
args: ./ci/steps/test.sh
|
||||
|
||||
linux-amd64:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
@ -20,25 +20,44 @@ jobs:
|
||||
uses: ./ci/container
|
||||
with:
|
||||
args: ./ci/steps/release.sh
|
||||
- name: Upload release artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: release-github
|
||||
path: ./release-github/*
|
||||
- name: Upload npm package artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: npm-package
|
||||
path: ./release
|
||||
|
||||
linux-amd64:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Download npm package
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: npm-package
|
||||
- name: Run ./ci/steps/static-release.sh
|
||||
uses: ./ci/container
|
||||
with:
|
||||
args: ./ci/steps/static-release.sh
|
||||
- name: Upload release artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: release-github
|
||||
path: ./release-github/*
|
||||
|
||||
linux-arm64:
|
||||
needs: release
|
||||
runs-on: ubuntu-arm64-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Run ./ci/steps/release.sh
|
||||
- name: Download npm package
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: npm-package
|
||||
- name: Run ./ci/steps/static-release.sh
|
||||
uses: ./ci/container
|
||||
with:
|
||||
args: ./ci/steps/release.sh
|
||||
args: ./ci/steps/static-release.sh
|
||||
- name: Upload release artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
@ -46,14 +65,19 @@ jobs:
|
||||
path: ./release-github/*
|
||||
|
||||
macos:
|
||||
needs: release
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Download npm package
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: npm-package
|
||||
- run: brew unlink node@12
|
||||
- run: brew install node
|
||||
- run: ./ci/steps/release.sh
|
||||
- run: ./ci/steps/static-release.sh
|
||||
env:
|
||||
# Otherwise we get a rate limited when fetching the ripgrep binary.
|
||||
# Otherwise we get rate limited when fetching the ripgrep binary.
|
||||
GITHUB_TOKEN: ${{ secrets.github_token }}
|
||||
- name: Upload release artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
|
16
ci/README.md
16
ci/README.md
@ -33,14 +33,17 @@ This directory contains scripts used for the development of code-server.
|
||||
|
||||
This directory contains the scripts used to build code-server.
|
||||
|
||||
- [./lib.sh](./lib.sh)
|
||||
- Contains code duplicated across these scripts.
|
||||
- [./build/build-code-server.sh](./build/build-code-server.sh) (`yarn build`)
|
||||
- Builds code-server into ./out and bundles the frontend into ./dist.
|
||||
- [./build/build-vscode.sh](./build/build-vscode.sh) (`yarn build:vscode`)
|
||||
- Builds vscode into ./lib/vscode/out-vscode.
|
||||
- [./build/build-release.sh](./build/build-release.sh) (`yarn release`)
|
||||
- Bundles the output of the above two scripts into a single node module at ./release.
|
||||
- Will build a static release with node/node_modules into `./release-static`
|
||||
if `STATIC=1` is set.
|
||||
- Bundles the output of the above two scripts into a single node module at `./release`.
|
||||
- [./build/build-static-release.sh](./build/build-static-release.sh) (`yarn release:static`)
|
||||
- Requires a release already built in `./release`.
|
||||
- Will build a static release with node and node_modules into `./release-static`
|
||||
- [./build/clean.sh](./build/clean.sh) (`yarn clean`)
|
||||
- Removes all git ignored files like build artifacts.
|
||||
- Will also `git reset --hard lib/vscode`
|
||||
@ -74,5 +77,8 @@ Just helps avoid clobbering .travis.yml.
|
||||
- [./steps/test.sh](./steps/test.sh)
|
||||
- Runs `yarn ci` after ensuring VS Code is patched
|
||||
- [./steps/release.sh](./steps/release.sh)
|
||||
- Runs the full static build process for CI
|
||||
- Packages the release into a .deb and .rpm for linux
|
||||
- Runs the full release process
|
||||
- Generates the npm package at `./release`
|
||||
- [./steps/static-release.sh](./steps/static-release.sh)
|
||||
- Takes the output of the previous script and bundles it into a self-contained archive into `./github-release`
|
||||
- Also outputs .deb/.rpm if on linux.
|
||||
|
@ -1,28 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# This script requires code-server and vscode to be built with
|
||||
# matching MINIFY.
|
||||
|
||||
# RELEASE_PATH is the destination directory for the release from the root.
|
||||
# Defaults to release
|
||||
RELEASE_PATH="${RELEASE_PATH-release}"
|
||||
|
||||
# STATIC controls whether node and node_modules are packaged into the release.
|
||||
# Disabled by default.
|
||||
STATIC="${STATIC-}"
|
||||
# This script requires code-server and vscode to be built with matching MINIFY.
|
||||
|
||||
# MINIFY controls whether minified vscode is bundled and whether
|
||||
# any included node_modules are pruned for production.
|
||||
MINIFY="${MINIFY-true}"
|
||||
|
||||
VSCODE_SRC_PATH="lib/vscode"
|
||||
|
||||
VSCODE_OUT_PATH="$RELEASE_PATH/lib/vscode"
|
||||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
source ./ci/lib.sh
|
||||
source ./ci/build/lib.sh
|
||||
|
||||
VSCODE_SRC_PATH="lib/vscode"
|
||||
VSCODE_OUT_PATH="$RELEASE_PATH/lib/vscode"
|
||||
|
||||
mkdir -p "$RELEASE_PATH"
|
||||
|
||||
@ -32,20 +22,6 @@ main() {
|
||||
rsync README.md "$RELEASE_PATH"
|
||||
rsync LICENSE.txt "$RELEASE_PATH"
|
||||
rsync ./lib/vscode/ThirdPartyNotices.txt "$RELEASE_PATH"
|
||||
|
||||
if [[ $STATIC ]]; then
|
||||
rsync "$RELEASE_PATH/" "$RELEASE_PATH-static"
|
||||
RELEASE_PATH+=-static
|
||||
VSCODE_OUT_PATH="$RELEASE_PATH/lib/vscode"
|
||||
|
||||
bundle_node
|
||||
else
|
||||
rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules"
|
||||
fi
|
||||
}
|
||||
|
||||
rsync() {
|
||||
command rsync -a --del "$@"
|
||||
}
|
||||
|
||||
bundle_code_server() {
|
||||
@ -76,6 +52,7 @@ bundle_vscode() {
|
||||
mkdir -p "$VSCODE_OUT_PATH"
|
||||
rsync "$VSCODE_SRC_PATH/out-vscode${MINIFY+-min}/" "$VSCODE_OUT_PATH/out"
|
||||
rsync "$VSCODE_SRC_PATH/.build/extensions/" "$VSCODE_OUT_PATH/extensions"
|
||||
rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules"
|
||||
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/postinstall.js" "$VSCODE_OUT_PATH/extensions"
|
||||
@ -103,25 +80,4 @@ EOF
|
||||
jq 'del(.scripts)' < "$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
|
||||
}
|
||||
|
||||
bundle_node() {
|
||||
# We cannot find the path to node from $PATH because yarn shims a script to ensure
|
||||
# we use the same version it's using so we instead run a script with yarn that
|
||||
# will print the path to node.
|
||||
local node_path
|
||||
node_path="$(yarn -s node <<< 'console.info(process.execPath)')"
|
||||
|
||||
mkdir -p "$RELEASE_PATH/bin"
|
||||
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
|
||||
rsync "$node_path" "$RELEASE_PATH/lib/node"
|
||||
|
||||
rsync node_modules "$RELEASE_PATH"
|
||||
rsync "$VSCODE_SRC_PATH/node_modules" "$VSCODE_OUT_PATH"
|
||||
|
||||
if [[ $MINIFY ]]; then
|
||||
pushd "$RELEASE_PATH"
|
||||
yarn --production
|
||||
popd
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
25
ci/build/build-static-release.sh
Executable file
25
ci/build/build-static-release.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
source ./ci/build/lib.sh
|
||||
|
||||
rsync "$RELEASE_PATH/" "$RELEASE_PATH-static"
|
||||
RELEASE_PATH+=-static
|
||||
|
||||
# We cannot find the path to node from $PATH because yarn shims a script to ensure
|
||||
# we use the same version it's using so we instead run a script with yarn that
|
||||
# will print the path to node.
|
||||
local node_path
|
||||
node_path="$(yarn -s node <<< 'console.info(process.execPath)')"
|
||||
|
||||
mkdir -p "$RELEASE_PATH/bin"
|
||||
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
|
||||
rsync "$node_path" "$RELEASE_PATH/lib/node"
|
||||
|
||||
cd "$RELEASE_PATH"
|
||||
yarn --production
|
||||
}
|
||||
|
||||
main "$@"
|
10
ci/build/lib.sh
Normal file
10
ci/build/lib.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
source ./ci/lib.sh
|
||||
|
||||
# RELEASE_PATH is the destination directory for the release from the root.
|
||||
# Defaults to release
|
||||
RELEASE_PATH="${RELEASE_PATH-release}"
|
||||
|
||||
rsync() {
|
||||
command rsync -a --del "$@"
|
||||
}
|
@ -8,13 +8,7 @@ main() {
|
||||
yarn vscode
|
||||
yarn build
|
||||
yarn build:vscode
|
||||
STATIC=1 yarn release
|
||||
./ci/build/test-static-release.sh
|
||||
./ci/build/archive-static-release.sh
|
||||
|
||||
if [[ $OSTYPE == linux* ]]; then
|
||||
yarn pkg
|
||||
fi
|
||||
yarn release
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
16
ci/steps/static-release.sh
Normal file
16
ci/steps/static-release.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
yarn release:static
|
||||
./ci/build/test-static-release.sh
|
||||
./ci/build/archive-static-release.sh
|
||||
|
||||
if [[ $OSTYPE == linux* ]]; then
|
||||
yarn pkg
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
@ -16,6 +16,7 @@
|
||||
"build": "./ci/build/build-code-server.sh",
|
||||
"build:vscode": "./ci/build/build-vscode.sh",
|
||||
"release": "./ci/build/build-release.sh",
|
||||
"release:static": "./ci/build/build-static-release.sh",
|
||||
"pkg": "./ci/build/build-static-pkgs.sh",
|
||||
"_____": "",
|
||||
"fmt": "./ci/dev/fmt.sh",
|
||||
|
Loading…
Reference in New Issue
Block a user