(experiment) use GH actions for Windows builds

This commit is contained in:
Peter Squicciarini 2021-01-12 12:01:29 -08:00
parent c7187ed00f
commit 768ea6778e
9 changed files with 212 additions and 172 deletions

87
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,87 @@
name: windows_build
on:
schedule:
- cron: '0 0 * * *'
push:
pull_request:
branches: [ master ]
jobs:
windows:
runs-on: windows-2016
env:
VSCODE_ARCH: ${{ matrix.vscode_arch }}
strategy:
fail-fast: false
matrix:
vscode_arch: [x64, ia32, arm64]
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v1
with:
node-version: 12.18.3
- name: Install Yarn
run: npm install -g yarn
- name: Setup Python 2
uses: actions/setup-python@v2
with:
python-version: '2.x'
- name: Clone VSCode repo
run: ./get_repo.sh
shell: bash
- name: Check existing VSCodium tags/releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./check_tags.sh
shell: bash
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm_config_arch: ${{ matrix.vscode_arch }}
npm_config_target_arch: ${{ matrix.vscode_arch }}
run: ./build.sh
if: env.SHOULD_BUILD == 'yes'
- name: Move/rename build artifacts
run: |
mv vscode\\.build\\win32-${VSCODE_ARCH}\\system-setup\\VSCodeSetup.exe VSCodiumSetup-${VSCODE_ARCH}-${LATEST_MS_TAG}.exe
mv vscode\\.build\\win32-${VSCODE_ARCH}\\user-setup\\VSCodeSetup.exe VSCodiumUserSetup-${VSCODE_ARCH}-${LATEST_MS_TAG}.exe
mv vscode\\.build\\win32-${VSCODE_ARCH}\\archive\\VSCode-win32-${VSCODE_ARCH}.zip VSCodium-win32-${VSCODE_ARCH}-${LATEST_MS_TAG}.zip
shell: bash
if: env.SHOULD_BUILD == 'yes'
- name: Generate shasums
run: ./sum.sh
shell: bash
if: env.SHOULD_BUILD == 'yes'
- name: Release
uses: softprops/action-gh-release@v1
if: env.SHOULD_BUILD == 'yes'
with:
tag_name: ${{ env.LATEST_MS_TAG }}
files: |
./*.sha256
./VSCodium*.zip
./VSCodiumUserSetup*.exe
./VSCodiumSetup*.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update versions repo
if: env.SHOULD_BUILD == 'yes'
run: ./update_version.sh
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.repository_owner }}

View File

@ -1,16 +0,0 @@
jobs:
- job: Windows
pool:
vmImage: VS2017-Win2016
variables:
BUILDARCH: x64
steps:
- template: win32-build.yml
- job: Windows32
pool:
vmImage: VS2017-Win2016
variables:
BUILDARCH: ia32
steps:
- template: win32-build.yml

View File

@ -5,14 +5,7 @@ set -ex
if [[ "$SHOULD_BUILD" == "yes" ]]; then
npm config set scripts-prepend-node-path true
export BUILD_SOURCEVERSION=$LATEST_MS_COMMIT
echo "LATEST_MS_COMMIT: ${LATEST_MS_COMMIT}"
echo "BUILD_SOURCEVERSION: ${BUILD_SOURCEVERSION}"
if [[ "$CI_WINDOWS" == "True" ]]; then
export npm_config_arch="$BUILDARCH"
export npm_config_target_arch="$BUILDARCH"
fi
. prepare_vscode.sh
@ -27,14 +20,14 @@ if [[ "$SHOULD_BUILD" == "yes" ]]; then
if [[ "$OS_NAME" == "osx" ]]; then
yarn gulp "vscode-darwin-${VSCODE_ARCH}-min-ci"
elif [[ "$CI_WINDOWS" == "True" ]]; then
elif [[ "$OS_NAME" == "windows" ]]; then
cp LICENSE.txt LICENSE.rtf # windows build expects rtf license
yarn gulp "vscode-win32-${BUILDARCH}-min-ci"
yarn gulp "vscode-win32-${BUILDARCH}-code-helper"
yarn gulp "vscode-win32-${BUILDARCH}-inno-updater"
yarn gulp "vscode-win32-${BUILDARCH}-archive"
yarn gulp "vscode-win32-${BUILDARCH}-system-setup"
yarn gulp "vscode-win32-${BUILDARCH}-user-setup"
yarn gulp "vscode-win32-${VSCODE_ARCH}-min-ci"
yarn gulp "vscode-win32-${VSCODE_ARCH}-code-helper"
yarn gulp "vscode-win32-${VSCODE_ARCH}-inno-updater"
yarn gulp "vscode-win32-${VSCODE_ARCH}-archive"
yarn gulp "vscode-win32-${VSCODE_ARCH}-system-setup"
yarn gulp "vscode-win32-${VSCODE_ARCH}-user-setup"
else # linux
yarn gulp "vscode-linux-${VSCODE_ARCH}-min-ci"
if [[ "$SKIP_LINUX_PACKAGES" != "True" ]]; then

View File

@ -15,52 +15,113 @@ if [ "$GITHUB_TOKEN" != "" ]; then
echo "Building on Mac because we have no ZIP"
export SHOULD_BUILD="yes"
fi
elif [[ $VSCODE_ARCH == "arm64" ]]; then
HAVE_ARM64_DEB=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["arm64.deb"])')
HAVE_ARM64_TAR=$(echo $VSCODIUM_ASSETS | jq --arg suffix "arm64-$LATEST_MS_TAG.tar.gz" 'map(.name) | contains([$suffix])')
if [[ "$HAVE_ARM64_DEB" != "true" ]]; then
echo "Building on Linux arm64 because we have no DEB"
export SHOULD_BUILD="yes"
elif [[ "$OS_NAME" == "windows" ]]; then
if [[ $VSCODE_ARCH == "arm64" ]]; then
HAVE_ARM64_SYS=$(echo $VSCODIUM_ASSETS | jq --arg suffix "$VSCODE_ARCH-$LATEST_MS_TAG.exe" 'map(.name) | contains([$suffix])')
HAVE_ARM64_USR=$(echo $VSCODIUM_ASSETS | jq --arg suffix "UserSetup-$VSCODE_ARCH-$LATEST_MS_TAG.exe" 'map(.name) | contains([$suffix])')
HAVE_ARM64_ZIP=$(echo $VSCODIUM_ASSETS | jq --arg suffix "win32-$VSCODE_ARCH-$LATEST_MS_TAG.zip" 'map(.name) | contains([$suffix])')
if [[ "$HAVE_ARM64_SYS" != "true" ]]; then
echo "Building on Windows arm64 because we have no system setup"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_ARM64_USR" != "true" ]]; then
echo "Building on Windows arm64 because we have no user setup"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_ARM64_ZIP" != "true" ]]; then
echo "Building on Windows arm64 because we have no zip"
export SHOULD_BUILD="yes"
fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
echo "Already have all the Windows arm64 builds"
fi
elif [[ $VSCODE_ARCH == "ia32" ]]; then
HAVE_IA32_SYS=$(echo $VSCODIUM_ASSETS | jq --arg suffix "$VSCODE_ARCH-$LATEST_MS_TAG.exe" 'map(.name) | contains([$suffix])')
HAVE_IA32_USR=$(echo $VSCODIUM_ASSETS | jq --arg suffix "UserSetup-$VSCODE_ARCH-$LATEST_MS_TAG.exe" 'map(.name) | contains([$suffix])')
HAVE_IA32_ZIP=$(echo $VSCODIUM_ASSETS | jq --arg suffix "win32-$VSCODE_ARCH-$LATEST_MS_TAG.zip" 'map(.name) | contains([$suffix])')
if [[ "$HAVE_IA32_SYS" != "true" ]]; then
echo "Building on Windows ia32 because we have no system setup"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_IA32_USR" != "true" ]]; then
echo "Building on Windows ia32 because we have no user setup"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_IA32_ZIP" != "true" ]]; then
echo "Building on Windows ia32 because we have no zip"
export SHOULD_BUILD="yes"
fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
echo "Already have all the Windows ia32 builds"
fi
else # Windows x64
HAVE_X64_SYS=$(echo $VSCODIUM_ASSETS | jq --arg suffix "$VSCODE_ARCH-$LATEST_MS_TAG.exe" 'map(.name) | contains([$suffix])')
HAVE_X64_USR=$(echo $VSCODIUM_ASSETS | jq --arg suffix "UserSetup-$VSCODE_ARCH-$LATEST_MS_TAG.exe" 'map(.name) | contains([$suffix])')
HAVE_X64_ZIP=$(echo $VSCODIUM_ASSETS | jq --arg suffix "win32-$VSCODE_ARCH-$LATEST_MS_TAG.zip" 'map(.name) | contains([$suffix])')
if [[ "$HAVE_X64_SYS" != "true" ]]; then
echo "Building on Windows x64 because we have no system setup"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_X64_USR" != "true" ]]; then
echo "Building on Windows x64 because we have no user setup"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_X64_ZIP" != "true" ]]; then
echo "Building on Windows x64 because we have no zip"
export SHOULD_BUILD="yes"
fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
echo "Already have all the Windows x64 builds"
fi
fi
if [[ "$HAVE_ARM64_TAR" != "true" ]]; then
echo "Building on Linux arm64 because we have no TAR"
export SHOULD_BUILD="yes"
fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
echo "Already have all the Linux arm64 builds"
fi
elif [[ $VSCODE_ARCH == "armhf" ]]; then
HAVE_ARM_DEB=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["armhf.deb"])')
HAVE_ARM_TAR=$(echo $VSCODIUM_ASSETS | jq --arg suffix "armhf-$LATEST_MS_TAG.tar.gz" 'map(.name) | contains([$suffix])')
if [[ "$HAVE_ARM_DEB" != "true" ]]; then
echo "Building on Linux arm because we have no DEB"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_ARM_TAR" != "true" ]]; then
echo "Building on Linux arm because we have no TAR"
export SHOULD_BUILD="yes"
fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
echo "Already have all the Linux arm builds"
fi
else
HAVE_64_RPM=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["x86_64.rpm"])')
HAVE_64_DEB=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["amd64.deb"])')
HAVE_64_TAR=$(echo $VSCODIUM_ASSETS | jq --arg suffix "x64-$LATEST_MS_TAG.tar.gz" 'map(.name) | contains([$suffix])')
if [[ "$HAVE_64_RPM" != "true" ]]; then
echo "Building on Linux x64 because we have no RPM"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_64_DEB" != "true" ]]; then
echo "Building on Linux x64 because we have no DEB"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_64_TAR" != "true" ]]; then
echo "Building on Linux x64 because we have no TAR"
export SHOULD_BUILD="yes"
fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
echo "Already have all the Linux x64 builds"
elif [[ "$OS_NAME" == "linux" ]]; then
if [[ $VSCODE_ARCH == "arm64" ]]; then
HAVE_ARM64_DEB=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["arm64.deb"])')
HAVE_ARM64_TAR=$(echo $VSCODIUM_ASSETS | jq --arg suffix "arm64-$LATEST_MS_TAG.tar.gz" 'map(.name) | contains([$suffix])')
if [[ "$HAVE_ARM64_DEB" != "true" ]]; then
echo "Building on Linux arm64 because we have no DEB"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_ARM64_TAR" != "true" ]]; then
echo "Building on Linux arm64 because we have no TAR"
export SHOULD_BUILD="yes"
fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
echo "Already have all the Linux arm64 builds"
fi
elif [[ $VSCODE_ARCH == "armhf" ]]; then
HAVE_ARM_DEB=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["armhf.deb"])')
HAVE_ARM_TAR=$(echo $VSCODIUM_ASSETS | jq --arg suffix "armhf-$LATEST_MS_TAG.tar.gz" 'map(.name) | contains([$suffix])')
if [[ "$HAVE_ARM_DEB" != "true" ]]; then
echo "Building on Linux arm because we have no DEB"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_ARM_TAR" != "true" ]]; then
echo "Building on Linux arm because we have no TAR"
export SHOULD_BUILD="yes"
fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
echo "Already have all the Linux arm builds"
fi
else # Linux x64
HAVE_64_RPM=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["x86_64.rpm"])')
HAVE_64_DEB=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["amd64.deb"])')
HAVE_64_TAR=$(echo $VSCODIUM_ASSETS | jq --arg suffix "x64-$LATEST_MS_TAG.tar.gz" 'map(.name) | contains([$suffix])')
if [[ "$HAVE_64_RPM" != "true" ]]; then
echo "Building on Linux x64 because we have no RPM"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_64_DEB" != "true" ]]; then
echo "Building on Linux x64 because we have no DEB"
export SHOULD_BUILD="yes"
fi
if [[ "$HAVE_64_TAR" != "true" ]]; then
echo "Building on Linux x64 because we have no TAR"
export SHOULD_BUILD="yes"
fi
if [[ "$SHOULD_BUILD" != "yes" ]]; then
echo "Already have all the Linux x64 builds"
fi
fi
fi
else

View File

@ -9,8 +9,6 @@ echo "Got the latest MS tag: ${LATEST_MS_TAG}"
git clone https://github.com/Microsoft/vscode.git --branch $LATEST_MS_TAG --depth 1
# for GH actions
if [[ "$CI_WINDOWS" != "True" ]]; then
echo "LATEST_MS_COMMIT=$LATEST_MS_COMMIT" >> $GITHUB_ENV
echo "LATEST_MS_TAG=$LATEST_MS_TAG" >> $GITHUB_ENV
fi
echo "LATEST_MS_COMMIT=$LATEST_MS_COMMIT" >> $GITHUB_ENV
echo "LATEST_MS_TAG=$LATEST_MS_TAG" >> $GITHUB_ENV

View File

@ -2,11 +2,6 @@
set -e
if [[ "$CI_WINDOWS" == "True" ]]; then
export npm_config_arch="$BUILDARCH"
export npm_config_target_arch="$BUILDARCH"
fi
cp -rp src/* vscode/
cd vscode || exit

13
sum.sh
View File

@ -1,20 +1,9 @@
#!/bin/bash
# shasum blows up in Azure, so using this
# node package which has similar syntax and identical output
if [[ "$CI_WINDOWS" == "True" ]]; then
npm i -g checksum
fi
sum_file () {
if [[ -f "$1" ]]; then
if [[ "$CI_WINDOWS" == "True" ]]; then
checksum -a sha256 "$1" > "$1".sha256
checksum -a sha1 "$1" > "$1".sha1
else
shasum -a 256 "$1" > "$1".sha256
shasum "$1" > "$1".sha1
fi
fi
}
@ -22,7 +11,7 @@ if [[ "$SHOULD_BUILD" == "yes" ]]; then
if [[ "$OS_NAME" == "osx" ]]; then
sum_file VSCodium-darwin-*.zip
sum_file VSCodium*.dmg
elif [[ "$CI_WINDOWS" == "True" ]]; then
elif [[ "$OS_NAME" == "windows" ]]; then
sum_file VSCodiumSetup-*.exe
sum_file VSCodiumUserSetup-*.exe
sum_file VSCodium-win32-*.zip

View File

@ -27,14 +27,8 @@ fi
URL_BASE=https://github.com/VSCodium/vscodium/releases/download/${LATEST_MS_TAG}
# to make testing on forks easier
if [[ "$CI_WINDOWS" == "True" ]]; then
# BUILD_REPOSITORY_URI = e.g. https://github.com/VSCodium/vscodium
VERSIONS_REPO=$(echo ${BUILD_REPOSITORY_URI} | awk -F"/" '{ print $4 }')/versions
git config --global core.autocrlf true
else
VERSIONS_REPO="${GITHUB_USERNAME}/versions"
fi
VERSIONS_REPO="${GITHUB_USERNAME}/versions"
echo "Versions repo:" $VERSIONS_REPO
# generateJson <assetName>
# e.g. generateJson VSCodium-darwin-1.33.0.zip
@ -103,22 +97,22 @@ if [[ "$OS_NAME" == "osx" ]]; then
VERSION_PATH="darwin/${VSCODE_ARCH}"
JSON="$(generateJson ${ASSET_NAME})"
updateLatestVersion "$VERSION_PATH" "$JSON"
elif [[ "$CI_WINDOWS" == "True" ]]; then
elif [[ "$OS_NAME" == "windows" ]]; then
# system installer
ASSET_NAME=VSCodiumSetup-${BUILDARCH}-${LATEST_MS_TAG}.exe
VERSION_PATH="win32/${BUILDARCH}/system"
ASSET_NAME=VSCodiumSetup-${VSCODE_ARCH}-${LATEST_MS_TAG}.exe
VERSION_PATH="win32/${VSCODE_ARCH}/system"
JSON="$(generateJson ${ASSET_NAME})"
updateLatestVersion "$VERSION_PATH" "$JSON"
# user installer
ASSET_NAME=VSCodiumUserSetup-${BUILDARCH}-${LATEST_MS_TAG}.exe
VERSION_PATH="win32/${BUILDARCH}/user"
ASSET_NAME=VSCodiumUserSetup-${VSCODE_ARCH}-${LATEST_MS_TAG}.exe
VERSION_PATH="win32/${VSCODE_ARCH}/user"
JSON="$(generateJson ${ASSET_NAME})"
updateLatestVersion "$VERSION_PATH" "$JSON"
# windows archive
ASSET_NAME=VSCodium-win32-${BUILDARCH}-${LATEST_MS_TAG}.zip
VERSION_PATH="win32/${BUILDARCH}/archive"
ASSET_NAME=VSCodium-win32-${VSCODE_ARCH}-${LATEST_MS_TAG}.zip
VERSION_PATH="win32/${VSCODE_ARCH}/archive"
JSON="$(generateJson ${ASSET_NAME})"
updateLatestVersion "$VERSION_PATH" "$JSON"
else # linux

View File

@ -1,61 +0,0 @@
steps:
- task: NodeTool@0
inputs:
versionSpec: "12.14.1"
- task: UsePythonVersion@0
displayName: 'Use Python 2.x'
inputs:
versionSpec: 2.x
- task: ShellScript@2
displayName: 'get VSCode sources'
inputs:
scriptPath: get_repo.sh
- powershell: |
$LATEST_MS_COMMIT="$(git -C vscode rev-list --tags --max-count=1)"
$LATEST_MS_TAG="$(git -C vscode describe --tags)"
Write-Host "##vso[task.setvariable variable=LATEST_MS_TAG]$LATEST_MS_TAG"
Write-Host "##vso[task.setvariable variable=LATEST_MS_COMMIT]$LATEST_MS_COMMIT"
Write-Host "##vso[task.setvariable variable=BUILD_SOURCEVERSION]$LATEST_MS_COMMIT"
displayName: 'set env LATEST_MS_TAG, LATEST_MS_COMMIT'
- task: PowerShell@2
inputs:
filePath: 'check_tags.ps1'
env:
MAPPED_GITHUB_TOKEN: $(GITHUB_TOKEN)
- powershell: |
bash ./build.sh
displayName: 'go build it!'
- bash: |
if [[ "$SHOULD_BUILD" == "yes" ]]; then mv vscode\\.build\\win32-$(BUILDARCH)\\system-setup\\VSCodeSetup.exe VSCodiumSetup-$(BUILDARCH)-${LATEST_MS_TAG}.exe; fi
displayName: 'move the system setup'
- bash: |
if [[ "$SHOULD_BUILD" == "yes" ]]; then mv vscode\\.build\\win32-$(BUILDARCH)\\user-setup\\VSCodeSetup.exe VSCodiumUserSetup-$(BUILDARCH)-${LATEST_MS_TAG}.exe; fi
displayName: 'move the user setup'
- bash: |
if [[ "$SHOULD_BUILD" == "yes" ]]; then mv vscode\\.build\\win32-$(BUILDARCH)\\archive\\VSCode-win32-$(BUILDARCH).zip VSCodium-win32-$(BUILDARCH)-${LATEST_MS_TAG}.zip; fi
displayName: 'move the zip folder'
- powershell: |
bash ./sum.sh
condition: eq(variables['SHOULD_BUILD'], 'yes')
displayName: 'compute sums'
- task: CopyFiles@2
inputs:
contents: |
VSCodium*.zip
VSCodiumUserSetup*.exe
VSCodiumSetup*.exe
*.sha256
targetFolder: $(Build.ArtifactStagingDirectory)
condition: eq(variables['SHOULD_BUILD'], 'yes')
displayName: 'copy artifacts to staging directory'
- task: PublishBuildArtifacts@1
displayName: 'Publish artifacts'
condition: eq(variables['SHOULD_BUILD'], 'yes')
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)
ArtifactName: 'everything'
- bash: ./update_version.sh
displayName: 'update version json'
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
GITHUB_USERNAME: $(GITHUB_USERNAME)