(experiment) cleanup and move linux builds to GHA

This commit is contained in:
Peter Squicciarini 2020-09-20 14:26:06 -07:00
parent 82fb8829fe
commit b4e9c1dcb6
No known key found for this signature in database
GPG key ID: B93D26A09E953403
15 changed files with 163 additions and 174 deletions

120
.github/workflows/linux.yml vendored Normal file
View file

@ -0,0 +1,120 @@
name: CI
on:
push:
pull_request:
branches: [ master ]
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x64, arm64, arm]
env:
OS_NAME: 'linux'
BUILDARCH: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v1.4.3
with:
node-version: 12.14.1
- name: Clone VSCode repo
run: |
. get_repo.sh
echo "::set-env name=LATEST_MS_TAG::$LATEST_MS_TAG"
echo "::set-env name=LATEST_MS_COMMIT::$LATEST_MS_COMMIT"
- name: Check existing VSCodium tags/releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
. check_tags.sh
echo "::set-env name=SHOULD_BUILD::$SHOULD_BUILD"
- name: Install build deps
run: |
triplet=
case $BUILDARCH in
arm)
arch=armhf
triplet=arm-linux-gnueabihf
;;
arm64)
arch=arm64
triplet=aarch64-linux-gnu
;;
esac
if [[ -n "$triplet" ]]; then
sed 's/^deb /deb [arch=amd64] '/g -i /etc/apt/sources.list
echo "deb [arch=$arch] http://ports.ubuntu.com/ubuntu-ports/ trusty main" | sudo tee -a /etc/apt/sources.list.d/$arch.list >/dev/null
sudo dpkg --add-architecture $arch
sudo apt-get update
sudo apt-get install libc6-dev-$arch-cross gcc-$triplet g++-$triplet `apt-cache search x11proto | grep ^x11proto | cut -f 1 -d ' '` xz-utils pkg-config
mkdir -p dl
pushd dl
apt-get download libx11-dev:$arch libx11-6:$arch libxkbfile-dev:$arch libxkbfile1:$arch libxau-dev:$arch libxdmcp-dev:$arch libxcb1-dev:$arch libsecret-1-dev:$arch libsecret-1-0:$arch libpthread-stubs0-dev:$arch libglib2.0-dev:$arch libglib2.0-0:$arch libffi-dev:$arch libffi6:$arch zlib1g:$arch libpcre3-dev:$arch libpcre3:$arch
for i in *.deb; do ar x $i; sudo tar -C / -xf data.tar.*; rm -f data.tar.*; done
popd
echo "::set-env name=CC::/usr/bin/$triplet-gcc"
echo "::set-env name=CXX::/usr/bin/$triplet-g++"
echo "::set-env name=CC_host::/usr/bin/gcc"
echo "::set-env name=CXX_host::/usr/bin/g++"
echo "::set-env name=PKG_CONFIG_LIBDIR::/usr/lib/$triplet/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig"
export CC=/usr/bin/$triplet-gcc
export CXX=/usr/bin/$triplet-g++
export CC_host=/usr/bin/gcc
export CXX_host=/usr/bin/g++
export PKG_CONFIG_LIBDIR=/usr/lib/$triplet/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
else
sudo apt-get update
sudo apt-get install libx11-dev
fi
if: env.SHOULD_BUILD == 'yes'
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm_config_arch: ${{ matrix.arch }}
npm_config_target_arch: ${{ matrix.arch }}
run: ./build.sh
if: env.SHOULD_BUILD == 'yes'
- name: Zip release
run: |
cd VSCode-linux-${BUILDARCH}
tar czf ../VSCodium-linux-${BUILDARCH}-${LATEST_MS_TAG}.tar.gz .
if: env.SHOULD_BUILD == 'yes'
- name: Generate shasums
run: ./sum.sh
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
./*.zip
./*.tar.gz
./*.deb
./*.rpm
./*.AppImage
./*.AppImage.zsync
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update versions repo
if: env.SHOULD_BUILD == 'yes'
run: ./update_version.sh
env:
GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.repository_owner }}

View file

@ -1,4 +1,4 @@
name: CI
name: macos_build
on:
push:
@ -9,7 +9,7 @@ jobs:
build:
runs-on: macOS-latest
env:
TRAVIS_OS_NAME: "osx"
OS_NAME: "osx"
steps:
- uses: actions/checkout@v2
@ -35,22 +35,45 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./build.sh
if: env.SHOULD_BUILD == 'yes'
- name: Sign binary
run: ./sign_mac_app.sh
env:
CERTIFICATE_OSX_P12: ${{ secrets.CERTIFICATE_OSX_P12 }}
CERTIFICATE_OSX_PASSWORD: ${{ secrets.CERTIFICATE_OSX_PASSWORD }}
CERTIFICATE_OSX_ID: ${{ secrets.CERTIFICATE_OSX_ID }}
if: env.SHOULD_BUILD == 'yes'
run: |
if [ -d "VSCode-darwin" ]; then # just in case the build failed
cd VSCode-darwin
export CERTIFICATE_P12=VSCodium.p12
echo $CERTIFICATE_OSX_P12 | base64 --decode > $CERTIFICATE_P12
export KEYCHAIN=build.keychain
security create-keychain -p mysecretpassword $KEYCHAIN
security default-keychain -s $KEYCHAIN
security unlock-keychain -p mysecretpassword $KEYCHAIN
security import $CERTIFICATE_P12 -k $KEYCHAIN -P $CERTIFICATE_OSX_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k mysecretpassword $KEYCHAIN
codesign --deep --force --verbose --sign "$CERTIFICATE_OSX_ID" VSCodium.app
fi
- name: Zip release
run: ./create_zip.sh
run: |
cd VSCode-darwin
zip -r -X -y ../VSCodium-darwin-${LATEST_MS_TAG}.zip ./*.app
if: env.SHOULD_BUILD == 'yes'
- name: DMG the release
run: ./create_dmg.sh
run: |
pushd VSCode-darwin
npx create-dmg VSCodium.app ..
mv "../VSCodium ${LATEST_MS_TAG}.dmg" "../VSCodium.${LATEST_MS_TAG}.dmg"
popd
if: env.SHOULD_BUILD == 'yes'
- name: Generate shasums
run: ./sum.sh
if: env.SHOULD_BUILD == 'yes'
- name: Release
uses: softprops/action-gh-release@v1

View file

@ -1,50 +0,0 @@
jobs:
include:
- os: linux
env: BUILDARCH=x64
dist: trusty
- os: linux
env: BUILDARCH=arm64
dist: trusty
- os: linux
env: BUILDARCH=arm
dist: trusty
language: node_js
node_js: "12.14.1"
install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
- . install_deps.sh
- . get_repo.sh
- . check_tags.sh
script:
- ./build.sh
before_deploy:
- ./create_zip.sh
- ./sum.sh
deploy:
provider: releases
skip_cleanup: true
overwrite: true
name: $LATEST_MS_TAG
token: $GITHUB_TOKEN
file_glob: true
file:
- ./*.sha256
- ./*.zip
- ./*.tar.gz
- ./*.deb
- ./*.rpm
- ./*.AppImage
- ./*.AppImage.zsync
on:
all_branches: true
condition: $SHOULD_BUILD = yes
after_deploy:
- ./update_version.sh

View file

@ -9,7 +9,6 @@
[![current release](https://img.shields.io/github/release/vscodium/vscodium.svg)](https://github.com/vscodium/vscodium/releases)
[![windows_build_status](https://dev.azure.com/vscodium/VSCodium/_apis/build/status/VSCodium.vscodium?branchName=master)](https://dev.azure.com/vscodium/VSCodium/_build?definitionId=1)
[![build status](https://travis-ci.com/VSCodium/vscodium.svg?branch=master)](https://travis-ci.com/VSCodium/vscodium)
[![license](https://img.shields.io/github/license/VSCodium/vscodium.svg)](https://github.com/VSCodium/vscodium/blob/master/LICENSE)
[![Gitter](https://img.shields.io/gitter/room/vscodium/vscodium.svg)](https://gitter.im/VSCodium/Lobby)
[![codium](https://snapcraft.io//codium/badge.svg)](https://snapcraft.io/codium)
@ -119,9 +118,9 @@ According to the VS Code Marketplace [Terms of Use](https://aka.ms/vsmarketplace
Please note that some Visual Studio Code extensions have licenses that restrict their use to the official Visual Studio Code builds and therefore do not work with VSCodium. See [this note](https://github.com/VSCodium/vscodium/blob/master/DOCS.md#proprietary-debugging-tools) on the Docs page for what's been found so far and possible workarounds.
### How are the VSCodium binaries built?
If you would like to see the commands we run to build `vscode` into VSCodium binaries, have a look at the [`.travis.yml` file](https://github.com/VSCodium/vscodium/blob/master/.travis.yml) (for Linux and OS X builds) and the [`win32-build.yml` file](https://github.com/VSCodium/vscodium/blob/master/win32-build.yml) (for Windows builds). These build files call all the other scripts in the repo. If you find something that doesn't make sense, feel free to ask about it [on Gitter](https://gitter.im/VSCodium/Lobby).
If you would like to see the commands we run to build `vscode` into VSCodium binaries, have a look at the workflow files in `.github/workflow` (for Linux and OS X builds) and the `win32-build.yml` file (for Windows builds). These build files call all the other scripts in the repo. If you find something that doesn't make sense, feel free to ask about it [on Gitter](https://gitter.im/VSCodium/Lobby).
The builds are run every day, but exit early if there isn't a new release from Microsoft. To examine the build logs, go [here for Linux / OS X](https://travis-ci.com/VSCodium/vscodium) and [here for Windows](https://dev.azure.com/vscodium/VSCodium/_build?definitionId=1)
The builds are run every day, but exit early if there isn't a new release from Microsoft.
## <a id="supported-os"></a>Supported OS
- [x] OS X (`zip`, `dmg`)

View file

@ -9,7 +9,7 @@ if [[ "$SHOULD_BUILD" == "yes" ]]; then
echo "LATEST_MS_COMMIT: ${LATEST_MS_COMMIT}"
echo "BUILD_SOURCEVERSION: ${BUILD_SOURCEVERSION}"
if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then
if [[ "$OS_NAME" != "osx" ]]; then
export npm_config_arch="$BUILDARCH"
export npm_config_target_arch="$BUILDARCH"
fi
@ -25,7 +25,7 @@ if [[ "$SHOULD_BUILD" == "yes" ]]; then
yarn gulp compile-extensions-build
yarn gulp minify-vscode
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
if [[ "$OS_NAME" == "osx" ]]; then
yarn gulp vscode-darwin-min-ci
elif [[ "$CI_WINDOWS" == "True" ]]; then
cp LICENSE.txt LICENSE.rtf # windows build expects rtf license

View file

@ -2,31 +2,22 @@
set -e
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
REPOSITORY=$GITHUB_REPOSITORY
else
REPOSITORY=${TRAVIS_REPO_SLUG:-"VSCodium/vscodium"}
fi
REPOSITORY=${GITHUB_REPOSITORY:-"VSCodium/vscodium"}
GITHUB_RESPONSE=$(curl -s -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/$REPOSITORY/releases/tags/$LATEST_MS_TAG)
VSCODIUM_ASSETS=$(echo $GITHUB_RESPONSE | jq '.assets')
# if we just don't have the github token, get out fast
if [ "$GITHUB_TOKEN" != "" ]; then
if [ "$VSCODIUM_ASSETS" != "null" ]; then
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
if [[ "$OS_NAME" == "osx" ]]; then
HAVE_MAC=$(echo $VSCODIUM_ASSETS | jq --arg suffix "darwin-$LATEST_MS_TAG.zip" 'map(.name) | contains([$suffix])')
if [[ "$HAVE_MAC" != "true" ]]; then
echo "Building on Mac because we have no ZIP"
export SHOULD_BUILD="yes"
fi
elif [[ $BUILDARCH == "arm64" ]]; then
# HAVE_ARM64_RPM=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["arm64.rpm"])')
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_RPM" != "true" ]]; then
# echo "Building on Linux arm64 because we have no RPM"
# export SHOULD_BUILD="yes"
# fi
if [[ "$HAVE_ARM64_DEB" != "true" ]]; then
echo "Building on Linux arm64 because we have no DEB"
export SHOULD_BUILD="yes"
@ -76,13 +67,5 @@ if [ "$GITHUB_TOKEN" != "" ]; then
echo "Release assets do not exist at all, continuing build"
export SHOULD_BUILD="yes"
fi
if git rev-parse $LATEST_MS_TAG >/dev/null 2>&1
then
export TRAVIS_TAG=$LATEST_MS_TAG
else
git config --local user.name "Travis CI"
git config --local user.email "builds@travis-ci.com"
git tag $LATEST_MS_TAG
fi
fi

View file

@ -1,11 +0,0 @@
#!/bin/bash
set -x
if [[ "$SHOULD_BUILD" == "yes" ]]; then
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
cd VSCode-darwin
npx create-dmg VSCodium.app ..
mv "../VSCodium ${LATEST_MS_TAG}.dmg" "../VSCodium.${LATEST_MS_TAG}.dmg"
fi
cd ..
fi

View file

@ -1,15 +0,0 @@
#!/bin/bash
set -ex
if [[ "$SHOULD_BUILD" == "yes" ]]; then
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
cd VSCode-darwin
zip -r -X -y ../VSCodium-darwin-${LATEST_MS_TAG}.zip ./*.app
else
cd VSCode-linux-${BUILDARCH}
tar czf ../VSCodium-linux-${BUILDARCH}-${LATEST_MS_TAG}.tar.gz .
fi
cd ..
fi

View file

@ -1,36 +0,0 @@
#!/bin/bash
sudo apt-get update
sudo apt-get install -y fakeroot jq
triplet=
case $BUILDARCH in
arm)
arch=armhf
triplet=arm-linux-gnueabihf
;;
arm64)
arch=arm64
triplet=aarch64-linux-gnu
;;
esac
if [[ -n "$triplet" ]]; then
sed 's/^deb /deb [arch=amd64] '/g -i /etc/apt/sources.list
echo "deb [arch=$arch] http://ports.ubuntu.com/ubuntu-ports/ trusty main" | sudo tee -a /etc/apt/sources.list.d/$arch.list >/dev/null
sudo dpkg --add-architecture $arch
sudo apt-get update
sudo apt-get install libc6-dev-$arch-cross gcc-$triplet g++-$triplet `apt-cache search x11proto | grep ^x11proto | cut -f 1 -d ' '` xz-utils pkg-config
mkdir -p dl
cd dl
apt-get download libx11-dev:$arch libx11-6:$arch libxkbfile-dev:$arch libxkbfile1:$arch libxau-dev:$arch libxdmcp-dev:$arch libxcb1-dev:$arch libsecret-1-dev:$arch libsecret-1-0:$arch libpthread-stubs0-dev:$arch libglib2.0-dev:$arch libglib2.0-0:$arch libffi-dev:$arch libffi6:$arch zlib1g:$arch libpcre3-dev:$arch libpcre3:$arch
for i in *.deb; do ar x $i; sudo tar -C / -xf data.tar.*; rm -f data.tar.*; done
cd ..
export CC=/usr/bin/$triplet-gcc
export CXX=/usr/bin/$triplet-g++
export CC_host=/usr/bin/gcc
export CXX_host=/usr/bin/g++
export PKG_CONFIG_LIBDIR=/usr/lib/$triplet/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
else
sudo apt-get install libx11-dev libxkbfile-dev libsecret-1-dev rpm
fi

View file

@ -2,7 +2,7 @@
set -e
if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then
if [[ "$OS_NAME" != "osx" ]]; then
export npm_config_arch="$BUILDARCH"
export npm_config_target_arch="$BUILDARCH"
fi
@ -15,7 +15,7 @@ cd vscode || exit
# apply patches
patch -u src/vs/platform/update/electron-main/updateService.win32.ts -i ../patches/update-cache-path.patch
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
if [[ "$OS_NAME" == "osx" ]]; then
CHILD_CONCURRENCY=1 yarn --frozen-lockfile --ignore-optional
npm_config_argv='{"original":["--ignore-optional"]}' yarn postinstall
else
@ -68,7 +68,7 @@ cat product.json
../undo_telemetry.sh
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
if [[ "$OS_NAME" == "linux" ]]; then
# microsoft adds their apt repo to sources
# unless the app name is code-oss
# as we are renaming the application to vscodium

View file

@ -1,23 +0,0 @@
#!/bin/bash
# thanks to https://www.jviotti.com/2016/03/16/how-to-code-sign-os-x-electron-apps-in-travis-ci.html
# for the helpful instructions
if [[ "$SHOULD_BUILD" == "yes" ]]; then
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
if [ -d "VSCode-darwin" ]; then # just in case the build failed
cd VSCode-darwin
export CERTIFICATE_P12=VSCodium.p12
echo $CERTIFICATE_OSX_P12 | base64 --decode > $CERTIFICATE_P12
export KEYCHAIN=build.keychain
security create-keychain -p mysecretpassword $KEYCHAIN
security default-keychain -s $KEYCHAIN
security unlock-keychain -p mysecretpassword $KEYCHAIN
security import $CERTIFICATE_P12 -k $KEYCHAIN -P $CERTIFICATE_OSX_PASSWORD -T /usr/bin/codesign
# https://docs.travis-ci.com/user/common-build-problems/
security set-key-partition-list -S apple-tool:,apple: -s -k mysecretpassword $KEYCHAIN
codesign --deep --force --verbose --sign "$CERTIFICATE_OSX_ID" VSCodium.app
fi
fi
fi

2
sum.sh
View file

@ -19,7 +19,7 @@ sum_file () {
}
if [[ "$SHOULD_BUILD" == "yes" ]]; then
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
if [[ "$OS_NAME" == "osx" ]]; then
sum_file VSCodium-darwin-*.zip
sum_file VSCodium*.dmg
elif [[ "$CI_WINDOWS" == "True" ]]; then

View file

@ -3,7 +3,7 @@
TELEMETRY_URLS="(dc\.services\.visualstudio\.com)|(vortex\.data\.microsoft\.com)"
REPLACEMENT="s/$TELEMETRY_URLS/0\.0\.0\.0/g"
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
if [[ "$OS_NAME" == "osx" ]]; then
grep -rl --exclude-dir=.git -E $TELEMETRY_URLS . | xargs sed -i '' -E $REPLACEMENT
else
grep -rl --exclude-dir=.git -E $TELEMETRY_URLS . | xargs sed -i -E $REPLACEMENT

View file

@ -5,7 +5,7 @@ TELEMETRY_CRASH_REPORTER="'telemetry.enableCrashReporter':"
replace () {
echo $1
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
if [[ "$OS_NAME" == "osx" ]]; then
sed -i '' -E "$1" $2
else
sed -i -E "$1" $2

View file

@ -33,8 +33,7 @@ if [[ "$CI_WINDOWS" == "True" ]]; then
git config --global core.autocrlf true
else
# TRAVIS_REPO_SLUG = e.g. VSCodium/vscodium
VERSIONS_REPO=$(echo ${TRAVIS_REPO_SLUG:-${GITHUB_REPOSITORY}} | awk -F"/" '{ print $1 }')/versions
VERSIONS_REPO="${GITHUB_USERNAME}/versions"
fi
# generateJson <assetName>
@ -98,7 +97,7 @@ git remote rm origin
git remote add origin https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${VERSIONS_REPO}.git > /dev/null 2>&1
cd ..
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
if [[ "$OS_NAME" == "osx" ]]; then
# zip, sha1, and sha256 files are all at top level dir
ASSET_NAME=VSCodium-darwin-${LATEST_MS_TAG}.zip
VERSION_PATH="darwin"
@ -137,7 +136,7 @@ cd versions
git pull origin master # in case another build just pushed
git add .
dateAndMonth=`date "+%D %T"`
git commit -m "Travis update: $dateAndMonth (Build $TRAVIS_BUILD_NUMBER)"
git commit -m "CI update: $dateAndMonth (Build $GITHUB_RUN_NUMBER)"
if ! git push origin master --quiet; then
git pull origin master
git push origin master --quiet