mirror of
https://github.com/coder/code-server.git
synced 2024-12-22 17:21:43 +03: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:
|
with:
|
||||||
args: ./ci/steps/test.sh
|
args: ./ci/steps/test.sh
|
||||||
|
|
||||||
linux-amd64:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
@ -20,25 +20,44 @@ jobs:
|
|||||||
uses: ./ci/container
|
uses: ./ci/container
|
||||||
with:
|
with:
|
||||||
args: ./ci/steps/release.sh
|
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
|
- name: Upload npm package artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: npm-package
|
name: npm-package
|
||||||
path: ./release
|
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:
|
linux-arm64:
|
||||||
|
needs: release
|
||||||
runs-on: ubuntu-arm64-latest
|
runs-on: ubuntu-arm64-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- 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
|
uses: ./ci/container
|
||||||
with:
|
with:
|
||||||
args: ./ci/steps/release.sh
|
args: ./ci/steps/static-release.sh
|
||||||
- name: Upload release artifacts
|
- name: Upload release artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
@ -46,14 +65,19 @@ jobs:
|
|||||||
path: ./release-github/*
|
path: ./release-github/*
|
||||||
|
|
||||||
macos:
|
macos:
|
||||||
|
needs: release
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
- name: Download npm package
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: npm-package
|
||||||
- run: brew unlink node@12
|
- run: brew unlink node@12
|
||||||
- run: brew install node
|
- run: brew install node
|
||||||
- run: ./ci/steps/release.sh
|
- run: ./ci/steps/static-release.sh
|
||||||
env:
|
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 }}
|
GITHUB_TOKEN: ${{ secrets.github_token }}
|
||||||
- name: Upload release artifacts
|
- name: Upload release artifacts
|
||||||
uses: actions/upload-artifact@v2
|
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.
|
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`)
|
- [./build/build-code-server.sh](./build/build-code-server.sh) (`yarn build`)
|
||||||
- Builds code-server into ./out and bundles the frontend into ./dist.
|
- Builds code-server into ./out and bundles the frontend into ./dist.
|
||||||
- [./build/build-vscode.sh](./build/build-vscode.sh) (`yarn build:vscode`)
|
- [./build/build-vscode.sh](./build/build-vscode.sh) (`yarn build:vscode`)
|
||||||
- Builds vscode into ./lib/vscode/out-vscode.
|
- Builds vscode into ./lib/vscode/out-vscode.
|
||||||
- [./build/build-release.sh](./build/build-release.sh) (`yarn release`)
|
- [./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.
|
- 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`
|
- [./build/build-static-release.sh](./build/build-static-release.sh) (`yarn release:static`)
|
||||||
if `STATIC=1` is set.
|
- 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`)
|
- [./build/clean.sh](./build/clean.sh) (`yarn clean`)
|
||||||
- Removes all git ignored files like build artifacts.
|
- Removes all git ignored files like build artifacts.
|
||||||
- Will also `git reset --hard lib/vscode`
|
- Will also `git reset --hard lib/vscode`
|
||||||
@ -74,5 +77,8 @@ Just helps avoid clobbering .travis.yml.
|
|||||||
- [./steps/test.sh](./steps/test.sh)
|
- [./steps/test.sh](./steps/test.sh)
|
||||||
- Runs `yarn ci` after ensuring VS Code is patched
|
- Runs `yarn ci` after ensuring VS Code is patched
|
||||||
- [./steps/release.sh](./steps/release.sh)
|
- [./steps/release.sh](./steps/release.sh)
|
||||||
- Runs the full static build process for CI
|
- Runs the full release process
|
||||||
- Packages the release into a .deb and .rpm for linux
|
- 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
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# This script requires code-server and vscode to be built with
|
# This script requires code-server and vscode to be built with matching MINIFY.
|
||||||
# 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-}"
|
|
||||||
|
|
||||||
# MINIFY controls whether minified vscode is bundled and whether
|
# MINIFY controls whether minified vscode is bundled and whether
|
||||||
# any included node_modules are pruned for production.
|
# any included node_modules are pruned for production.
|
||||||
MINIFY="${MINIFY-true}"
|
MINIFY="${MINIFY-true}"
|
||||||
|
|
||||||
VSCODE_SRC_PATH="lib/vscode"
|
|
||||||
|
|
||||||
VSCODE_OUT_PATH="$RELEASE_PATH/lib/vscode"
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
cd "$(dirname "${0}")/../.."
|
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"
|
mkdir -p "$RELEASE_PATH"
|
||||||
|
|
||||||
@ -32,20 +22,6 @@ main() {
|
|||||||
rsync README.md "$RELEASE_PATH"
|
rsync README.md "$RELEASE_PATH"
|
||||||
rsync LICENSE.txt "$RELEASE_PATH"
|
rsync LICENSE.txt "$RELEASE_PATH"
|
||||||
rsync ./lib/vscode/ThirdPartyNotices.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() {
|
bundle_code_server() {
|
||||||
@ -76,6 +52,7 @@ bundle_vscode() {
|
|||||||
mkdir -p "$VSCODE_OUT_PATH"
|
mkdir -p "$VSCODE_OUT_PATH"
|
||||||
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"
|
||||||
|
rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules"
|
||||||
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"
|
||||||
@ -103,25 +80,4 @@ EOF
|
|||||||
jq 'del(.scripts)' < "$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
|
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 "$@"
|
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 vscode
|
||||||
yarn build
|
yarn build
|
||||||
yarn build:vscode
|
yarn build:vscode
|
||||||
STATIC=1 yarn release
|
yarn release
|
||||||
./ci/build/test-static-release.sh
|
|
||||||
./ci/build/archive-static-release.sh
|
|
||||||
|
|
||||||
if [[ $OSTYPE == linux* ]]; then
|
|
||||||
yarn pkg
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
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": "./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",
|
||||||
|
"release:static": "./ci/build/build-static-release.sh",
|
||||||
"pkg": "./ci/build/build-static-pkgs.sh",
|
"pkg": "./ci/build/build-static-pkgs.sh",
|
||||||
"_____": "",
|
"_____": "",
|
||||||
"fmt": "./ci/dev/fmt.sh",
|
"fmt": "./ci/dev/fmt.sh",
|
||||||
|
Loading…
Reference in New Issue
Block a user