2021-07-02 20:18:37 +02:00
|
|
|
name: Build
|
2020-05-07 06:06:55 +02:00
|
|
|
|
2021-03-12 18:48:39 +01:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
2020-05-07 06:06:55 +02:00
|
|
|
|
2022-03-02 00:03:39 +01:00
|
|
|
# Cancel in-progress runs for pull requests when developers push
|
|
|
|
# additional changes, and serialize builds in branches.
|
|
|
|
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
# Note: if: success() is used in several jobs -
|
|
|
|
# this ensures that it only executes if all previous jobs succeeded.
|
|
|
|
|
2022-09-19 18:56:34 +02:00
|
|
|
# if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
2021-04-08 20:12:01 +02:00
|
|
|
# will skip running `yarn install` if it successfully fetched from cache
|
|
|
|
|
2020-05-07 06:06:55 +02:00
|
|
|
jobs:
|
2022-09-22 21:33:32 +02:00
|
|
|
fmt:
|
|
|
|
name: Format with Prettier
|
2020-05-13 01:33:34 +02:00
|
|
|
runs-on: ubuntu-latest
|
2022-09-22 21:33:32 +02:00
|
|
|
timeout-minutes: 5
|
2020-05-13 01:33:34 +02:00
|
|
|
steps:
|
2021-04-08 20:12:01 +02:00
|
|
|
- name: Checkout repo
|
2022-03-02 00:31:32 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2022-05-04 23:58:49 +02:00
|
|
|
- name: Install Node.js v16
|
2022-02-25 17:09:09 +01:00
|
|
|
uses: actions/setup-node@v3
|
2020-05-13 01:33:34 +02:00
|
|
|
with:
|
2022-05-04 23:58:49 +02:00
|
|
|
node-version: "16"
|
2020-05-13 01:33:34 +02:00
|
|
|
|
2022-09-22 21:33:32 +02:00
|
|
|
- name: Fetch dependencies from cache
|
|
|
|
id: cache-node-modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: "**/node_modules"
|
|
|
|
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
yarn-build-
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
|
|
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
|
|
|
|
|
|
|
|
- name: Format files with Prettier
|
|
|
|
run: yarn fmt
|
|
|
|
|
|
|
|
lint-helm:
|
|
|
|
name: Lint Helm chart
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 5
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 2
|
|
|
|
|
|
|
|
- name: Get changed files
|
|
|
|
id: changed-files
|
2022-09-22 21:57:54 +02:00
|
|
|
uses: tj-actions/changed-files@v26.1
|
2022-09-22 21:33:32 +02:00
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
ci/helm-chart/**
|
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
- name: Install helm
|
2022-09-22 21:33:32 +02:00
|
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
2022-07-27 19:44:52 +02:00
|
|
|
uses: azure/setup-helm@v3.3
|
2022-09-19 18:56:34 +02:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Install helm kubeval plugin
|
2022-09-22 21:33:32 +02:00
|
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
2022-09-19 18:56:34 +02:00
|
|
|
run: helm plugin install https://github.com/instrumenta/helm-kubeval
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2022-09-22 21:33:32 +02:00
|
|
|
- name: Lint Helm chart
|
|
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
|
|
run: helm kubeval ci/helm-chart
|
|
|
|
|
|
|
|
lint-ts:
|
|
|
|
name: Lint TypeScript files
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 5
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 2
|
|
|
|
|
|
|
|
- name: Get changed files
|
|
|
|
id: changed-files
|
2022-09-22 21:57:54 +02:00
|
|
|
uses: tj-actions/changed-files@v26.1
|
2022-09-22 21:33:32 +02:00
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
**/*.ts
|
|
|
|
**/*.js
|
|
|
|
files_ignore: |
|
|
|
|
lib/vscode/**
|
|
|
|
|
|
|
|
- name: Install Node.js v16
|
|
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: "16"
|
|
|
|
|
2022-03-15 03:37:29 +01:00
|
|
|
- name: Fetch dependencies from cache
|
2022-09-22 21:33:32 +02:00
|
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
2022-09-19 18:56:34 +02:00
|
|
|
id: cache-node-modules
|
2022-03-21 22:31:02 +01:00
|
|
|
uses: actions/cache@v3
|
2022-03-15 03:37:29 +01:00
|
|
|
with:
|
|
|
|
path: "**/node_modules"
|
|
|
|
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
yarn-build-
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Install dependencies
|
2022-09-22 21:33:32 +02:00
|
|
|
if: steps.changed-files.outputs.any_changed == 'true' && steps.cache-node-modules.outputs.cache-hit != 'true'
|
2022-09-19 18:56:34 +02:00
|
|
|
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
|
2020-05-13 01:33:34 +02:00
|
|
|
|
2022-09-22 21:33:32 +02:00
|
|
|
- name: Lint TypeScript files
|
|
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
|
|
run: yarn lint:ts
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
build:
|
|
|
|
name: Build
|
2020-05-08 02:44:32 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-07-01 00:16:55 +02:00
|
|
|
timeout-minutes: 30
|
2021-10-28 22:27:17 +02:00
|
|
|
env:
|
|
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
2020-05-07 06:06:55 +02:00
|
|
|
steps:
|
2022-03-15 03:37:29 +01:00
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
2020-05-08 02:44:32 +02:00
|
|
|
with:
|
2022-03-15 03:37:29 +01:00
|
|
|
submodules: true
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2022-03-22 21:07:14 +01:00
|
|
|
- name: Install quilt
|
2022-09-19 18:56:34 +02:00
|
|
|
uses: awalsh128/cache-apt-pkgs-action@latest
|
|
|
|
with:
|
|
|
|
packages: quilt
|
|
|
|
version: 1.0
|
2022-03-22 21:07:14 +01:00
|
|
|
|
|
|
|
- name: Patch Code
|
|
|
|
run: quilt push -a
|
|
|
|
|
2022-05-04 23:58:49 +02:00
|
|
|
- name: Install Node.js v16
|
2022-02-25 17:09:09 +01:00
|
|
|
uses: actions/setup-node@v3
|
2021-02-02 22:29:02 +01:00
|
|
|
with:
|
2022-05-04 23:58:49 +02:00
|
|
|
node-version: "16"
|
2020-05-08 02:44:32 +02:00
|
|
|
|
2022-03-15 03:37:29 +01:00
|
|
|
- name: Fetch dependencies from cache
|
2022-09-19 18:56:34 +02:00
|
|
|
id: cache-node-modules
|
2022-03-21 22:31:02 +01:00
|
|
|
uses: actions/cache@v3
|
2022-03-15 03:37:29 +01:00
|
|
|
with:
|
|
|
|
path: "**/node_modules"
|
|
|
|
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
yarn-build-
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Install dependencies
|
2022-09-19 18:56:34 +02:00
|
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
2021-04-08 20:12:01 +02:00
|
|
|
run: yarn --frozen-lockfile
|
|
|
|
|
|
|
|
- name: Build code-server
|
|
|
|
run: yarn build
|
|
|
|
|
2022-03-15 03:37:29 +01:00
|
|
|
# Get Code's git hash. When this changes it means the content is
|
2022-03-22 21:07:14 +01:00
|
|
|
# different and we need to rebuild.
|
2022-03-15 03:37:29 +01:00
|
|
|
- name: Get latest lib/vscode rev
|
2021-04-08 20:12:01 +02:00
|
|
|
id: vscode-rev
|
2022-03-15 03:37:29 +01:00
|
|
|
run: echo "::set-output name=rev::$(git rev-parse HEAD:./lib/vscode)"
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2022-07-19 21:34:01 +02:00
|
|
|
- name: Get version
|
|
|
|
id: version
|
|
|
|
run: echo "::set-output name=version::$(jq -r .version package.json)"
|
|
|
|
|
|
|
|
# We need to rebuild when we have a new version of Code, when any of
|
|
|
|
# the patches changed, or when the code-server version changes (since
|
|
|
|
# it gets embedded into the code). Use VSCODE_CACHE_VERSION to
|
|
|
|
# force a rebuild.
|
2022-03-22 21:07:14 +01:00
|
|
|
- name: Fetch prebuilt Code package from cache
|
|
|
|
id: cache-vscode
|
2022-03-21 22:31:02 +01:00
|
|
|
uses: actions/cache@v3
|
2020-05-08 02:44:32 +02:00
|
|
|
with:
|
2022-03-22 21:07:14 +01:00
|
|
|
path: lib/vscode-reh-web-*
|
2022-08-04 18:03:28 +02:00
|
|
|
key: vscode-reh-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ steps.version.outputs.version }}-${{ hashFiles('patches/*.diff', 'ci/build/build-vscode.sh') }}
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Build vscode
|
2022-03-22 21:07:14 +01:00
|
|
|
if: steps.cache-vscode.outputs.cache-hit != 'true'
|
2021-04-08 20:12:01 +02:00
|
|
|
run: yarn build:vscode
|
|
|
|
|
2021-10-28 22:27:17 +02:00
|
|
|
# Our code imports code from VS Code's `out` directory meaning VS Code
|
|
|
|
# must be built before running these tests.
|
|
|
|
# TODO: Move to its own step?
|
|
|
|
- name: Run code-server unit tests
|
|
|
|
run: yarn test:unit
|
|
|
|
if: success()
|
|
|
|
|
|
|
|
- name: Upload coverage report to Codecov
|
2022-06-29 17:55:44 +02:00
|
|
|
uses: codecov/codecov-action@v3
|
2022-06-28 19:04:35 +02:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2021-10-28 22:27:17 +02:00
|
|
|
if: success()
|
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
# The release package does not contain any native modules
|
|
|
|
# and is neutral to architecture/os/libc version.
|
|
|
|
- name: Create release package
|
|
|
|
run: yarn release
|
|
|
|
if: success()
|
|
|
|
|
|
|
|
# https://github.com/actions/upload-artifact/issues/38
|
|
|
|
- name: Compress release package
|
|
|
|
run: tar -czf package.tar.gz release
|
|
|
|
|
2020-05-08 02:44:32 +02:00
|
|
|
- name: Upload npm package artifact
|
2022-03-04 17:25:12 +01:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-05-08 02:44:32 +02:00
|
|
|
with:
|
|
|
|
name: npm-package
|
2021-04-08 20:12:01 +02:00
|
|
|
path: ./package.tar.gz
|
2020-05-08 02:44:32 +02:00
|
|
|
|
2022-02-03 21:54:36 +01:00
|
|
|
npm:
|
|
|
|
# the npm-package gets uploaded as an artifact in Build
|
|
|
|
# so we need that to complete before this runs
|
|
|
|
needs: build
|
|
|
|
# This environment "npm" requires someone from
|
|
|
|
# coder/code-server-reviewers to approve the PR before this job runs.
|
|
|
|
environment: npm
|
2022-08-10 20:43:28 +02:00
|
|
|
# Only run if PR comes from base repo or event is not a PR
|
2022-02-22 18:13:20 +01:00
|
|
|
# Reason: forks cannot access secrets and this will always fail
|
2022-08-10 20:43:28 +02:00
|
|
|
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
|
2022-02-03 21:54:36 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-15 03:37:29 +01:00
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
2022-02-03 21:54:36 +01:00
|
|
|
|
2022-03-17 19:52:39 +01:00
|
|
|
- name: Download artifact
|
|
|
|
uses: actions/download-artifact@v3
|
2022-02-03 21:54:36 +01:00
|
|
|
id: download
|
|
|
|
with:
|
|
|
|
name: "npm-package"
|
|
|
|
path: release-npm-package
|
|
|
|
|
|
|
|
- name: Run ./ci/steps/publish-npm.sh
|
|
|
|
run: yarn publish:npm
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
# NOTE@jsjoeio
|
|
|
|
# NPM_ENVIRONMENT intentionally not set here.
|
|
|
|
# Instead, itis determined in publish-npm.sh script
|
|
|
|
# using GITHUB environment variables
|
|
|
|
|
2022-03-30 19:47:46 +02:00
|
|
|
- name: Comment npm information
|
|
|
|
uses: marocchino/sticky-pull-request-comment@v2
|
|
|
|
with:
|
|
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
|
|
header: npm-dev-build
|
|
|
|
message: |
|
|
|
|
✨ code-server dev build published to npm for PR #${{ github.event.number }}!
|
|
|
|
* _Last publish status_: success
|
|
|
|
* _Commit_: ${{ github.event.pull_request.head.sha }}
|
|
|
|
|
|
|
|
To install in a local project, run:
|
|
|
|
```shell-session
|
|
|
|
npm install @coder/code-server-pr@${{ github.event.number }}
|
|
|
|
```
|
|
|
|
|
|
|
|
To install globally, run:
|
|
|
|
```shell-session
|
|
|
|
npm install -g @coder/code-server-pr@${{ github.event.number }}
|
|
|
|
```
|
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
# TODO: cache building yarn --production
|
|
|
|
# possibly 2m30s of savings(?)
|
|
|
|
# this requires refactoring our release scripts
|
|
|
|
package-linux-amd64:
|
|
|
|
name: x86-64 Linux build
|
|
|
|
needs: build
|
2020-05-08 05:48:49 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-07-01 00:16:55 +02:00
|
|
|
timeout-minutes: 15
|
2021-04-08 20:12:01 +02:00
|
|
|
container: "centos:7"
|
2022-09-22 21:33:32 +02:00
|
|
|
env:
|
|
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2020-05-08 05:48:49 +02:00
|
|
|
steps:
|
2022-03-15 03:37:29 +01:00
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2022-05-04 23:58:49 +02:00
|
|
|
- name: Install Node.js v16
|
2022-02-25 17:09:09 +01:00
|
|
|
uses: actions/setup-node@v3
|
2021-04-08 20:12:01 +02:00
|
|
|
with:
|
2022-05-04 23:58:49 +02:00
|
|
|
node-version: "16"
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Install development tools
|
|
|
|
run: |
|
2022-09-22 21:33:32 +02:00
|
|
|
yum install -y epel-release centos-release-scl make
|
2022-05-04 23:58:49 +02:00
|
|
|
yum install -y devtoolset-9-{make,gcc,gcc-c++} jq rsync python3
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Install nfpm and envsubst
|
|
|
|
run: |
|
2022-05-20 21:39:54 +02:00
|
|
|
mkdir -p ~/.local/bin
|
|
|
|
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
|
|
|
|
curl -sSfL https://github.com/a8m/envsubst/releases/download/v1.1.0/envsubst-`uname -s`-`uname -m` -o envsubst
|
2021-04-08 20:12:01 +02:00
|
|
|
chmod +x envsubst
|
|
|
|
mv envsubst ~/.local/bin
|
|
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
|
|
|
|
- name: Install yarn
|
|
|
|
run: npm install -g yarn
|
|
|
|
|
2020-05-08 05:48:49 +02:00
|
|
|
- name: Download npm package
|
2022-03-02 22:31:21 +01:00
|
|
|
uses: actions/download-artifact@v3
|
2020-05-08 05:48:49 +02:00
|
|
|
with:
|
|
|
|
name: npm-package
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Decompress npm package
|
|
|
|
run: tar -xzf package.tar.gz
|
|
|
|
|
|
|
|
# NOTE: && here is deliberate - GitHub puts each line in its own `.sh`
|
|
|
|
# file when running inside a docker container.
|
|
|
|
- name: Build standalone release
|
|
|
|
run: source scl_source enable devtoolset-9 && yarn release:standalone
|
|
|
|
|
2022-09-19 18:56:34 +02:00
|
|
|
- name: Fetch dependencies from cache
|
|
|
|
id: cache-node-modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: "**/node_modules"
|
|
|
|
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
yarn-build-
|
|
|
|
|
2022-06-24 18:33:38 +02:00
|
|
|
- name: Install test dependencies
|
2022-09-19 18:56:34 +02:00
|
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
|
|
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
|
2022-06-24 18:33:38 +02:00
|
|
|
|
|
|
|
- name: Run integration tests on standalone release
|
|
|
|
run: yarn test:integration
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2022-09-22 21:33:32 +02:00
|
|
|
- name: Upload coverage report to Codecov
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
if: success()
|
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
- name: Build packages with nfpm
|
|
|
|
run: yarn package
|
|
|
|
|
2020-05-08 05:48:49 +02:00
|
|
|
- name: Upload release artifacts
|
2022-03-04 17:25:12 +01:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-05-08 05:48:49 +02:00
|
|
|
with:
|
2020-05-08 06:34:20 +02:00
|
|
|
name: release-packages
|
|
|
|
path: ./release-packages
|
2020-05-08 05:48:49 +02:00
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
# NOTE@oxy:
|
|
|
|
# We use Ubuntu 16.04 here, so that our build is more compatible
|
|
|
|
# with older libc versions. We used to (Q1'20) use CentOS 7 here,
|
|
|
|
# but it has a full update EOL of Q4'20 and a 'critical security'
|
|
|
|
# update EOL of 2024. We're dropping full support a few years before
|
|
|
|
# the final EOL, but I don't believe CentOS 7 has a large arm64 userbase.
|
|
|
|
# It is not feasible to cross-compile with CentOS.
|
|
|
|
|
|
|
|
# Cross-compile notes: To compile native dependencies for arm64,
|
2021-08-09 20:35:31 +02:00
|
|
|
# we install the aarch64/armv7l cross toolchain and then set it as the default
|
2021-04-08 20:12:01 +02:00
|
|
|
# compiler/linker/etc. with the AR/CC/CXX/LINK environment variables.
|
|
|
|
# qemu-user-static on ubuntu-16.04 currently doesn't run Node correctly,
|
2021-08-09 20:35:31 +02:00
|
|
|
# so we just build with "native"/x86_64 node, then download arm64/armv7l node
|
|
|
|
# and then put it in our release. We can't smoke test the cross build this way,
|
2021-04-08 20:12:01 +02:00
|
|
|
# but this means we don't need to maintain a self-hosted runner!
|
2021-09-21 20:20:03 +02:00
|
|
|
|
|
|
|
# NOTE@jsjoeio:
|
|
|
|
# We used to use 16.04 until GitHub deprecated it on September 20, 2021
|
|
|
|
# See here: https://github.com/actions/virtual-environments/pull/3862/files
|
2021-08-09 20:35:31 +02:00
|
|
|
package-linux-cross:
|
|
|
|
name: Linux cross-compile builds
|
2021-04-08 20:12:01 +02:00
|
|
|
needs: build
|
2021-09-21 20:20:03 +02:00
|
|
|
runs-on: ubuntu-18.04
|
2021-07-01 00:16:55 +02:00
|
|
|
timeout-minutes: 15
|
2021-08-09 20:35:31 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- prefix: aarch64-linux-gnu
|
|
|
|
arch: arm64
|
|
|
|
- prefix: arm-linux-gnueabihf
|
|
|
|
arch: armv7l
|
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
env:
|
2021-08-09 20:35:31 +02:00
|
|
|
AR: ${{ format('{0}-ar', matrix.prefix) }}
|
|
|
|
CC: ${{ format('{0}-gcc', matrix.prefix) }}
|
|
|
|
CXX: ${{ format('{0}-g++', matrix.prefix) }}
|
|
|
|
LINK: ${{ format('{0}-g++', matrix.prefix) }}
|
|
|
|
NPM_CONFIG_ARCH: ${{ matrix.arch }}
|
2022-05-04 23:58:49 +02:00
|
|
|
NODE_VERSION: v16.13.0
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2020-05-08 02:44:32 +02:00
|
|
|
steps:
|
2022-03-15 03:37:29 +01:00
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2022-05-04 23:58:49 +02:00
|
|
|
- name: Install Node.js v16
|
2022-02-25 17:09:09 +01:00
|
|
|
uses: actions/setup-node@v3
|
2021-04-08 20:12:01 +02:00
|
|
|
with:
|
2022-05-04 23:58:49 +02:00
|
|
|
node-version: "16"
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Install nfpm
|
|
|
|
run: |
|
2022-05-20 21:39:54 +02:00
|
|
|
mkdir -p ~/.local/bin
|
|
|
|
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
|
2021-04-08 20:12:01 +02:00
|
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
|
|
|
|
- name: Install cross-compiler
|
2021-10-29 00:36:21 +02:00
|
|
|
run: sudo apt update && sudo apt install $PACKAGE
|
2021-08-09 20:35:31 +02:00
|
|
|
env:
|
|
|
|
PACKAGE: ${{ format('g++-{0}', matrix.prefix) }}
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2020-05-08 05:48:49 +02:00
|
|
|
- name: Download npm package
|
2022-03-02 22:31:21 +01:00
|
|
|
uses: actions/download-artifact@v3
|
2020-05-08 05:48:49 +02:00
|
|
|
with:
|
|
|
|
name: npm-package
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Decompress npm package
|
|
|
|
run: tar -xzf package.tar.gz
|
|
|
|
|
|
|
|
- name: Build standalone release
|
|
|
|
run: yarn release:standalone
|
|
|
|
|
2021-08-09 20:35:31 +02:00
|
|
|
- name: Replace node with cross-compile equivalent
|
2021-04-08 20:12:01 +02:00
|
|
|
run: |
|
2021-08-09 20:35:31 +02:00
|
|
|
wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}.tar.xz
|
|
|
|
tar -xf node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}.tar.xz node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}/bin/node --strip-components=2
|
2021-04-08 20:12:01 +02:00
|
|
|
mv ./node ./release-standalone/lib/node
|
|
|
|
|
|
|
|
- name: Build packages with nfpm
|
2021-08-09 20:35:31 +02:00
|
|
|
run: yarn package ${NPM_CONFIG_ARCH}
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2020-05-08 02:44:32 +02:00
|
|
|
- name: Upload release artifacts
|
2022-03-04 17:25:12 +01:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-05-08 02:44:32 +02:00
|
|
|
with:
|
2020-05-08 06:34:20 +02:00
|
|
|
name: release-packages
|
|
|
|
path: ./release-packages
|
2020-05-08 02:44:32 +02:00
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
package-macos-amd64:
|
|
|
|
name: x86-64 macOS build
|
|
|
|
needs: build
|
2020-05-08 02:44:32 +02:00
|
|
|
runs-on: macos-latest
|
2021-07-01 00:16:55 +02:00
|
|
|
timeout-minutes: 15
|
2020-05-08 02:44:32 +02:00
|
|
|
steps:
|
2022-03-15 03:37:29 +01:00
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2022-05-04 23:58:49 +02:00
|
|
|
- name: Install Node.js v16
|
2022-02-25 17:09:09 +01:00
|
|
|
uses: actions/setup-node@v3
|
2021-04-08 20:12:01 +02:00
|
|
|
with:
|
2022-05-04 23:58:49 +02:00
|
|
|
node-version: "16"
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Install nfpm
|
|
|
|
run: |
|
2022-05-20 21:39:54 +02:00
|
|
|
mkdir -p ~/.local/bin
|
|
|
|
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
|
2021-04-08 20:12:01 +02:00
|
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
|
2020-05-08 05:48:49 +02:00
|
|
|
- name: Download npm package
|
2022-03-02 22:31:21 +01:00
|
|
|
uses: actions/download-artifact@v3
|
2020-05-08 05:48:49 +02:00
|
|
|
with:
|
|
|
|
name: npm-package
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Decompress npm package
|
|
|
|
run: tar -xzf package.tar.gz
|
|
|
|
|
|
|
|
- name: Build standalone release
|
|
|
|
run: yarn release:standalone
|
|
|
|
|
2022-09-19 18:56:34 +02:00
|
|
|
- name: Fetch dependencies from cache
|
|
|
|
id: cache-node-modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: "**/node_modules"
|
|
|
|
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
yarn-build-
|
|
|
|
|
2022-06-24 18:33:38 +02:00
|
|
|
- name: Install test dependencies
|
2022-09-19 18:56:34 +02:00
|
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
2022-06-24 18:33:38 +02:00
|
|
|
run: SKIP_SUBMODULE_DEPS=1 yarn install
|
|
|
|
|
2022-09-22 21:33:32 +02:00
|
|
|
- name: Run native module tests on standalone release
|
|
|
|
run: yarn test:native
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Build packages with nfpm
|
|
|
|
run: yarn package
|
|
|
|
|
2020-05-08 02:44:32 +02:00
|
|
|
- name: Upload release artifacts
|
2022-03-04 17:25:12 +01:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-05-07 06:06:55 +02:00
|
|
|
with:
|
2020-05-08 06:34:20 +02:00
|
|
|
name: release-packages
|
|
|
|
path: ./release-packages
|
2020-05-16 16:55:46 +02:00
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
test-e2e:
|
|
|
|
name: End-to-end tests
|
|
|
|
needs: package-linux-amd64
|
|
|
|
runs-on: ubuntu-latest
|
2021-07-01 00:16:55 +02:00
|
|
|
timeout-minutes: 15
|
2021-04-08 20:12:01 +02:00
|
|
|
env:
|
2021-06-22 23:34:44 +02:00
|
|
|
# Since we build code-server we might as well run tests from the release
|
|
|
|
# since VS Code will load faster due to the bundling.
|
|
|
|
CODE_SERVER_TEST_ENTRY: "./release-packages/code-server-linux-amd64"
|
2021-04-08 20:12:01 +02:00
|
|
|
steps:
|
2022-03-15 03:37:29 +01:00
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2022-05-04 23:58:49 +02:00
|
|
|
- name: Install Node.js v16
|
2022-02-25 17:09:09 +01:00
|
|
|
uses: actions/setup-node@v3
|
2021-04-08 20:12:01 +02:00
|
|
|
with:
|
2022-05-04 23:58:49 +02:00
|
|
|
node-version: "16"
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Fetch dependencies from cache
|
2022-09-19 18:56:34 +02:00
|
|
|
id: cache-node-modules
|
2022-03-21 22:31:02 +01:00
|
|
|
uses: actions/cache@v3
|
2021-04-08 20:12:01 +02:00
|
|
|
with:
|
|
|
|
path: "**/node_modules"
|
|
|
|
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
2021-06-03 18:30:37 +02:00
|
|
|
restore-keys: |
|
|
|
|
yarn-build-
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Download release packages
|
2022-03-02 22:31:21 +01:00
|
|
|
uses: actions/download-artifact@v3
|
2021-04-08 20:12:01 +02:00
|
|
|
with:
|
|
|
|
name: release-packages
|
|
|
|
path: ./release-packages
|
|
|
|
|
2021-06-22 23:34:44 +02:00
|
|
|
- name: Untar code-server release
|
2021-04-08 20:12:01 +02:00
|
|
|
run: |
|
2021-06-22 23:34:44 +02:00
|
|
|
cd release-packages
|
|
|
|
tar -xzf code-server*-linux-amd64.tar.gz
|
|
|
|
mv code-server*-linux-amd64 code-server-linux-amd64
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Install dependencies
|
2022-09-19 18:56:34 +02:00
|
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
2022-08-09 20:24:37 +02:00
|
|
|
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2021-11-03 22:17:43 +01:00
|
|
|
- name: Install Playwright OS dependencies
|
2021-11-04 17:39:27 +01:00
|
|
|
run: |
|
|
|
|
./test/node_modules/.bin/playwright install-deps
|
|
|
|
./test/node_modules/.bin/playwright install
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Run end-to-end tests
|
2022-08-04 18:03:28 +02:00
|
|
|
run: yarn test:e2e --global-timeout 840000
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Upload test artifacts
|
|
|
|
if: always()
|
2022-03-04 17:25:12 +01:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-04-08 20:12:01 +02:00
|
|
|
with:
|
2021-04-14 21:03:47 +02:00
|
|
|
name: failed-test-videos
|
|
|
|
path: ./test/test-results
|
2022-08-09 20:24:37 +02:00
|
|
|
|
|
|
|
- name: Remove release packages and test artifacts
|
|
|
|
run: rm -rf ./release-packages ./test/test-results
|
|
|
|
|
|
|
|
test-e2e-proxy:
|
|
|
|
name: End-to-end tests behind proxy
|
|
|
|
needs: package-linux-amd64
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 25
|
|
|
|
env:
|
|
|
|
# Since we build code-server we might as well run tests from the release
|
|
|
|
# since VS Code will load faster due to the bundling.
|
|
|
|
CODE_SERVER_TEST_ENTRY: "./release-packages/code-server-linux-amd64"
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install Node.js v16
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: "16"
|
|
|
|
|
|
|
|
- name: Fetch dependencies from cache
|
2022-09-19 18:56:34 +02:00
|
|
|
id: cache-node-modules
|
2022-08-09 20:24:37 +02:00
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: "**/node_modules"
|
|
|
|
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
yarn-build-
|
|
|
|
|
|
|
|
- name: Download release packages
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: release-packages
|
|
|
|
path: ./release-packages
|
|
|
|
|
|
|
|
- name: Untar code-server release
|
|
|
|
run: |
|
|
|
|
cd release-packages
|
|
|
|
tar -xzf code-server*-linux-amd64.tar.gz
|
|
|
|
mv code-server*-linux-amd64 code-server-linux-amd64
|
|
|
|
|
|
|
|
- name: Install dependencies
|
2022-09-19 18:56:34 +02:00
|
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
2022-08-09 20:24:37 +02:00
|
|
|
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
|
|
|
|
|
|
|
|
- name: Install Playwright OS dependencies
|
|
|
|
run: |
|
|
|
|
./test/node_modules/.bin/playwright install-deps
|
|
|
|
./test/node_modules/.bin/playwright install
|
|
|
|
|
|
|
|
- name: Cache Caddy
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: caddy-cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/caddy
|
|
|
|
key: cache-caddy-2.5.2
|
|
|
|
|
|
|
|
- name: Install Caddy
|
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
if: steps.caddy-cache.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
|
|
|
gh release download v2.5.2 --repo caddyserver/caddy --pattern "caddy_2.5.2_linux_amd64.tar.gz"
|
|
|
|
mkdir -p ~/.cache/caddy
|
|
|
|
tar -xzf caddy_2.5.2_linux_amd64.tar.gz --directory ~/.cache/caddy
|
|
|
|
|
|
|
|
- name: Start Caddy
|
|
|
|
run: sudo ~/.cache/caddy/caddy start --config ./ci/Caddyfile
|
|
|
|
|
|
|
|
- name: Run end-to-end tests
|
|
|
|
run: yarn test:e2e:proxy
|
|
|
|
|
|
|
|
- name: Stop Caddy
|
|
|
|
if: always()
|
|
|
|
run: sudo ~/.cache/caddy/caddy stop --config ./ci/Caddyfile
|
|
|
|
|
|
|
|
- name: Upload test artifacts
|
|
|
|
if: always()
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: failed-test-videos-proxy
|
|
|
|
path: ./test/test-results
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Remove release packages and test artifacts
|
2021-04-14 21:03:47 +02:00
|
|
|
run: rm -rf ./release-packages ./test/test-results
|