Archived
1
0

Switch fully to GH Actions

This commit is contained in:
Anmol Sethi 2020-05-07 20:44:32 -04:00
parent 193a45113c
commit 0ec1c69c06
No known key found for this signature in database
GPG Key ID: 8CEF1878FF10ADEB
10 changed files with 115 additions and 172 deletions

View File

@ -3,13 +3,60 @@ name: ci
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
arm64-release: test:
name: linux-arm64-release runs-on: ubuntu-latest
runs-on: [Linux, ARM64]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- run: ./ci/steps/linux-release.sh - name: Run ./ci/steps/test.sh
- uses: actions/upload-artifact@v2 uses: ./ci/container
with:
args: ./ci/steps/test.sh
linux-amd64:
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 release artifacts
uses: actions/upload-artifact@v2
with:
name: release-github
path: ./release-github/*
- name: Upload npm package artifact
uses: actions/upload-artifact@v2
with:
name: npm-package
path: ./release
linux-arm64:
runs-on: ubuntu-arm64-latest
steps:
- uses: actions/checkout@v1
- name: Run ./ci/steps/release.sh
uses: ./ci/container
with:
args: ./ci/steps/release.sh
- name: Upload release artifacts
uses: actions/upload-artifact@v2
with:
name: release-github
path: ./release-github/*
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- run: brew unlink node@12
- run: brew install node
- run: ./ci/steps/release.sh
env:
# Otherwise we get a rate limited when fetching the ripgrep binary.
GITHUB_TOKEN: ${{ secrets.github_token }}
- name: Upload release artifacts
uses: actions/upload-artifact@v2
with: with:
name: release-github name: release-github
path: ./release-github/* path: ./release-github/*

View File

@ -1,80 +0,0 @@
language: node_js
node_js: node
jobs:
include:
- name: Test
if: tag IS blank
script: ./ci/steps/test.sh
deploy: null
install: null
- name: Linux Release
if: tag IS present
script: ./ci/steps/linux-release.sh
install: null
# Unfortunately ARM on travis is very unreliable.
# We see random build failures, logging output being truncated, build being killed
# due to no output even though we use travis_wait etc.
# So we've disabled it for now.
# - name: Linux Release
# if: tag IS present
# arch: arm64
# script: |
# sudo apt-get update && sudo apt-get install -y jq || exit 1
# travis_wait 60 ./ci/steps/linux-release.sh
# install: null
- name: MacOS Release
if: tag IS present
os: osx
# node 13/14 crashes in the build process for some reason.
node_js: 12
script: |
HOMEBREW_NO_INSTALL_CLEANUP=1 HOMEBREW_NO_AUTO_UPDATE=1 brew install jq || exit 1
travis_wait 60 ./ci/steps/static-release.sh || exit 1
install: null
before_deploy:
- echo "$JSON_KEY" | base64 --decode > ./ci/key.json
deploy:
- provider: releases
edge: true
draft: true
overwrite: true
tag_name: $TRAVIS_TAG
target_commitish: $TRAVIS_COMMIT
name: $TRAVIS_TAG
file:
- release-github/*.tar.gz
- release-github/*.zip
- release-github/*.deb
- release-github/*.rpm
on:
tags: true
- provider: gcs
edge: true
bucket: "codesrv-ci.cdr.sh"
upload_dir: "releases"
key_file: ./ci/key.json
local_dir: ./release-gcp
on:
tags: true
# TODO: The gcs provider fails to install on arm64.
condition: $TRAVIS_CPU_ARCH == amd64
- provider: script
edge: true
# We do not use the travis npm deploy integration as it does not allow us to
# deploy a subpath and and v2 which should, just errors out that the src does not exist
script: ./ci/steps/publish-npm.sh
on:
tags: true
condition: $TRAVIS_CPU_ARCH == amd64 && $TRAVIS_OS_NAME == linux
cache:
timeout: 600
yarn: true
directories:
- .cache
- out
- dist
- lib/vscode/.build/extensions

View File

@ -68,15 +68,11 @@ This directory contains the container for CI.
## steps ## 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.
- [./steps/test.sh](./steps/test.sh) - [./steps/test.sh](./steps/test.sh)
- Runs `yarn ci` after ensuring VS Code is patched - Runs `yarn ci` after ensuring VS Code is patched
- [./steps/static-release.sh](./steps/static-release.sh) - [./steps/release.sh](./steps/release.sh)
- Runs the full static build process for CI - Runs the full static build process for CI
- [./steps/linux-release.sh](./steps/linux-release.sh) - Packages the release into a .deb and .rpm for linux
- 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`

View File

@ -1,30 +1,41 @@
FROM centos:7 FROM debian
RUN yum update -y && yum install -y \ RUN apt-get update
devtoolset-6 \
gcc-c++ \
xz \
ccache \
git \
wget \
openssl \
libxkbfile-devel \
libsecret-devel \
libx11-devel \
gettext
RUN yum install -y epel-release && \ # Needed for debian repositories added below.
yum install -y ShellCheck jq golang RUN apt-get install -y curl gnupg
# Installs node.
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs
# Installs yarn.
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y yarn
# Installs VS Code build deps.
RUN apt-get install -y build-essential \
libsecret-1-dev \
libx11-dev \
libxkbfile-dev
# Installs envsubst.
RUN apt-get install -y gettext-base
# Misc build dependencies.
RUN apt-get install -y jq git rsync
# Installs shellcheck.
RUN curl -L https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.$(uname -m).tar.xz | \
tar -xJ && \
mv shellcheck*/shellcheck /usr/local/bin && \
rm -R shellcheck*
# Install Go dependencies
RUN ARCH="$(dpkg --print-architecture)" && \
curl "https://dl.google.com/go/go1.14.2.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH
ENV GO111MODULE=on
RUN go get mvdan.cc/sh/v3/cmd/shfmt
RUN go get github.com/goreleaser/nfpm/cmd/nfpm RUN go get github.com/goreleaser/nfpm/cmd/nfpm
ENV PATH=$PATH:/root/go/bin
RUN mkdir /usr/share/node && cd /usr/share/node \
&& curl "https://nodejs.org/dist/v12.16.3/node-v12.16.3-linux-$(uname -m | sed 's/86_//; s/aarch/arm/').tar.xz" | tar xJ --strip-components=1 --
ENV PATH "$PATH:/usr/share/node/bin"
RUN npm install -g yarn@1.22.4
RUN curl -L "https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_$(uname -m | sed 's/x86_/amd/; s/aarch64/arm/')" > /usr/local/bin/shfmt \
&& chmod +x /usr/local/bin/shfmt
ENTRYPOINT ["/bin/bash", "-c"]

