diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 5d6ea26..3b18e25 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -42,6 +42,9 @@ 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 @@ -49,6 +52,25 @@ jobs: 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: @@ -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: | @@ -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 }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 5188243..fed6689 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -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 @@ -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 }} @@ -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}" @@ -61,7 +84,7 @@ 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: | @@ -69,15 +92,15 @@ jobs: 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: | @@ -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 }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 7fa75df..9f62d46 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -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 @@ -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: @@ -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: | @@ -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: diff --git a/build/azure-pipelines/computeYarnCacheKey.js b/build/azure-pipelines/computeYarnCacheKey.js new file mode 100644 index 0000000..7397d45 --- /dev/null +++ b/build/azure-pipelines/computeYarnCacheKey.js @@ -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')); diff --git a/build/build_linux.sh b/build/build_linux.sh new file mode 100755 index 0000000..e9a58cf --- /dev/null +++ b/build/build_linux.sh @@ -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 diff --git a/build/build_macos.sh b/build/build_macos.sh new file mode 100755 index 0000000..f460524 --- /dev/null +++ b/build/build_macos.sh @@ -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 diff --git a/build/build_windows.ps1 b/build/build_windows.ps1 new file mode 100755 index 0000000..f051bf1 --- /dev/null +++ b/build/build_windows.ps1 @@ -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 diff --git a/check_cron_or_pr.sh b/check_cron_or_pr.sh new file mode 100755 index 0000000..14104df --- /dev/null +++ b/check_cron_or_pr.sh @@ -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 \ No newline at end of file diff --git a/get_repo.sh b/get_repo.sh index 8651058..301efdf 100755 --- a/get_repo.sh +++ b/get_repo.sh @@ -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 diff --git a/patches/fix-rpm-spec.patch b/patches/fix-rpm-spec.patch index 27747ce..c0f2135 100644 --- a/patches/fix-rpm-spec.patch +++ b/patches/fix-rpm-spec.patch @@ -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 diff --git a/patches/update-cache-path.patch b/patches/update-cache-path.patch index da006cc..096a38f 100644 --- a/patches/update-cache-path.patch +++ b/patches/update-cache-path.patch @@ -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); - } -