build(linux): add alpine reh [skip ci]

This commit is contained in:
Baptiste Augrain 2024-02-26 15:32:48 +01:00
parent 3c21a8ca23
commit 914fb42eed
2 changed files with 133 additions and 1 deletions

View File

@ -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

67
package_alpine_reh.sh Executable file
View File

@ -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 ..