-
Notifications
You must be signed in to change notification settings - Fork 6k
Switch to GH Actions #1607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to GH Actions #1607
Changes from all commits
3e75828
193a451
0ec1c69
bc453b5
6282cd7
e9fe4c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
** | ||
!release-github | ||
!release-packages | ||
!ci |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: ci | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Run ./ci/steps/test.sh | ||
uses: ./ci/container | ||
with: | ||
args: ./ci/steps/test.sh | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Run ./ci/steps/release.sh | ||
uses: ./ci/container | ||
with: | ||
args: ./ci/steps/release.sh | ||
- 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@v2 | ||
with: | ||
name: npm-package | ||
path: ./release | ||
- name: Run ./ci/steps/release-static.sh | ||
uses: ./ci/container | ||
with: | ||
args: ./ci/steps/release-static.sh | ||
- name: Upload release artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: release-packages | ||
path: ./release-packages | ||
|
||
linux-arm64: | ||
needs: release | ||
runs-on: ubuntu-arm64-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Download npm package | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: npm-package | ||
path: ./release | ||
- name: Run ./ci/steps/release-static.sh | ||
uses: ./ci/container | ||
with: | ||
args: ./ci/steps/release-static.sh | ||
- name: Upload release artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: release-packages | ||
path: ./release-packages | ||
|
||
macos-amd64: | ||
needs: release | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Download npm package | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: npm-package | ||
path: ./release | ||
- run: brew unlink node@12 | ||
- run: brew install node | ||
- 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-packages | ||
path: ./release-packages |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,6 @@ dist* | |
out* | ||
release/ | ||
release-static/ | ||
release-github/ | ||
release-packages/ | ||
release-gcp/ | ||
node_modules |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,20 @@ Many of these scripts contain more detailed documentation and options in comment | |
|
||
Any file and directory added into this tree should be documented here. | ||
|
||
## Publishing a release | ||
|
||
1. Change the version of code-server in `package.json` and push this commit. | ||
1. CI will run and generate an NPM package and release packages that you can download | ||
as artifacts on Github Actions. | ||
1. Create a new draft release with the built release packages. | ||
1. Run some basic sanity tests on one of the released packages. | ||
1. Publish. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should mention to include the VS Code version in the release notes, see #1501 (comment). Including a changelog is of course obvious but maybe we should mention that as well (which at some point we should probably start generating automatically). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You got it. I'd be in favour of a manual changelog, commits can get verbose. I'd rather we summarize the big changes ourselves. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sgtm |
||
1. Download the built npm package and publish it. | ||
1. Place the debian releases into `./release-packages` and then push the docker | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if this is better or worse but my strat was to pull the versioned Docker image, tag it latest, then push it back up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I see in your other PR the image is pushed after a release is created so I suppose we could also just push latest? Since at that point we'd have verified the release is good to go. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea will add. |
||
image with `./ci/release-container/push.sh`. | ||
1. This will need to be ran on an ARM64 instance as well. | ||
1. At some point we need to automate this. | ||
|
||
## dev | ||
|
||
This directory contains scripts used for the development of code-server. | ||
|
@@ -32,27 +46,30 @@ 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. | ||
- [./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` | ||
- 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`) | ||
Comment on lines
68
to
+70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The names on the left don't match the right. Looks like on the first one the right is correct and on the second the left is correct. |
||
- 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) | ||
|
@@ -68,15 +85,13 @@ This directory contains the container for CI. | |
|
||
## steps | ||
|
||
This directory contains a few scripts used in CI. Just helps avoid clobbering .travis.yml. | ||
This directory contains a few scripts used in CI. | ||
Just helps avoid clobbering .travis.yml. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose we don't have a |
||
|
||
- [./steps/test.sh](./steps/test.sh) | ||
- Runs `yarn ci` after ensuring VS Code is patched | ||
- [./steps/release.sh](./steps/release.sh) | ||
- Runs the full release process | ||
- Generates the npm package at `./release` | ||
- [./steps/static-release.sh](./steps/static-release.sh) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this is |
||
- Runs the full static build process for CI | ||
- [./steps/linux-release.sh](./steps/linux-release.sh) | ||
- Runs the full static build process for CI | ||
- Packages the release into a .deb and .rpm | ||
- Builds and pushes a docker release | ||
- [./steps/publish-npm.sh](./steps/publish-npm.sh) | ||
- Authenticates yarn and publishes the built package from `./release` | ||
- Takes the output of the previous script and generates a static release and packages |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "$@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we set this for the other jobs as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only macOS for some reason needs it. The others never fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documented this.