Skip to content

Commit

Permalink
Merge pull request #666 from daiyam/fix-build
Browse files Browse the repository at this point in the history
  • Loading branch information
stripedpajamas authored Mar 11, 2021
2 parents 6979e52 + 6c87e3a commit 88f37a1
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 24 deletions.
30 changes: 26 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,35 @@ jobs:
- name: Install Yarn
run: npm install -g yarn

- name: Check PR or cron
run: ./check_cron_or_pr.sh

- name: Clone VSCode repo
run: ./get_repo.sh

- name: Check existing VSCodium tags/releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./check_tags.sh
if: env.SHOULD_DEPLOY == 'yes'

- name: Compute cache key
id: yarnCacheKey
run: echo "::set-output name=value::$(node build/azure-pipelines/computeYarnCacheKey.js)"
if: env.SHOULD_BUILD == 'yes'

- name: Get yarn cache directory path
id: yarnCacheDirPath
run: echo "::set-output name=dir::$(yarn cache dir)"
if: env.SHOULD_BUILD == 'yes'

- name: Cache yarn directory
uses: actions/cache@v2
with:
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
key: linux-${{ matrix.npm_arch }}-yarnCacheDir-${{ steps.yarnCacheKey.outputs.value }}
restore-keys: linux-${{ matrix.npm_arch }}-yarnCacheDir-
if: env.SHOULD_BUILD == 'yes'

- name: Build
env:
Expand All @@ -61,15 +83,15 @@ jobs:
run: |
cd VSCode-linux-${VSCODE_ARCH}
tar czf ../VSCodium-linux-${VSCODE_ARCH}-${LATEST_MS_TAG}.tar.gz .
if: env.SHOULD_BUILD == 'yes'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'

- name: Generate shasums
run: ./sum.sh
if: env.SHOULD_BUILD == 'yes'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'

- name: Release
uses: softprops/action-gh-release@v1
if: env.SHOULD_BUILD == 'yes'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
with:
tag_name: ${{ env.LATEST_MS_TAG }}
files: |
Expand All @@ -84,7 +106,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update versions repo
if: env.SHOULD_BUILD == 'yes'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
run: ./update_version.sh
env:
GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}
Expand Down
37 changes: 30 additions & 7 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
with:
node-version: 12.14.1

- name: Check PR or cron
run: |
. check_cron_or_pr.sh
- name: Clone VSCode repo
run: |
. get_repo.sh
Expand All @@ -30,7 +34,26 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
. check_tags.sh
if: env.SHOULD_DEPLOY == 'yes'

- name: Compute cache key
id: yarnCacheKey
run: echo "::set-output name=value::$(node build/azure-pipelines/computeYarnCacheKey.js)"
if: env.SHOULD_BUILD == 'yes'

- name: Get yarn cache directory path
id: yarnCacheDirPath
run: echo "::set-output name=dir::$(yarn cache dir)"
if: env.SHOULD_BUILD == 'yes'

- name: Cache yarn directory
uses: actions/cache@v2
with:
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
key: ${{ env.OS_NAME }}-${{ env.VSCODE_ARCH }}-yarnCacheDir-${{ steps.yarnCacheKey.outputs.value }}
restore-keys: ${{ env.OS_NAME }}-${{ env.VSCODE_ARCH }}-yarnCacheDir-
if: env.SHOULD_BUILD == 'yes'

- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -42,7 +65,7 @@ jobs:
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'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
run: |
if [ -d "VSCode-darwin-${VSCODE_ARCH}" ]; then # just in case the build failed
cd "VSCode-darwin-${VSCODE_ARCH}"
Expand All @@ -61,23 +84,23 @@ jobs:
run: |
cd "VSCode-darwin-${VSCODE_ARCH}"
zip -r -X -y ../VSCodium-darwin-${VSCODE_ARCH}-${LATEST_MS_TAG}.zip ./*.app
if: env.SHOULD_BUILD == 'yes'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'

- name: DMG the release
run: |
pushd "VSCode-darwin-${VSCODE_ARCH}"
npx create-dmg VSCodium.app ..
mv "../VSCodium ${LATEST_MS_TAG}.dmg" "../VSCodium.${VSCODE_ARCH}.${LATEST_MS_TAG}.dmg"
popd
if: env.SHOULD_BUILD == 'yes'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'

- name: Generate shasums
run: ./sum.sh
if: env.SHOULD_BUILD == 'yes'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'

- name: Release
uses: softprops/action-gh-release@v1
if: env.SHOULD_BUILD == 'yes'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
with:
tag_name: ${{ env.LATEST_MS_TAG }}
files: |
Expand All @@ -88,7 +111,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update versions repo
if: env.SHOULD_BUILD == 'yes'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
run: ./update_version.sh
env:
GITHUB_TOKEN: ${{ secrets.STRONGER_GITHUB_TOKEN }}
Expand Down
31 changes: 27 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ jobs:
with:
python-version: '2.x'

- name: Check PR or cron
run: ./check_cron_or_pr.sh
shell: bash

- name: Clone VSCode repo
run: ./get_repo.sh
shell: bash
Expand All @@ -43,6 +47,25 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./check_tags.sh
shell: bash
if: env.SHOULD_DEPLOY == 'yes'

- name: Compute cache key
id: yarnCacheKey
run: echo "::set-output name=value::$(node build/azure-pipelines/computeYarnCacheKey.js)"
if: env.SHOULD_BUILD == 'yes'

- name: Get yarn cache directory path
id: yarnCacheDirPath
run: echo "::set-output name=dir::$(yarn cache dir)"
if: env.SHOULD_BUILD == 'yes'

- name: Cache yarn directory
uses: actions/cache@v2
with:
path: ${{ steps.yarnCacheDirPath.outputs.dir }}
key: ${{ env.OS_NAME }}-${{ env.VSCODE_ARCH }}-yarnCacheDir-${{ steps.yarnCacheKey.outputs.value }}
restore-keys: ${{ env.OS_NAME }}-${{ env.VSCODE_ARCH }}-yarnCacheDir-
if: env.SHOULD_BUILD == 'yes'

- name: Build
env:
Expand All @@ -59,16 +82,16 @@ jobs:
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'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'

- name: Generate shasums
run: ./sum.sh
shell: bash
if: env.SHOULD_BUILD == 'yes'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'

- name: Release
uses: softprops/action-gh-release@v1
if: env.SHOULD_BUILD == 'yes'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
with:
tag_name: ${{ env.LATEST_MS_TAG }}
files: |
Expand All @@ -80,7 +103,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update versions repo
if: env.SHOULD_BUILD == 'yes'
if: env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
run: ./update_version.sh
shell: bash
env:
Expand Down
24 changes: 24 additions & 0 deletions build/azure-pipelines/computeYarnCacheKey.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const fs = require("fs");
const crypto = require("crypto");
const path = require("path");
const { dirs } = require('../../vscode/build/npm/dirs');

const ROOT = path.join(__dirname, '../../vscode');

const shasum = crypto.createHash('sha1');

shasum.update(fs.readFileSync(path.join(ROOT, '.yarnrc')));
shasum.update(fs.readFileSync(path.join(ROOT, 'remote/.yarnrc')));

// Add `yarn.lock` files
for (let dir of dirs) {
const yarnLockPath = path.join(ROOT, dir, 'yarn.lock');
shasum.update(fs.readFileSync(yarnLockPath));
}

// Add any other command line arguments
for (let i = 2; i < process.argv.length; i++) {
shasum.update(process.argv[i]);
}

process.stdout.write(shasum.digest('hex'));
8 changes: 8 additions & 0 deletions build/build_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

rm -rf VSCode*
rm -rf vscode

./get_repo.sh

SHOULD_BUILD=yes CI_BUILD=no OS_NAME=linux VSCODE_ARCH=x64 ./build.sh
8 changes: 8 additions & 0 deletions build/build_macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

rm -rf VSCode*
rm -rf vscode

. get_repo.sh

SHOULD_BUILD=yes CI_BUILD=no OS_NAME=osx VSCODE_ARCH=x64 . build.sh
15 changes: 15 additions & 0 deletions build/build_windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# powershell -ExecutionPolicy ByPass -File build_windows.ps1

$env:Path += ";C:\Program Files\Git\bin"

Remove-Item -Recurse -Force VSCode*
Remove-Item -Recurse -Force vscode

bash ./get_repo.sh

$Env:SHOULD_BUILD = 'yes'
$Env:CI_BUILD = 'no'
$Env:OS_NAME = 'windows'
$Env:VSCODE_ARCH = 'x64'

bash ./build.sh
19 changes: 19 additions & 0 deletions check_cron_or_pr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e

if [[ $github.event.number ]]; then
echo "It's a PR"

export SHOULD_BUILD="yes"
export SHOULD_DEPLOY="no"
else
echo "It's a cron"

export SHOULD_DEPLOY="yes"
fi

if [[ $GITHUB_ENV ]]; then
echo "SHOULD_BUILD=$SHOULD_BUILD" >> $GITHUB_ENV
echo "SHOULD_DEPLOY=$SHOULD_DEPLOY" >> $GITHUB_ENV
fi
7 changes: 4 additions & 3 deletions get_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ 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
echo "LATEST_MS_COMMIT=$LATEST_MS_COMMIT" >> $GITHUB_ENV
echo "LATEST_MS_TAG=$LATEST_MS_TAG" >> $GITHUB_ENV

if [[ $GITHUB_ENV ]]; then
echo "LATEST_MS_COMMIT=$LATEST_MS_COMMIT" >> $GITHUB_ENV
echo "LATEST_MS_TAG=$LATEST_MS_TAG" >> $GITHUB_ENV
fi
2 changes: 1 addition & 1 deletion patches/fix-rpm-spec.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
/usr/share/bash-completion/completions/@@NAME@@
/usr/share/zsh/site-functions/_@@NAME@@
+
++%config(noreplace) /usr/share/@@NAME@@/resources/app/product.json
+%config(noreplace) /usr/share/@@NAME@@/resources/app/product.json
6 changes: 1 addition & 5 deletions patches/update-cache-path.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
--- vscode/src/vs/platform/update/electron-main/updateService.win32.ts 2021-02-05 11:59:17.564060663 -0600
+++ src/src/vs/platform/update/electron-main/updateService.win32.ts 2021-02-05 11:59:39.780745778 -0600
@@ -55,7 +55,7 @@

@@ -56,3 +56,3 @@
@memoize
get cachePath(): Promise<string> {
- const result = path.join(tmpdir(), `vscode-update-${product.target}-${process.arch}`);
+ const result = path.join(tmpdir(), `vscodium-update-${product.target}-${process.arch}`);
return pfs.mkdirp(result).then(() => result);
}

0 comments on commit 88f37a1

Please sign in to comment.