Simplify packaging and improve scripts
Much better test now as well.
This commit is contained in:
parent
bc453b5f0d
commit
6282cd7e7b
@ -1,3 +1,3 @@
|
||||
**
|
||||
!release-github
|
||||
!release-packages
|
||||
!ci
|
||||
|
31
.github/workflows/ci.yaml
vendored
31
.github/workflows/ci.yaml
vendored
@ -32,18 +32,19 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Download npm package
|
||||
uses: actions/download-artifact@v1
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: npm-package
|
||||
- name: Run ./ci/steps/static-release.sh
|
||||
path: ./release
|
||||
- name: Run ./ci/steps/release-static.sh
|
||||
uses: ./ci/container
|
||||
with:
|
||||
args: ./ci/steps/static-release.sh
|
||||
args: ./ci/steps/release-static.sh
|
||||
- name: Upload release artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: release-github
|
||||
path: ./release-github/*
|
||||
name: release-packages
|
||||
path: ./release-packages
|
||||
|
||||
linux-arm64:
|
||||
needs: release
|
||||
@ -51,18 +52,19 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Download npm package
|
||||
uses: actions/download-artifact@v1
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: npm-package
|
||||
- name: Run ./ci/steps/static-release.sh
|
||||
path: ./release
|
||||
- name: Run ./ci/steps/release-static.sh
|
||||
uses: ./ci/container
|
||||
with:
|
||||
args: ./ci/steps/static-release.sh
|
||||
args: ./ci/steps/release-static.sh
|
||||
- name: Upload release artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: release-github
|
||||
path: ./release-github/*
|
||||
name: release-packages
|
||||
path: ./release-packages
|
||||
|
||||
macos:
|
||||
needs: release
|
||||
@ -70,17 +72,18 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Download npm package
|
||||
uses: actions/download-artifact@v1
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: npm-package
|
||||
path: ./release
|
||||
- run: brew unlink node@12
|
||||
- run: brew install node
|
||||
- run: ./ci/steps/static-release.sh
|
||||
- run: ./ci/steps/release-static.sh
|
||||
env:
|
||||
# Otherwise we get rate limited when fetching the ripgrep binary.
|
||||
GITHUB_TOKEN: ${{ secrets.github_token }}
|
||||
- name: Upload release artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: release-github
|
||||
path: ./release-github/*
|
||||
name: release-packages
|
||||
path: ./release-packages
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,6 +4,6 @@ dist*
|
||||
out*
|
||||
release/
|
||||
release-static/
|
||||
release-github/
|
||||
release-packages/
|
||||
release-gcp/
|
||||
node_modules
|
||||
|
11
ci/README.md
11
ci/README.md
@ -32,6 +32,7 @@ This directory contains scripts used for the development of code-server.
|
||||
## build
|
||||
|
||||
This directory contains the scripts used to build code-server.
|
||||
You can disable minification by setting `MINIFY=`.
|
||||
|
||||
- [./lib.sh](./lib.sh)
|
||||
- Contains code duplicated across these scripts.
|
||||
@ -50,12 +51,11 @@ This directory contains the scripts used to build code-server.
|
||||
- Useful to do a clean build.
|
||||
- [./build/code-server.sh](./build/code-server.sh)
|
||||
- Copied into static releases to run code-server with the bundled node binary.
|
||||
- [./build/archive-static-release.sh](./build/archive-static-release.sh)
|
||||
- Archives `./release-static` into a tar/zip for CI with the proper directory name scheme
|
||||
- [./build/test-release.sh](./build/test-static-release.sh)
|
||||
- Ensures code-server in the `./release-static` directory runs
|
||||
- [./build/build-static-pkgs.sh](./build/build-static-pkgs.sh) (`yarn pkg`)
|
||||
- Uses [nfpm](https://github.com/goreleaser/nfpm) to generate .deb and .rpm from a static release
|
||||
- [./build/build-packages.sh](./build/build-static-pkgs.sh) (`yarn package`)
|
||||
- Packages `./release-static` into an archive in `./release-packages`
|
||||
- If on linux, [nfpm](https://github.com/goreleaser/nfpm) is used to generate .deb and .rpm
|
||||
- [./build/nfpm.yaml](./build/nfpm.yaml)
|
||||
- Used to configure [nfpm](https://github.com/goreleaser/nfpm) to generate .deb and .rpm
|
||||
- [./build/code-server-nfpm.sh](./build/code-server-nfpm.sh)
|
||||
@ -80,5 +80,4 @@ Just helps avoid clobbering .travis.yml.
|
||||
- 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.
|
||||
- Takes the output of the previous script and generates a static release and packages
|
||||
|
@ -1,41 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Generates static code-server releases for CI.
|
||||
# This script assumes that a static release is built already.
|
||||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
VERSION="$(pkg_json_version)"
|
||||
|
||||
local OS
|
||||
OS="$(os)"
|
||||
|
||||
local ARCH
|
||||
ARCH="$(arch)"
|
||||
|
||||
local archive_name="code-server-$VERSION-$OS-$ARCH"
|
||||
mkdir -p release-github
|
||||
|
||||
local ext
|
||||
if [[ $OS == "linux" ]]; then
|
||||
ext=".tar.gz"
|
||||
tar -czf "release-github/$archive_name$ext" --transform "s/^\.\/release-static/$archive_name/" ./release-static
|
||||
else
|
||||
mv ./release-static "./$archive_name"
|
||||
ext=".zip"
|
||||
zip -r "release-github/$archive_name$ext" "./$archive_name"
|
||||
mv "./$archive_name" ./release-static
|
||||
fi
|
||||
|
||||
echo "done (release-github/$archive_name)"
|
||||
|
||||
mkdir -p "release-gcp/$VERSION"
|
||||
cp "release-github/$archive_name$ext" "./release-gcp/$VERSION/$OS-$ARCH$ext"
|
||||
mkdir -p "release-gcp/latest"
|
||||
cp "./release-github/$archive_name$ext" "./release-gcp/latest/$OS-$ARCH$ext"
|
||||
}
|
||||
|
||||
main "$@"
|
59
ci/build/build-packages.sh
Executable file
59
ci/build/build-packages.sh
Executable file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Packages code-server for the current OS and architecture into ./release-packages.
|
||||
# This script assumes that a static release is built already into ./release-static.
|
||||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
export VERSION
|
||||
VERSION="$(pkg_json_version)"
|
||||
|
||||
local OS
|
||||
OS="$(os)"
|
||||
|
||||
export ARCH
|
||||
ARCH="$(arch)"
|
||||
|
||||
local archive_name="code-server-$VERSION-$OS-$ARCH"
|
||||
mkdir -p release-packages
|
||||
|
||||
local ext
|
||||
if [[ $OS == "linux" ]]; then
|
||||
ext=".tar.gz"
|
||||
tar -czf "release-packages/$archive_name$ext" --transform "s/^\.\/release-static/$archive_name/" ./release-static
|
||||
else
|
||||
mv ./release-static "./$archive_name"
|
||||
ext=".zip"
|
||||
zip -r "release-packages/$archive_name$ext" "./$archive_name"
|
||||
mv "./$archive_name" ./release-static
|
||||
fi
|
||||
|
||||
echo "done (release-packages/$archive_name)"
|
||||
|
||||
release_gcp
|
||||
|
||||
if [[ $OSTYPE == linux* ]]; then
|
||||
release_nfpm
|
||||
fi
|
||||
}
|
||||
|
||||
release_gcp() {
|
||||
mkdir -p "release-gcp/$VERSION"
|
||||
cp "release-packages/$archive_name$ext" "./release-gcp/$VERSION/$OS-$ARCH$ext"
|
||||
mkdir -p "release-gcp/latest"
|
||||
cp "./release-packages/$archive_name$ext" "./release-gcp/latest/$OS-$ARCH$ext"
|
||||
}
|
||||
|
||||
# Generates deb and rpm packages.
|
||||
release_nfpm() {
|
||||
local nfpm_config
|
||||
nfpm_config=$(envsubst < ./ci/build/nfpm.yaml)
|
||||
|
||||
nfpm pkg -f <(echo "$nfpm_config") --target release-packages/code-server-"$VERSION-$ARCH.deb"
|
||||
nfpm pkg -f <(echo "$nfpm_config") --target release-packages/code-server-"$VERSION-$ARCH.rpm"
|
||||
}
|
||||
|
||||
main "$@"
|
@ -1,10 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# This script requires code-server and vscode to be built with matching MINIFY.
|
||||
# This script requires 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 controls whether minified vscode is bundled.
|
||||
MINIFY="${MINIFY-true}"
|
||||
|
||||
main() {
|
||||
|
@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Generates deb and rpm packages for CI.
|
||||
# Assumes a static release has already been built.
|
||||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
VERSION="$(pkg_json_version)"
|
||||
export VERSION
|
||||
|
||||
ARCH="$(arch)"
|
||||
export ARCH
|
||||
|
||||
local nfpm_config
|
||||
nfpm_config=$(envsubst < ./ci/build/nfpm.yaml)
|
||||
|
||||
nfpm pkg -f <(echo "$nfpm_config") --target release-github/code-server-"$VERSION-$ARCH.deb"
|
||||
nfpm pkg -f <(echo "$nfpm_config") --target release-github/code-server-"$VERSION-$ARCH.rpm"
|
||||
}
|
||||
|
||||
main "$@"
|
0
ci/build/lib.sh
Normal file → Executable file
0
ci/build/lib.sh
Normal file → Executable file
@ -7,14 +7,21 @@ set -euo pipefail
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
|
||||
local output
|
||||
output=$(./release-static/bin/code-server --list-extensions 2>&1)
|
||||
if echo "$output" | grep 'was compiled against a different Node.js version'; then
|
||||
echo "$output"
|
||||
local EXTENSIONS_DIR
|
||||
EXTENSIONS_DIR="$(mktemp -d)"
|
||||
|
||||
echo "Testing static release"
|
||||
|
||||
./release-static/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --install-extension ms-python.python
|
||||
local installed_extensions
|
||||
installed_extensions="$(./release-static/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --list-extensions 2>&1)"
|
||||
if [[ $installed_extensions != "ms-python.python" ]]; then
|
||||
echo "Unexpected output from listing extensions:"
|
||||
echo "$installed_extensions"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Build ran successfully"
|
||||
echo "Static release works correctly"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
@ -34,7 +34,7 @@ RUN ARCH="$(dpkg --print-architecture)" && \
|
||||
mkdir -p /etc/fixuid && \
|
||||
printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml
|
||||
|
||||
COPY release-github/code-server*.deb /tmp/
|
||||
COPY release-packages/code-server*.deb /tmp/
|
||||
RUN dpkg -i /tmp/code-server*.deb && rm /tmp/code-server*.deb
|
||||
|
||||
EXPOSE 8080
|
||||
|
6
ci/steps/static-release.sh → ci/steps/release-static.sh
Normal file → Executable file
6
ci/steps/static-release.sh → ci/steps/release-static.sh
Normal file → Executable file
@ -6,11 +6,7 @@ main() {
|
||||
|
||||
yarn release:static
|
||||
./ci/build/test-static-release.sh
|
||||
./ci/build/archive-static-release.sh
|
||||
|
||||
if [[ $OSTYPE == linux* ]]; then
|
||||
yarn pkg
|
||||
fi
|
||||
yarn package
|
||||
}
|
||||
|
||||
main "$@"
|
@ -17,7 +17,7 @@
|
||||
"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",
|
||||
"package": "./ci/build/build-packages.sh",
|
||||
"_____": "",
|
||||
"fmt": "./ci/dev/fmt.sh",
|
||||
"lint": "./ci/dev/lint.sh",
|
||||
|
Loading…
Reference in New Issue
Block a user