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
|
|
|
|
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.
|
|
|
|
|
|
|
|
# if: steps.cache-yarn.outputs.cache-hit != 'true'
|
|
|
|
# will skip running `yarn install` if it successfully fetched from cache
|
|
|
|
|
2020-05-07 06:06:55 +02:00
|
|
|
jobs:
|
2021-04-08 20:12:01 +02:00
|
|
|
prebuild:
|
2021-07-02 20:18:37 +02:00
|
|
|
name: Pre-build checks
|
2020-05-13 01:33:34 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-07-01 00:16:55 +02:00
|
|
|
timeout-minutes: 5
|
2021-04-23 00:28:30 +02:00
|
|
|
env:
|
|
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
2020-05-13 01:33:34 +02:00
|
|
|
steps:
|
2021-04-08 20:12:01 +02:00
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-06-01 19:19:03 +02:00
|
|
|
- name: Install Node.js v14
|
2021-04-08 20:12:01 +02:00
|
|
|
uses: actions/setup-node@v2
|
2020-05-13 01:33:34 +02:00
|
|
|
with:
|
2021-06-01 19:19:03 +02:00
|
|
|
node-version: "14"
|
2020-05-13 01:33:34 +02:00
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
- name: Install helm
|
2021-04-09 16:11:39 +02:00
|
|
|
uses: azure/setup-helm@v1.1
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Fetch dependencies from cache
|
|
|
|
id: cache-yarn
|
|
|
|
uses: actions/cache@v2
|
2020-05-13 01:33:34 +02:00
|
|
|
with:
|
2021-04-08 20:12:01 +02:00
|
|
|
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: Install dependencies
|
|
|
|
if: steps.cache-yarn.outputs.cache-hit != 'true'
|
|
|
|
run: yarn --frozen-lockfile
|
2020-05-13 01:33:34 +02:00
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
- name: Run yarn fmt
|
|
|
|
run: yarn fmt
|
|
|
|
if: success()
|
|
|
|
|
|
|
|
- name: Run yarn lint
|
|
|
|
run: yarn lint
|
|
|
|
if: success()
|
|
|
|
|
|
|
|
- name: Run code-server unit tests
|
|
|
|
run: yarn test:unit
|
|
|
|
if: success()
|
|
|
|
|
2021-04-23 00:28:30 +02:00
|
|
|
- name: Upload coverage report to Codecov
|
|
|
|
run: yarn coverage
|
|
|
|
if: success()
|
|
|
|
|
2021-05-06 21:02:10 +02:00
|
|
|
audit-ci:
|
|
|
|
name: Run audit-ci
|
|
|
|
needs: prebuild
|
|
|
|
runs-on: ubuntu-latest
|
2021-07-01 00:16:55 +02:00
|
|
|
timeout-minutes: 5
|
2021-05-06 21:02:10 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2021-06-01 19:19:03 +02:00
|
|
|
- name: Install Node.js v14
|
2021-05-06 21:02:10 +02:00
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-06-01 19:19:03 +02:00
|
|
|
node-version: "14"
|
2021-05-06 21:02:10 +02:00
|
|
|
|
|
|
|
- name: Fetch dependencies from cache
|
|
|
|
id: cache-yarn
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: "**/node_modules"
|
|
|
|
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
2021-06-03 18:30:37 +02:00
|
|
|
restore-keys: |
|
|
|
|
yarn-build-
|
2021-05-06 21:02:10 +02:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
if: steps.cache-yarn.outputs.cache-hit != 'true'
|
|
|
|
run: yarn --frozen-lockfile
|
|
|
|
|
|
|
|
- name: Audit for vulnerabilities
|
|
|
|
run: yarn _audit
|
|
|
|
if: success()
|
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
build:
|
|
|
|
name: Build
|
|
|
|
needs: prebuild
|
2020-05-08 02:44:32 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-07-01 00:16:55 +02:00
|
|
|
timeout-minutes: 30
|
2020-05-07 06:06:55 +02:00
|
|
|
steps:
|
2021-03-12 18:48:39 +01:00
|
|
|
- uses: actions/checkout@v2
|
2020-05-08 02:44:32 +02:00
|
|
|
with:
|
2021-04-08 20:12:01 +02:00
|
|
|
fetch-depth: 0
|
|
|
|
|
2021-06-01 19:19:03 +02:00
|
|
|
- name: Install Node.js v14
|
2021-04-08 20:12:01 +02:00
|
|
|
uses: actions/setup-node@v2
|
2021-02-02 22:29:02 +01:00
|
|
|
with:
|
2021-06-01 19:19:03 +02:00
|
|
|
node-version: "14"
|
2020-05-08 02:44:32 +02:00
|
|
|
|
2021-04-08 20:12:01 +02:00
|
|
|
- name: Fetch dependencies from cache
|
|
|
|
id: cache-yarn
|
|
|
|
uses: actions/cache@v2
|
|
|
|
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: Install dependencies
|
|
|
|
if: steps.cache-yarn.outputs.cache-hit != 'true'
|
|
|
|
run: yarn --frozen-lockfile
|
|
|
|
|
|
|
|
- name: Build code-server
|
|
|
|
run: yarn build
|
|
|
|
|
|
|
|
# Parse the hash of the latest commit inside lib/vscode
|
|
|
|
# use this to avoid rebuilding it if nothing changed
|
|
|
|
# How it works: the `git log` command fetches the hash of the last commit
|
|
|
|
# that changed a file inside `lib/vscode`. If a commit changes any file in there,
|
|
|
|
# the hash returned will change, and we rebuild vscode. If the hash did not change,
|
|
|
|
# (for example, a change to `src/` or `docs/`), we reuse the same build as last time.
|
|
|
|
# This saves a lot of time in CI, as compiling VSCode can take anywhere from 5-10 minutes.
|
|
|
|
- name: Get latest lib/vscode rev
|
|
|
|
id: vscode-rev
|
|
|
|
run: echo "::set-output name=rev::$(git log -1 --format='%H' ./lib/vscode)"
|
|
|
|
|
|
|
|
- name: Attempt to fetch vscode build from cache
|
|
|
|
id: cache-vscode
|
|
|
|
uses: actions/cache@v2
|
2020-05-08 02:44:32 +02:00
|
|
|
with:
|
2021-04-08 20:12:01 +02:00
|
|
|
path: |
|
|
|
|
lib/vscode/.build
|
|
|
|
lib/vscode/out-build
|
|
|
|
lib/vscode/out-vscode
|
|
|
|
lib/vscode/out-vscode-min
|
|
|
|
key: vscode-build-${{ steps.vscode-rev.outputs.rev }}
|
|
|
|
|
|
|
|
- name: Build vscode
|
|
|
|
if: steps.cache-vscode.outputs.cache-hit != 'true'
|
|
|
|
run: yarn build:vscode
|
|
|
|
|
|
|
|
# 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
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: npm-package
|
2021-04-08 20:12:01 +02:00
|
|
|
path: ./package.tar.gz
|
2020-05-08 02:44:32 +02:00
|
|
|
|
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"
|
|
|
|
|
2020-05-08 05:48:49 +02:00
|
|
|
steps:
|
2021-03-12 18:48:39 +01:00
|
|
|
- uses: actions/checkout@v2
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2021-06-01 19:19:03 +02:00
|
|
|
- name: Install Node.js v14
|
2021-04-08 20:12:01 +02:00
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-06-01 19:19:03 +02:00
|
|
|
node-version: "14"
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Install development tools
|
|
|
|
run: |
|
|
|
|
yum install -y epel-release centos-release-scl
|
|
|
|
yum install -y devtoolset-9-{make,gcc,gcc-c++} jq rsync
|
|
|
|
|
|
|
|
- name: Install nfpm and envsubst
|
|
|
|
run: |
|
|
|
|
curl -sfL https://install.goreleaser.com/github.com/goreleaser/nfpm.sh | sh -s -- -b ~/.local/bin v2.3.1
|
|
|
|
curl -L https://github.com/a8m/envsubst/releases/download/v1.1.0/envsubst-`uname -s`-`uname -m` -o envsubst
|
|
|
|
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
|
2020-05-08 06:34:20 +02:00
|
|
|
uses: actions/download-artifact@v2
|
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
|
|
|
|
|
|
|
|
- name: Sanity test standalone release
|
|
|
|
run: yarn test:standalone-release
|
|
|
|
|
|
|
|
- name: Build packages with nfpm
|
|
|
|
run: yarn package
|
|
|
|
|
2020-05-08 05:48:49 +02:00
|
|
|
- name: Upload release artifacts
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
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,
|
|
|
|
# we install the aarch64 cross toolchain and then set it as the default
|
|
|
|
# compiler/linker/etc. with the AR/CC/CXX/LINK environment variables.
|
|
|
|
# qemu-user-static on ubuntu-16.04 currently doesn't run Node correctly,
|
|
|
|
# so we just build with "native"/x86_64 node, then download arm64 node
|
|
|
|
# and then put it in our release. We can't smoke test the arm64 build this way,
|
|
|
|
# but this means we don't need to maintain a self-hosted runner!
|
|
|
|
package-linux-arm64:
|
|
|
|
name: Linux ARM64 cross-compile build
|
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-16.04
|
2021-07-01 00:16:55 +02:00
|
|
|
timeout-minutes: 15
|
2021-04-08 20:12:01 +02:00
|
|
|
env:
|
|
|
|
AR: aarch64-linux-gnu-ar
|
|
|
|
CC: aarch64-linux-gnu-gcc
|
|
|
|
CXX: aarch64-linux-gnu-g++
|
|
|
|
LINK: aarch64-linux-gnu-g++
|
|
|
|
NPM_CONFIG_ARCH: arm64
|
|
|
|
|
2020-05-08 02:44:32 +02:00
|
|
|
steps:
|
2021-03-12 18:48:39 +01:00
|
|
|
- uses: actions/checkout@v2
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2021-06-01 19:19:03 +02:00
|
|
|
- name: Install Node.js v14
|
2021-04-08 20:12:01 +02:00
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-06-01 19:19:03 +02:00
|
|
|
node-version: "14"
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Install nfpm
|
|
|
|
run: |
|
|
|
|
curl -sfL https://install.goreleaser.com/github.com/goreleaser/nfpm.sh | sh -s -- -b ~/.local/bin v2.3.1
|
|
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
|
|
|
|
- name: Install cross-compiler
|
|
|
|
run: sudo apt install g++-aarch64-linux-gnu
|
|
|
|
|
2020-05-08 05:48:49 +02:00
|
|
|
- name: Download npm package
|
2020-05-08 06:34:20 +02:00
|
|
|
uses: actions/download-artifact@v2
|
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
|
|
|
|
|
|
|
|
- name: Replace node with arm64 equivalent
|
|
|
|
run: |
|
2021-06-01 19:19:03 +02:00
|
|
|
wget https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-arm64.tar.xz
|
|
|
|
tar -xf node-v14.17.0-linux-arm64.tar.xz node-v14.17.0-linux-arm64/bin/node --strip-components=2
|
2021-04-08 20:12:01 +02:00
|
|
|
mv ./node ./release-standalone/lib/node
|
|
|
|
|
|
|
|
- name: Build packages with nfpm
|
|
|
|
run: yarn package arm64
|
|
|
|
|
2020-05-08 02:44:32 +02:00
|
|
|
- name: Upload release artifacts
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
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:
|
2021-03-12 18:48:39 +01:00
|
|
|
- uses: actions/checkout@v2
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2021-06-01 19:19:03 +02:00
|
|
|
- name: Install Node.js v14
|
2021-04-08 20:12:01 +02:00
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-06-01 19:19:03 +02:00
|
|
|
node-version: "14"
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Install nfpm
|
|
|
|
run: |
|
|
|
|
curl -sfL https://install.goreleaser.com/github.com/goreleaser/nfpm.sh | sh -s -- -b ~/.local/bin v2.3.1
|
|
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
|
2020-05-08 05:48:49 +02:00
|
|
|
- name: Download npm package
|
2020-05-08 06:34:20 +02:00
|
|
|
uses: actions/download-artifact@v2
|
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
|
|
|
|
|
|
|
|
- name: Sanity test standalone release
|
|
|
|
run: yarn test:standalone-release
|
|
|
|
|
|
|
|
- name: Build packages with nfpm
|
|
|
|
run: yarn package
|
|
|
|
|
2020-05-08 02:44:32 +02:00
|
|
|
- name: Upload release artifacts
|
|
|
|
uses: actions/upload-artifact@v2
|
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:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2021-06-01 19:19:03 +02:00
|
|
|
- name: Install Node.js v14
|
2021-04-08 20:12:01 +02:00
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-06-01 19:19:03 +02:00
|
|
|
node-version: "14"
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Install playwright
|
|
|
|
uses: microsoft/playwright-github-action@v1
|
|
|
|
|
|
|
|
- name: Fetch dependencies from cache
|
|
|
|
id: cache-yarn
|
|
|
|
uses: actions/cache@v2
|
|
|
|
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
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
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
|
|
|
|
if: steps.cache-yarn.outputs.cache-hit != 'true'
|
|
|
|
run: yarn --frozen-lockfile
|
|
|
|
|
|
|
|
# HACK: this shouldn't need to exist, but put it here anyway
|
|
|
|
# in an attempt to solve Playwright cache failures.
|
|
|
|
- name: Reinstall playwright
|
|
|
|
if: steps.cache-yarn.outputs.cache-hit == 'true'
|
|
|
|
run: |
|
|
|
|
cd test/
|
|
|
|
rm -r node_modules/playwright
|
|
|
|
yarn install --check-files
|
|
|
|
|
|
|
|
- name: Run end-to-end tests
|
2021-06-22 23:34:44 +02:00
|
|
|
run: yarn test:e2e
|
2021-04-08 20:12:01 +02:00
|
|
|
|
|
|
|
- name: Upload test artifacts
|
|
|
|
if: always()
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2021-04-14 21:03:47 +02:00
|
|
|
name: failed-test-videos
|
|
|
|
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
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2021-05-28 18:51:41 +02:00
|
|
|
# Builds both amd64 and arm64 images
|
|
|
|
docker-images:
|
2020-05-16 16:55:46 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-05-28 18:51:41 +02:00
|
|
|
needs: [package-linux-amd64, package-linux-arm64]
|
2020-05-16 16:55:46 +02:00
|
|
|
steps:
|
2021-03-12 18:48:39 +01:00
|
|
|
- uses: actions/checkout@v2
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2020-05-16 16:55:46 +02:00
|
|
|
- name: Download release package
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: release-packages
|
|
|
|
path: ./release-packages
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2021-05-28 18:51:41 +02:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2021-05-28 18:51:41 +02:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
2021-04-08 20:12:01 +02:00
|
|
|
|
2020-05-16 16:55:46 +02:00
|
|
|
- name: Run ./ci/steps/build-docker-image.sh
|
2021-04-08 20:12:01 +02:00
|
|
|
run: ./ci/steps/build-docker-image.sh
|
|
|
|
|
2021-05-28 18:51:41 +02:00
|
|
|
- name: Upload release images
|
2020-05-16 16:55:46 +02:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: release-images
|
|
|
|
path: ./release-images
|
2021-04-29 21:12:03 +02:00
|
|
|
|
|
|
|
trivy-scan-image:
|
|
|
|
runs-on: ubuntu-20.04
|
2021-05-28 18:51:41 +02:00
|
|
|
needs: docker-images
|
2021-05-24 19:55:15 +02:00
|
|
|
# NOTE@jsjoeio: disabling due to a memory issue upstream
|
|
|
|
# See: https://github.com/github/codeql-action/issues/528
|
|
|
|
if: 1 == 2
|
2021-04-29 21:12:03 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Download release images
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: release-images
|
|
|
|
path: ./release-images
|
|
|
|
|
|
|
|
- name: Run Trivy vulnerability scanner in image mode
|
2021-05-12 19:31:48 +02:00
|
|
|
# Commit SHA for v0.0.17
|
2021-05-28 19:09:07 +02:00
|
|
|
uses: aquasecurity/trivy-action@ac8de07fd168680dd0331bef43681c0e150e9ad1
|
2021-04-29 21:12:03 +02:00
|
|
|
with:
|
|
|
|
input: "./release-images/code-server-amd64-*.tar"
|
|
|
|
scan-type: "image"
|
|
|
|
ignore-unfixed: true
|
|
|
|
format: "template"
|
|
|
|
template: "@/contrib/sarif.tpl"
|
|
|
|
output: "trivy-image-results.sarif"
|
|
|
|
severity: "HIGH,CRITICAL"
|
|
|
|
|
2021-05-24 19:55:15 +02:00
|
|
|
- name: Debug Trivy SARIF file
|
|
|
|
run: cat trivy-image-results.sarif && ls -l trivy-image-results.sarif
|
|
|
|
|
2021-04-29 21:12:03 +02:00
|
|
|
- name: Upload Trivy scan results to GitHub Security tab
|
|
|
|
uses: github/codeql-action/upload-sarif@v1
|
|
|
|
with:
|
|
|
|
sarif_file: "trivy-image-results.sarif"
|
2021-05-28 18:51:41 +02:00
|
|
|
|
2021-04-29 21:12:03 +02:00
|
|
|
# We have to use two trivy jobs
|
|
|
|
# because GitHub only allows
|
|
|
|
# codeql/upload-sarif action per job
|
|
|
|
trivy-scan-repo:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Run Trivy vulnerability scanner in repo mode
|
2021-05-12 19:31:48 +02:00
|
|
|
#Commit SHA for v0.0.17
|
2021-05-28 19:09:07 +02:00
|
|
|
uses: aquasecurity/trivy-action@ac8de07fd168680dd0331bef43681c0e150e9ad1
|
2021-05-11 20:18:35 +02:00
|
|
|
with:
|
|
|
|
scan-type: "fs"
|
|
|
|
scan-ref: "."
|
|
|
|
ignore-unfixed: true
|
|
|
|
format: "template"
|
|
|
|
template: "@/contrib/sarif.tpl"
|
|
|
|
output: "trivy-repo-results.sarif"
|
|
|
|
severity: "HIGH,CRITICAL"
|
|
|
|
- name: Upload Trivy scan results to GitHub Security tab
|
|
|
|
uses: github/codeql-action/upload-sarif@v1
|
|
|
|
with:
|
|
|
|
sarif_file: "trivy-repo-results.sarif"
|