From 914fb42eede83a947cca652090bdd026198e673a Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Mon, 26 Feb 2024 15:32:48 +0100 Subject: [PATCH] build(linux): add alpine reh [skip ci] --- .github/workflows/insider-linux.yml | 67 ++++++++++++++++++++++++++++- package_alpine_reh.sh | 67 +++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 1 deletion(-) create mode 100755 package_alpine_reh.sh diff --git a/.github/workflows/insider-linux.yml b/.github/workflows/insider-linux.yml index b7784acc32d..c48d30fc4aa 100644 --- a/.github/workflows/insider-linux.yml +++ b/.github/workflows/insider-linux.yml @@ -220,7 +220,7 @@ jobs: retention-days: 3 if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'no' && github.event.inputs.generate_assets == 'true' - reh: + reh_linux: needs: - check - compile @@ -289,6 +289,71 @@ jobs: retention-days: 3 if: env.SHOULD_DEPLOY == 'no' && github.event.inputs.generate_assets == 'true' + reh_alpine: + needs: + - check + - compile + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + include: + - vscode_arch: x64 + npm_arch: x64 + - vscode_arch: arm64 + npm_arch: arm64 + env: + BUILD_SOURCEVERSION: ${{ needs.compile.outputs.BUILD_SOURCEVERSION }} + MS_COMMIT: ${{ needs.check.outputs.MS_COMMIT }} + MS_TAG: ${{ needs.check.outputs.MS_TAG }} + RELEASE_VERSION: ${{ needs.check.outputs.RELEASE_VERSION }} + SHOULD_BUILD: ${{ needs.check.outputs.SHOULD_BUILD }} + SHOULD_DEPLOY: ${{ needs.check.outputs.SHOULD_DEPLOY }} + VSCODE_ARCH: ${{ matrix.vscode_arch }} + if: needs.check.outputs.SHOULD_BUILD == 'yes' || github.event.inputs.generate_assets == 'true' + + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ env.GITHUB_BRANCH }} + + - name: Install GH + run: ./install_gh.sh + + - name: Check existing VSCodium tags/releases + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CHECK_ONLY_REH: 'yes' + run: ./check_tags.sh + + - name: Download vscode artifact + uses: actions/download-artifact@v3 + with: + name: vscode + if: env.SHOULD_BUILD_REH != 'no' || github.event.inputs.generate_assets == 'true' + + - name: Build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + npm_config_arch: ${{ matrix.npm_arch }} + run: ./package_alpine_reh.sh + if: env.SHOULD_BUILD_REH != 'no' || github.event.inputs.generate_assets == 'true' + + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }} + GITHUB_USERNAME: ${{ github.repository_owner }} + run: ./release.sh + if: env.SHOULD_BUILD_REH != 'no' && env.SHOULD_DEPLOY == 'yes' + + - name: Upload assets + uses: actions/upload-artifact@v3 + with: + name: reh-${{ matrix.vscode_arch }} + path: assets/ + retention-days: 3 + if: env.SHOULD_DEPLOY == 'no' && github.event.inputs.generate_assets == 'true' + aur: needs: - check diff --git a/package_alpine_reh.sh b/package_alpine_reh.sh new file mode 100755 index 00000000000..24e12678bf0 --- /dev/null +++ b/package_alpine_reh.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +# shellcheck disable=SC1091 + +set -ex + +if [[ "${CI_BUILD}" == "no" ]]; then + exit 1 +fi + +tar -xzf ./vscode.tar.gz + +cd vscode || { echo "'vscode' dir not found"; exit 1; } + +export VSCODE_PLATFORM='alpine' + +VSCODE_HOST_MOUNT="$( pwd )" + +export VSCODE_HOST_MOUNT + +VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:alpine-${VSCODE_ARCH}" + +export VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME + +for i in {1..5}; do # try 5 times + yarn --cwd build --frozen-lockfile --check-files && break + if [[ $i == 3 ]]; then + echo "Yarn failed too many times" >&2 + exit 1 + fi + echo "Yarn failed $i, trying again..." +done + +node build/azure-pipelines/distro/mixin-npm + +yarn gulp minify-vscode-reh +yarn gulp "vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-min-ci" + +cd .. + +APP_NAME_LC="$( echo "${APP_NAME}" | awk '{print tolower($0)}' )" + +mkdir -p assets + +echo "Building and moving REH" +cd "vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}" +tar czf "../assets/${APP_NAME_LC}-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" . +cd .. + +npm install -g checksum + +sum_file() { + if [[ -f "${1}" ]]; then + echo "Calculating checksum for ${1}" + checksum -a sha256 "${1}" > "${1}".sha256 + checksum "${1}" > "${1}".sha1 + fi +} + +cd assets + +for FILE in *; do + if [[ -f "${FILE}" ]]; then + sum_file "${FILE}" + fi +done + +cd ..