View File

@ -1,24 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
main() {
cd "$(dirname "$0")/../.."
docker build ci/container
imageTag="$(docker build -q ci/container)"
docker run \
--rm \
-e CI \
-e GITHUB_TOKEN \
-e TRAVIS_TAG \
-e NPM_TOKEN \
-v "$(yarn cache dir):/usr/local/share/.cache/yarn/v6" \
$(if [[ -f ~/.npmrc ]]; then echo -v "$HOME/.npmrc:/root/.npmrc"; fi) \
-v "$PWD:/repo" \
-w /repo \
$(if [[ -t 0 ]]; then echo -it; fi) \
"$imageTag" \
"$*"
}
main "$@"

View File

@ -48,6 +48,22 @@ index 7a2320d828..5768890636 100644
+// yarnInstall('test/smoke'); // node modules required for smoketest +// yarnInstall('test/smoke'); // node modules required for smoketest
+// yarnInstall('test/integration/browser'); // node modules required for integration +// yarnInstall('test/integration/browser'); // node modules required for integration
yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
diff --git a/build/npm/preinstall.js b/build/npm/preinstall.js
index cb88d37ade..6b3253af0a 100644
--- a/build/npm/preinstall.js
+++ b/build/npm/preinstall.js
@@ -8,8 +8,9 @@ let err = false;
const majorNodeVersion = parseInt(/^(\d+)\./.exec(process.versions.node)[1]);
if (majorNodeVersion < 10 || majorNodeVersion >= 13) {
- console.error('\033[1;31m*** Please use node >=10 and <=12.\033[0;0m');
- err = true;
+ // We are ok building above Node 12.
+ // console.error('\033[1;31m*** Please use node >=10 and <=12.\033[0;0m');
+ // err = true;
}
const cp = require('child_process');
diff --git a/coder.js b/coder.js diff --git a/coder.js b/coder.js
new file mode 100644 new file mode 100644
index 0000000000..0170b47241 index 0000000000..0170b47241

View File

@ -27,11 +27,8 @@ ENV SHELL=/bin/bash
RUN adduser --gecos '' --disabled-password coder && \ RUN adduser --gecos '' --disabled-password coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
SHELL ["/bin/bash", "-c"] RUN ARCH="$(dpkg --print-architecture)" && \
curl -L "https://github.com/boxboat/fixuid/releases/download/v0.4.1/fixuid-0.4.1-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - && \
COPY ci/lib.sh /tmp/lib.sh
RUN source /tmp/lib.sh && rm /tmp/lib.sh && \
curl -L "https://github.com/boxboat/fixuid/releases/download/v0.4.1/fixuid-0.4.1-linux-$(arch).tar.gz" | tar -C /usr/local/bin -xzf - && \
chown root:root /usr/local/bin/fixuid && \ chown root:root /usr/local/bin/fixuid && \
chmod 4755 /usr/local/bin/fixuid && \ chmod 4755 /usr/local/bin/fixuid && \
mkdir -p /etc/fixuid && \ mkdir -p /etc/fixuid && \

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
main() {
cd "$(dirname "$0")/../.."
source ./ci/lib.sh
./ci/container/exec.sh ./ci/steps/static-release.sh
./ci/container/exec.sh yarn pkg
./ci/release-container/push.sh
}
main "$@"

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
main() {
cd "$(dirname "$0")/../.."
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
./ci/container/exec.sh yarn publish --non-interactive release
}
main "$@"

View File

@ -11,6 +11,10 @@ main() {
STATIC=1 yarn release STATIC=1 yarn release
./ci/build/test-static-release.sh ./ci/build/test-static-release.sh
./ci/build/archive-static-release.sh ./ci/build/archive-static-release.sh
if [[ $OSTYPE == linux* ]]; then
yarn pkg
fi
} }
main "$@" main "$@"