2022-09-16 17:14:28 +02:00
|
|
|
name: Draft release
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2022-11-08 23:45:01 +01:00
|
|
|
inputs:
|
|
|
|
version:
|
|
|
|
description: The version to publish (include "v", i.e. "v4.9.1").
|
|
|
|
type: string
|
|
|
|
required: true
|
2022-09-16 17:14:28 +02:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: write # For creating releases.
|
|
|
|
discussions: write # For creating a discussion.
|
|
|
|
|
|
|
|
# Cancel in-progress runs for pull requests when developers push
|
|
|
|
# additional changes
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
|
|
|
|
jobs:
|
2022-09-27 20:46:37 +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
|
2022-09-16 17:14:28 +02:00
|
|
|
runs-on: ubuntu-latest
|
2022-09-27 20:46:37 +02:00
|
|
|
timeout-minutes: 15
|
2022-11-08 23:45:01 +01:00
|
|
|
needs: npm-version
|
2022-09-27 20:46:37 +02:00
|
|
|
container: "centos:7"
|
|
|
|
env:
|
|
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install Node.js v16
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: "16"
|
|
|
|
|
|
|
|
- name: Install development tools
|
|
|
|
run: |
|
|
|
|
yum install -y epel-release centos-release-scl make
|
|
|
|
yum install -y devtoolset-9-{make,gcc,gcc-c++} jq rsync python3
|
2022-12-08 19:30:08 +01:00
|
|
|
# for keytar
|
|
|
|
yum install -y libsecret-devel
|
2022-09-27 20:46:37 +02:00
|
|
|
|
|
|
|
- name: Install nfpm and envsubst
|
|
|
|
run: |
|
|
|
|
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
|
|
|
|
chmod +x envsubst
|
|
|
|
mv envsubst ~/.local/bin
|
|
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
|
|
|
|
- name: Install yarn
|
|
|
|
run: npm install -g yarn
|
|
|
|
|
2022-11-08 23:45:01 +01:00
|
|
|
- name: Download npm package
|
|
|
|
uses: actions/download-artifact@v3
|
2022-09-27 20:46:37 +02:00
|
|
|
with:
|
2022-11-08 23:45:01 +01:00
|
|
|
name: npm-release-package
|
2022-09-27 20:46:37 +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: 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 test dependencies
|
|
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
|
|
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
|
|
|
|
|
|
|
|
- name: Run integration tests on standalone release
|
|
|
|
run: yarn test:integration
|
|
|
|
|
|
|
|
- name: Upload coverage report to Codecov
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
if: success()
|
|
|
|
|
2022-11-08 23:45:01 +01:00
|
|
|
# NOTE@jsjoeio - we do this so we can strip out the v
|
|
|
|
# i.e. v4.9.1 -> 4.9.1
|
|
|
|
- name: Get and set VERSION
|
|
|
|
run: |
|
|
|
|
TAG="${{ inputs.version || github.ref_name }}"
|
|
|
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
|
|
|
|
2022-09-27 20:46:37 +02:00
|
|
|
- name: Build packages with nfpm
|
2022-11-08 23:45:01 +01:00
|
|
|
env:
|
|
|
|
VERSION: ${{ env.VERSION }}
|
2022-09-27 20:46:37 +02:00
|
|
|
run: yarn package
|
|
|
|
|
|
|
|
- uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
draft: true
|
|
|
|
discussion_category_name: "📣 Announcements"
|
|
|
|
files: ./release-packages/*
|
|
|
|
|
|
|
|
# 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/armv7l 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/armv7l node
|
|
|
|
# and then put it in our release. We can't smoke test the cross build this way,
|
|
|
|
# but this means we don't need to maintain a self-hosted runner!
|
|
|
|
|
|
|
|
# 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
|
|
|
|
package-linux-cross:
|
|
|
|
name: Linux cross-compile builds
|
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
timeout-minutes: 15
|
2022-11-08 23:45:01 +01:00
|
|
|
needs: npm-version
|
2022-09-27 20:46:37 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- prefix: aarch64-linux-gnu
|
|
|
|
arch: arm64
|
|
|
|
- prefix: arm-linux-gnueabihf
|
|
|
|
arch: armv7l
|
|
|
|
|
|
|
|
env:
|
|
|
|
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 }}
|
|
|
|
NODE_VERSION: v16.13.0
|
|
|
|
|
2022-09-16 17:14:28 +02:00
|
|
|
steps:
|
2022-09-27 20:46:37 +02:00
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install Node.js v16
|
|
|
|
uses: actions/setup-node@v3
|
2022-09-16 17:14:28 +02:00
|
|
|
with:
|
2022-09-27 20:46:37 +02:00
|
|
|
node-version: "16"
|
|
|
|
|
|
|
|
- name: Install nfpm
|
|
|
|
run: |
|
|
|
|
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
|
|
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
|
|
|
|
- name: Install cross-compiler
|
|
|
|
run: sudo apt update && sudo apt install $PACKAGE
|
|
|
|
env:
|
|
|
|
PACKAGE: ${{ format('g++-{0}', matrix.prefix) }}
|
2022-09-16 17:14:28 +02:00
|
|
|
|
2022-11-08 23:45:01 +01:00
|
|
|
- name: Download npm package
|
|
|
|
uses: actions/download-artifact@v3
|
2022-09-16 17:14:28 +02:00
|
|
|
with:
|
2022-11-08 23:45:01 +01:00
|
|
|
name: npm-release-package
|
2022-09-27 20:46:37 +02:00
|
|
|
|
|
|
|
- name: Decompress npm package
|
|
|
|
run: tar -xzf package.tar.gz
|
|
|
|
|
|
|
|
- name: Build standalone release
|
|
|
|
run: yarn release:standalone
|
|
|
|
|
|
|
|
- name: Replace node with cross-compile equivalent
|
|
|
|
run: |
|
|
|
|
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
|
|
|
|
mv ./node ./release-standalone/lib/node
|
|
|
|
|
2022-11-08 23:45:01 +01:00
|
|
|
# NOTE@jsjoeio - we do this so we can strip out the v
|
|
|
|
# i.e. v4.9.1 -> 4.9.1
|
|
|
|
- name: Get and set VERSION
|
|
|
|
run: |
|
|
|
|
TAG="${{ inputs.version || github.ref_name }}"
|
|
|
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
|
|
|
|
2022-09-27 20:46:37 +02:00
|
|
|
- name: Build packages with nfpm
|
2022-11-08 23:45:01 +01:00
|
|
|
env:
|
|
|
|
VERSION: ${{ env.VERSION }}
|
2022-09-27 20:46:37 +02:00
|
|
|
run: yarn package ${NPM_CONFIG_ARCH}
|
|
|
|
|
|
|
|
- uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
draft: true
|
|
|
|
discussion_category_name: "📣 Announcements"
|
|
|
|
files: ./release-packages/*
|
|
|
|
|
|
|
|
package-macos-amd64:
|
|
|
|
name: x86-64 macOS build
|
|
|
|
runs-on: macos-latest
|
|
|
|
timeout-minutes: 15
|
2022-11-08 23:45:01 +01:00
|
|
|
needs: npm-version
|
2022-09-27 20:46:37 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install Node.js v16
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: "16"
|
|
|
|
|
|
|
|
- name: Install nfpm
|
|
|
|
run: |
|
|
|
|
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
|
|
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
|
2022-11-08 23:45:01 +01:00
|
|
|
- name: Download npm package
|
|
|
|
uses: actions/download-artifact@v3
|
2022-09-27 20:46:37 +02:00
|
|
|
with:
|
2022-11-08 23:45:01 +01:00
|
|
|
name: npm-release-package
|
2022-09-27 20:46:37 +02:00
|
|
|
|
|
|
|
- name: Decompress npm package
|
|
|
|
run: tar -xzf package.tar.gz
|
|
|
|
|
|
|
|
- name: Build standalone release
|
|
|
|
run: yarn release:standalone
|
|
|
|
|
|
|
|
- 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 test dependencies
|
|
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
|
|
run: SKIP_SUBMODULE_DEPS=1 yarn install
|
|
|
|
|
|
|
|
- name: Run native module tests on standalone release
|
|
|
|
run: yarn test:native
|
|
|
|
|
2022-11-08 23:45:01 +01:00
|
|
|
# NOTE@jsjoeio - we do this so we can strip out the v
|
|
|
|
# i.e. v4.9.1 -> 4.9.1
|
|
|
|
- name: Get and set VERSION
|
|
|
|
run: |
|
|
|
|
TAG="${{ inputs.version || github.ref_name }}"
|
|
|
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
|
|
|
|
2022-09-27 20:46:37 +02:00
|
|
|
- name: Build packages with nfpm
|
2022-11-08 23:45:01 +01:00
|
|
|
env:
|
|
|
|
VERSION: ${{ env.VERSION }}
|
2022-09-27 20:46:37 +02:00
|
|
|
run: yarn package
|
2022-09-16 17:14:28 +02:00
|
|
|
|
|
|
|
- uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
draft: true
|
|
|
|
discussion_category_name: "📣 Announcements"
|
|
|
|
files: ./release-packages/*
|
2022-11-01 18:16:30 +01:00
|
|
|
|
|
|
|
npm-package:
|
|
|
|
name: Upload npm package
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 15
|
2022-11-08 23:45:01 +01:00
|
|
|
needs: npm-version
|
|
|
|
steps:
|
|
|
|
- name: Download npm package
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: npm-release-package
|
|
|
|
|
|
|
|
- uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
draft: true
|
|
|
|
discussion_category_name: "📣 Announcements"
|
|
|
|
files: ./package.tar.gz
|
|
|
|
|
|
|
|
npm-version:
|
|
|
|
name: Modify package.json version
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 15
|
2022-11-01 18:16:30 +01:00
|
|
|
steps:
|
|
|
|
- name: Download artifacts
|
|
|
|
uses: dawidd6/action-download-artifact@v2
|
|
|
|
id: download
|
|
|
|
with:
|
|
|
|
branch: ${{ github.ref }}
|
|
|
|
workflow: build.yaml
|
|
|
|
workflow_conclusion: completed
|
|
|
|
check_artifacts: true
|
|
|
|
name: npm-package
|
|
|
|
|
2022-11-08 23:45:01 +01:00
|
|
|
- name: Decompress npm package
|
|
|
|
run: tar -xzf package.tar.gz
|
|
|
|
|
|
|
|
# NOTE@jsjoeio - we do this so we can strip out the v
|
|
|
|
# i.e. v4.9.1 -> 4.9.1
|
|
|
|
- name: Get and set VERSION
|
|
|
|
run: |
|
|
|
|
TAG="${{ inputs.version || github.ref_name }}"
|
|
|
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Modify version
|
|
|
|
env:
|
2022-11-10 21:48:56 +01:00
|
|
|
VERSION: ${{ env.VERSION }}
|
2022-11-08 23:45:01 +01:00
|
|
|
run: |
|
|
|
|
echo "Updating version in root package.json"
|
|
|
|
npm version --prefix release "$VERSION"
|
|
|
|
|
|
|
|
echo "Updating version in lib/vscode/product.json"
|
|
|
|
tmp=$(mktemp)
|
2022-12-07 23:19:20 +01:00
|
|
|
jq ".codeServerVersion = \"$VERSION\"" release/lib/vscode/product.json > "$tmp" && mv "$tmp" release/lib/vscode/product.json
|
2022-12-06 21:28:27 +01:00
|
|
|
# Ensure it has the same permissions as before
|
|
|
|
chmod 644 release/lib/vscode/product.json
|
2022-11-08 23:45:01 +01:00
|
|
|
|
|
|
|
- name: Compress release package
|
|
|
|
run: tar -czf package.tar.gz release
|
|
|
|
|
|
|
|
- name: Upload npm package artifact
|
|
|
|
uses: actions/upload-artifact@v3
|
2022-11-01 18:16:30 +01:00
|
|
|
with:
|
2022-11-08 23:45:01 +01:00
|
|
|
name: npm-release-package
|
|
|
|
path: ./package.tar.gz
|