Skip to content

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

Merged
merged 6 commits into from
May 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
**
!release-github
!release-packages
!ci
89 changes: 89 additions & 0 deletions .github/workflows/ci.yaml
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 }}
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documented this.

- name: Upload release artifacts
uses: actions/upload-artifact@v2
with:
name: release-packages
path: ./release-packages
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ dist*
out*
release/
release-static/
release-github/
release-packages/
release-gcp/
node_modules
80 changes: 0 additions & 80 deletions .travis.yml

This file was deleted.

45 changes: 30 additions & 15 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The 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).

Copy link
Contributor Author

@nhooyr nhooyr May 8, 2020

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The 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
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.
Expand All @@ -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
Copy link
Member

Choose a reason for hiding this comment

The 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)
Expand All @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we don't have a .travis.yml anymore, maybe we can make this generic with CI configuration file(s) or something.


- [./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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is release-static.sh now.

- 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
41 changes: 0 additions & 41 deletions ci/build/archive-static-release.sh

This file was deleted.

59 changes: 59 additions & 0 deletions ci/build/build-packages.sh
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 "$@"
Loading