From 2ebbcfb33203dda5665c5687fe78b33b1587dd92 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 28 Jul 2022 19:05:59 -0400 Subject: [PATCH] ci: switch to GHA for WOA (#35109) * ci: switch to GHA for WOA Co-authored-by: Shelley Vohr (cherry picked from commit 674596d11e5ad72b6651073619d282fbfea74ae1) --- .github/workflows/electron_woa_testing.yml | 166 +++++++++++++++++++++ appveyor.yml | 2 +- azure-pipelines-arm.yml | 121 --------------- azure-pipelines-woa.yml | 130 ---------------- script/release/ci-release-build.js | 97 +++--------- vsts-arm-test-steps.yml | 110 -------------- vsts-arm32v7.yml | 13 -- vsts-arm64v8.yml | 13 -- 8 files changed, 188 insertions(+), 464 deletions(-) create mode 100644 .github/workflows/electron_woa_testing.yml delete mode 100644 azure-pipelines-arm.yml delete mode 100644 azure-pipelines-woa.yml delete mode 100644 vsts-arm-test-steps.yml delete mode 100644 vsts-arm32v7.yml delete mode 100644 vsts-arm64v8.yml diff --git a/.github/workflows/electron_woa_testing.yml b/.github/workflows/electron_woa_testing.yml new file mode 100644 index 0000000000000..1c20eda0aefb6 --- /dev/null +++ b/.github/workflows/electron_woa_testing.yml @@ -0,0 +1,166 @@ +name: Electron WOA Testing + +on: + push: + branches: '**' + workflow_dispatch: + inputs: + appveyor_job_id: + description: 'Job Id of Appveyor WOA job to test' + type: text + required: true + +jobs: + electron-woa-testing: + + runs-on: [self-hosted, woa] + + permissions: + checks: write + pull-requests: write + + steps: + - uses: LouisBrunner/checks-action@v1.1.1 + if: ${{ github.event_name == 'push' && github.repository == 'electron/electron' }} + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: electron-woa-testing + status: in_progress + - name: Clean Workspace + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + Remove-Item * -Recurse -Force + shell: powershell + - name: Checkout + uses: actions/checkout@v3 + if: ${{ github.event_name == 'workflow_dispatch' }} + with: + path: src\electron + fetch-depth: 0 + - name: Yarn install + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + cd src\electron + node script/yarn.js install --frozen-lockfile + - name: Download and extract dist.zip for test + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + $localArtifactPath = "$pwd\dist.zip" + $serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/dist.zip" + Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" } + & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\Default -y $localArtifactPath + shell: powershell + - name: Download and extract native test executables for test + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + $localArtifactPath = "src\out\Default\shell_browser_ui_unittests.exe" + $serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/shell_browser_ui_unittests.exe" + Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" } + shell: powershell + - name: Download and extract ffmpeg.zip for test + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + $localArtifactPath = "$pwd\ffmpeg.zip" + $serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/ffmpeg.zip" + Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" } + & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -osrc\out\ffmpeg $localArtifactPath + shell: powershell + - name: Download node headers for test + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + $localArtifactPath = "src\node_headers.zip" + $serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/node_headers.zip" + Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" } + cd src + & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y node_headers.zip + shell: powershell + - name: Download electron.lib for test + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + $localArtifactPath = "src\out\Default\electron.lib" + $serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/electron.lib" + Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" } + shell: powershell + # Uncomment the following block if pdb files are needed to debug issues + # - name: Download pdb files for detailed stacktraces + # if: ${{ github.event_name == 'workflow_dispatch' }} + # run: | + # try { + # $localArtifactPath = "src\pdb.zip" + # $serverArtifactPath = "https://ci.appveyor.com/api/buildjobs/${{ inputs.appveyor_job_id }}/artifacts/pdb.zip" + # Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer ${{ secrets.APPVEYOR_TOKEN }}" } + # cd src + # & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y pdb.zip + # } catch { + # Write-Host "There was an exception encountered while downloading pdb files:" $_.Exception.Message + # } finally { + # $global:LASTEXITCODE = 0 + # } + # shell: powershell + - name: Setup node headers + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + New-Item src\out\Default\gen\node_headers\Release -Type directory + Copy-Item -path src\out\Default\electron.lib -destination src\out\Default\gen\node_headers\Release\node.lib + shell: powershell + - name: Run Electron Main process tests + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + cd src + set npm_config_nodedir=%cd%\out\Default\gen\node_headers + set npm_config_arch=arm64 + cd electron + node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion + env: + ELECTRON_ENABLE_STACK_DUMPING: true + ELECTRON_OUT_DIR: Default + IGNORE_YARN_INSTALL_ERROR: 1 + ELECTRON_TEST_RESULTS_DIR: junit + MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap' + MOCHA_REPORTER: mocha-multi-reporters + ELECTRON_SKIP_NATIVE_MODULE_TESTS: true + - name: Run Electron Remote based tests + if: ${{ github.event_name == 'workflow_dispatch' && (success() || failure()) }} + run: | + cd src + set npm_config_nodedir=%cd%\out\Default\gen\node_headers + set npm_config_arch=arm64 + cd electron + node script/yarn test --runners=remote --enable-logging --disable-features=CalculateNativeWinOcclusion + env: + ELECTRON_OUT_DIR: Default + IGNORE_YARN_INSTALL_ERROR: 1 + ELECTRON_TEST_RESULTS_DIR: junit + MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap' + MOCHA_REPORTER: mocha-multi-reporters + ELECTRON_SKIP_NATIVE_MODULE_TESTS: true + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action/composite@v1 + if: ${{ github.event_name == 'workflow_dispatch' && (success() || failure()) }} + with: + files: "src/junit/**/*.xml" + check_name: "electron-woa-testing" + - name: Verify ffmpeg + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + cd src + echo "Verifying non proprietary ffmpeg" + python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg + shell: cmd + - name: Kill processes left running from last test run + if: ${{ github.event_name == 'workflow_dispatch' && (success() || failure()) || cancelled() }} + run: | + Get-Process | Where Name -Like "electron*" | Stop-Process + Get-Process | Where Name -Like "msedge*" | Stop-Process + shell: powershell + - name: Delete user app data directories + if: ${{ github.event_name == 'workflow_dispatch' && (success() || failure()) || cancelled() }} + run: | + Remove-Item -path $env:APPDATA/Electron* -Recurse -Force -ErrorAction Ignore + shell: powershell + - uses: LouisBrunner/checks-action@v1.1.1 + if: ${{ github.event_name == 'workflow_dispatch' && (success() || failure()) || cancelled() }} + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: electron-woa-testing + conclusion: "${{ job.status }}" \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 6a544b9673f48..072e9e8bfa3b6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -233,7 +233,7 @@ deploy_script: & python script\release\uploaders\upload.py --verbose } } elseif (Test-Path Env:\TEST_WOA) { - node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH + node script/release/ci-release-build.js --job=electron-woa-testing --ci=GHA --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH } on_finish: - if exist src\electron\electron.log ( appveyor-retry appveyor PushArtifact src\electron\electron.log ) diff --git a/azure-pipelines-arm.yml b/azure-pipelines-arm.yml deleted file mode 100644 index 868b7753944e2..0000000000000 --- a/azure-pipelines-arm.yml +++ /dev/null @@ -1,121 +0,0 @@ -steps: -- task: CopyFiles@2 - displayName: 'Copy Files to: src/electron' - inputs: - TargetFolder: src/electron - -- bash: | - cd src/electron - node script/yarn.js install --frozen-lockfile - displayName: 'Yarn install' - -- bash: | - export ZIP_DEST=$PWD/src/out/Default - echo "##vso[task.setvariable variable=ZIP_DEST]$ZIP_DEST" - mkdir -p $ZIP_DEST - cd src/electron - node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=dist.zip --dest=$ZIP_DEST - cd $ZIP_DEST - unzip -o dist.zip - xattr -cr Electron.app - displayName: 'Download and unzip dist files for test' - env: - CIRCLE_TOKEN: $(CIRCLECI_TOKEN) - -- bash: | - export FFMPEG_ZIP_DEST=$PWD/src/out/ffmpeg - mkdir -p $FFMPEG_ZIP_DEST - cd src/electron - node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=ffmpeg.zip --dest=$FFMPEG_ZIP_DEST - cd $FFMPEG_ZIP_DEST - unzip -o ffmpeg.zip - displayName: 'Download and unzip ffmpeg for test' - env: - CIRCLE_TOKEN: $(CIRCLECI_TOKEN) - -- bash: | - export NODE_HEADERS_DEST=$PWD/src/out/Default/gen - mkdir -p $NODE_HEADERS_DEST - cd src/electron - node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=node_headers.tar.gz --dest=$NODE_HEADERS_DEST - cd $NODE_HEADERS_DEST - tar xzf node_headers.tar.gz - displayName: 'Download and untar node header files for test' - env: - CIRCLE_TOKEN: $(CIRCLECI_TOKEN) - -- bash: | - export CROSS_ARCH_SNAPSHOTS=$PWD/src/out/Default/cross-arch-snapshots - mkdir -p $CROSS_ARCH_SNAPSHOTS - cd src/electron - node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/snapshot_blob.bin --dest=$CROSS_ARCH_SNAPSHOTS - node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/v8_context_snapshot.arm64.bin --dest=$CROSS_ARCH_SNAPSHOTS - displayName: 'Download cross arch snapshot files' - env: - CIRCLE_TOKEN: $(CIRCLECI_TOKEN) - -- bash: | - cd src - export ELECTRON_OUT_DIR=Default - export npm_config_arch=arm64 - (cd electron && node script/yarn test --enable-logging --runners main) - displayName: 'Run Electron main tests' - timeoutInMinutes: 20 - env: - ELECTRON_DISABLE_SECURITY_WARNINGS: 1 - IGNORE_YARN_INSTALL_ERROR: 1 - ELECTRON_TEST_RESULTS_DIR: junit - -- bash: | - cd src - export ELECTRON_OUT_DIR=Default - export npm_config_arch=arm64 - (cd electron && node script/yarn test --enable-logging --runners remote) - displayName: 'Run Electron remote tests' - timeoutInMinutes: 20 - condition: succeededOrFailed() - env: - ELECTRON_DISABLE_SECURITY_WARNINGS: 1 - IGNORE_YARN_INSTALL_ERROR: 1 - ELECTRON_TEST_RESULTS_DIR: junit - -- bash: | - cd src - python electron/script/verify-ffmpeg.py --source-root "$PWD" --build-dir out/Default --ffmpeg-path out/ffmpeg - displayName: Verify non proprietary ffmpeg - timeoutInMinutes: 5 - condition: succeededOrFailed() - env: - TARGET_ARCH: arm64 - -- bash: | - cd src - echo Verify cross arch snapshot - python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --snapshot-files-dir $PWD/out/Default/cross-arch-snapshots - displayName: Verify cross arch snapshot - timeoutInMinutes: 5 - condition: succeededOrFailed() - -- task: PublishTestResults@2 - displayName: 'Publish Test Results' - inputs: - testResultsFiles: '*.xml' - - searchFolder: '$(System.DefaultWorkingDirectory)/src/junit/' - - condition: succeededOrFailed() - -- bash: killall Electron || echo "No Electron processes left running" - displayName: 'Kill processes left running from last test run' - condition: always() - -- bash: | - rm -rf ~/Library/Application\ Support/Electron* - rm -rf ~/Library/Application\ Support/electron* - displayName: 'Delete user app data directories' - condition: always() - -- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3 - displayName: 'Clean Agent Directories' - - condition: always() diff --git a/azure-pipelines-woa.yml b/azure-pipelines-woa.yml deleted file mode 100644 index 9942f97f79dc3..0000000000000 --- a/azure-pipelines-woa.yml +++ /dev/null @@ -1,130 +0,0 @@ -workspace: - clean: all - -steps: -- checkout: self - path: src\electron - -- script: | - node script/yarn.js install --frozen-lockfile - displayName: 'Yarn install' - -- powershell: | - $localArtifactPath = "$pwd\dist.zip" - $serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/dist.zip" - Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" } - & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -o$(Pipeline.Workspace)\src\out\Default -y $localArtifactPath - displayName: 'Download and extract dist.zip for test' - env: - APPVEYOR_TOKEN: $(APPVEYOR_TOKEN) - -- powershell: | - $localArtifactPath = "$(Pipeline.Workspace)\src\out\Default\shell_browser_ui_unittests.exe" - $serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/shell_browser_ui_unittests.exe" - Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" } - displayName: 'Download and extract native test executables for test' - env: - APPVEYOR_TOKEN: $(APPVEYOR_TOKEN) - -- powershell: | - $localArtifactPath = "$pwd\ffmpeg.zip" - $serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/ffmpeg.zip" - Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" } - & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -o$(Pipeline.Workspace)\src\out\ffmpeg $localArtifactPath - displayName: 'Download and extract ffmpeg.zip for test' - env: - APPVEYOR_TOKEN: $(APPVEYOR_TOKEN) - -- powershell: | - $localArtifactPath = "$(Pipeline.Workspace)\src\node_headers.zip" - $serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/node_headers.zip" - Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" } - cd $(Pipeline.Workspace)\src - & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y node_headers.zip - displayName: 'Download node headers for test' - env: - APPVEYOR_TOKEN: $(APPVEYOR_TOKEN) - -- powershell: | - $localArtifactPath = "$(Pipeline.Workspace)\src\out\Default\electron.lib" - $serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/electron.lib" - Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" } - displayName: 'Download electron.lib for test' - env: - APPVEYOR_TOKEN: $(APPVEYOR_TOKEN) - -# Uncomment the following block if pdb files are needed to debug issues -# - powershell: | -# try { -# $localArtifactPath = "$(Pipeline.Workspace)\src\pdb.zip" -# $serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/pdb.zip" -# Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" } -# cd $(Pipeline.Workspace)\src -# & "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y pdb.zip -# } catch { -# Write-Host "There was an exception encountered while downloading pdb files:" $_.Exception.Message -# } finally { -# $global:LASTEXITCODE = 0 -# } -# displayName: 'Download pdb files for detailed stacktraces' -# env: -# APPVEYOR_TOKEN: $(APPVEYOR_TOKEN) - -- powershell: | - New-Item $(Pipeline.Workspace)\src\out\Default\gen\node_headers\Release -Type directory - Copy-Item -path $(Pipeline.Workspace)\src\out\Default\electron.lib -destination $(Pipeline.Workspace)\src\out\Default\gen\node_headers\Release\node.lib - displayName: 'Setup node headers' - -- script: | - cd $(Pipeline.Workspace)\src - set npm_config_nodedir=%cd%\out\Default\gen\node_headers - set npm_config_arch=arm64 - cd electron - node script/yarn test --runners=main --enable-logging --disable-features=CalculateNativeWinOcclusion - displayName: 'Run Electron Main process tests' - env: - ELECTRON_ENABLE_STACK_DUMPING: true - ELECTRON_OUT_DIR: Default - IGNORE_YARN_INSTALL_ERROR: 1 - ELECTRON_TEST_RESULTS_DIR: junit - MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap' - MOCHA_REPORTER: mocha-multi-reporters - -- script: | - cd $(Pipeline.Workspace)\src - set npm_config_nodedir=%cd%\out\Default\gen\node_headers - set npm_config_arch=arm64 - cd electron - node script/yarn test --runners=remote --enable-logging --disable-features=CalculateNativeWinOcclusion - displayName: 'Run Electron Remote based tests' - env: - ELECTRON_OUT_DIR: Default - IGNORE_YARN_INSTALL_ERROR: 1 - ELECTRON_TEST_RESULTS_DIR: junit - MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap' - MOCHA_REPORTER: mocha-multi-reporters - condition: succeededOrFailed() - -- task: PublishTestResults@2 - displayName: 'Publish Test Results' - inputs: - testResultsFiles: '*.xml' - searchFolder: '$(Pipeline.Workspace)/src/junit/' - condition: always() - -- script: | - cd $(Pipeline.Workspace)\src - echo "Verifying non proprietary ffmpeg" - python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg - displayName: 'Verify ffmpeg' - -- powershell: | - Get-Process | Where Name –Like "electron*" | Stop-Process - Get-Process | Where Name –Like "msedge*" | Stop-Process - displayName: 'Kill processes left running from last test run' - condition: always() - -- powershell: | - Remove-Item -path $env:APPDATA/Electron* -Recurse -Force -ErrorAction Ignore - displayName: 'Delete user app data directories' - condition: always() diff --git a/script/release/ci-release-build.js b/script/release/ci-release-build.js index ce9deae23bfd6..6d65d14226f74 100644 --- a/script/release/ci-release-build.js +++ b/script/release/ci-release-build.js @@ -2,11 +2,10 @@ if (!process.env.CI) require('dotenv-safe').load(); const assert = require('assert'); const got = require('got'); +const { Octokit } = require('@octokit/rest'); const BUILD_APPVEYOR_URL = 'https://ci.appveyor.com/api/builds'; const CIRCLECI_PIPELINE_URL = 'https://circleci.com/api/v2/project/gh/electron/electron/pipeline'; -const VSTS_URL = 'https://github.visualstudio.com/electron/_apis/build'; -const DEVOPS_URL = 'https://dev.azure.com/electron-ci/electron/_apis/build'; const CIRCLECI_WAIT_TIME = process.env.CIRCLECI_WAIT_TIME || 30000; const appVeyorJobs = { @@ -25,13 +24,7 @@ const circleCIPublishIndividualArches = { 'linux-publish': ['arm', 'arm64', 'ia32', 'x64'] }; -const vstsArmJobs = [ - 'electron-arm-testing', - 'electron-osx-arm64-testing', - 'electron-mas-arm64-testing', - 'electron-arm64-testing', - 'electron-woa-testing' -]; +const GHAJobs = ['electron-woa-testing']; let jobRequestedCount = 0; @@ -247,75 +240,28 @@ function buildCircleCI (targetBranch, options) { } } -async function buildVSTS (targetBranch, options) { - assert(options.armTest, `${options.ci} only works with the --armTest option.`); - assert(vstsArmJobs.includes(options.job), `Unknown VSTS CI arm test job name: ${options.job}. Valid values are: ${vstsArmJobs}.`); +async function buildGHA (targetBranch, options) { + const { GHA_TOKEN } = process.env; + assert(GHA_TOKEN, `${options.ci} requires the $GHA_TOKEN environment variable to be provided`); - console.log(`Triggering VSTS to run build on branch: ${targetBranch}.`); - const environmentVariables = {}; + const octokit = new Octokit({ auth: GHA_TOKEN }); - if (options.circleBuildNum) { - environmentVariables.CIRCLE_BUILD_NUM = options.circleBuildNum; - } else if (options.appveyorJobId) { - environmentVariables.APPVEYOR_JOB_ID = options.appveyorJobId; - } + assert(GHAJobs.includes(options.job), `Unknown GitHub Actions arm test job name: ${options.job}. Valid values are: ${GHAJobs}.`); + assert(options.commit !== null, 'commit is a required option for GitHub Actions'); - let vstsURL = VSTS_URL; - let vstsToken = process.env.VSTS_TOKEN; - assert(vstsToken, `${options.ci} requires the $VSTS_TOKEN environment variable to be provided`); - if (options.ci === 'DevOps') { - vstsURL = DEVOPS_URL; - vstsToken = process.env.DEVOPS_TOKEN; - } - const requestOpts = { - url: `${vstsURL}/definitions?api-version=4.1`, - auth: { - user: '', - password: vstsToken - }, - headers: { - 'Content-Type': 'application/json' - } - }; + console.log(`Triggering GitHub Actions to run build on branch: ${targetBranch}.`); jobRequestedCount++; try { - const vstsResponse = await makeRequest(requestOpts, true); - const buildToRun = vstsResponse.value.find(build => build.name === options.job); - callVSTSBuild(buildToRun, targetBranch, environmentVariables, vstsURL, vstsToken); - } catch (err) { - console.log('Problem calling VSTS to get build definitions: ', err); - } -} - -async function callVSTSBuild (build, targetBranch, environmentVariables, vstsURL, vstsToken) { - const buildBody = { - definition: build, - sourceBranch: targetBranch, - priority: 'high' - }; - if (Object.keys(environmentVariables).length !== 0) { - buildBody.parameters = JSON.stringify(environmentVariables); - } - const requestOpts = { - url: `${vstsURL}/builds?api-version=4.1`, - auth: { - user: '', - password: vstsToken - }, - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(buildBody), - method: 'POST' - }; - - try { - const { _links } = await makeRequest(requestOpts, true); - console.log(`VSTS release build request for ${build.name} successful. Check ${_links.web.href} for status.`); + const response = await octokit.request('POST /repos/electron/electron/actions/workflows/electron_woa_testing.yml/dispatches', { + ref: targetBranch, + inputs: { + appveyor_job_id: `${options.appveyorJobId}` + } + }); } catch (err) { - console.log(`Could not call VSTS for job ${build.name}: `, err); + console.log('Problem calling GitHub Actions to get build definitions: ', err); } } @@ -330,9 +276,8 @@ function runRelease (targetBranch, options) { buildAppVeyor(targetBranch, options); break; } - case 'DevOps': - case 'VSTS': { - buildVSTS(targetBranch, options); + case 'GHA': { + buildGHA(targetBranch, options); break; } default: { @@ -351,13 +296,13 @@ module.exports = runRelease; if (require.main === module) { const args = require('minimist')(process.argv.slice(2), { - boolean: ['ghRelease', 'armTest'] + boolean: ['ghRelease'] }); const targetBranch = args._[0]; if (args._.length < 1) { console.log(`Trigger CI to build release builds of electron. - Usage: ci-release-build.js [--job=CI_JOB_NAME] [--arch=INDIVIDUAL_ARCH] [--ci=CircleCI|AppVeyor|VSTS|DevOps] - [--ghRelease] [--armTest] [--circleBuildNum=xxx] [--appveyorJobId=xxx] [--commit=sha] TARGET_BRANCH + Usage: ci-release-build.js [--job=CI_JOB_NAME] [--arch=INDIVIDUAL_ARCH] [--ci=CircleCI|AppVeyor|GHA] + [--ghRelease] [--circleBuildNum=xxx] [--appveyorJobId=xxx] [--commit=sha] TARGET_BRANCH `); process.exit(0); } diff --git a/vsts-arm-test-steps.yml b/vsts-arm-test-steps.yml deleted file mode 100644 index 5985e4d2637e4..0000000000000 --- a/vsts-arm-test-steps.yml +++ /dev/null @@ -1,110 +0,0 @@ -steps: -- task: CopyFiles@2 - displayName: 'Copy Files to: src/electron' - inputs: - TargetFolder: src/electron - -- bash: | - cd src/electron - node script/yarn.js install --frozen-lockfile - displayName: 'Yarn install' - -- bash: | - export ZIP_DEST=$PWD/src/out/Default - echo "##vso[task.setvariable variable=ZIP_DEST]$ZIP_DEST" - mkdir -p $ZIP_DEST - cd src/electron - node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=dist.zip --dest=$ZIP_DEST - cd $ZIP_DEST - unzip -o dist.zip - displayName: 'Download and unzip dist files for test' - env: - CIRCLE_TOKEN: $(CIRCLECI_TOKEN) - -- bash: | - export FFMPEG_ZIP_DEST=$PWD/src/out/ffmpeg - mkdir -p $FFMPEG_ZIP_DEST - cd src/electron - node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=ffmpeg.zip --dest=$FFMPEG_ZIP_DEST - cd $FFMPEG_ZIP_DEST - unzip -o ffmpeg.zip - displayName: 'Download and unzip ffmpeg for test' - env: - CIRCLE_TOKEN: $(CIRCLECI_TOKEN) - -- bash: | - export NODE_HEADERS_DEST=$PWD/src/out/Default/gen - mkdir -p $NODE_HEADERS_DEST - cd src/electron - node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=node_headers.tar.gz --dest=$NODE_HEADERS_DEST - cd $NODE_HEADERS_DEST - tar xzf node_headers.tar.gz - displayName: 'Download and untar node header files for test' - env: - CIRCLE_TOKEN: $(CIRCLECI_TOKEN) - -- bash: | - export CROSS_ARCH_SNAPSHOTS=$PWD/src/out/Default/cross-arch-snapshots - mkdir -p $CROSS_ARCH_SNAPSHOTS - cd src/electron - node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/snapshot_blob.bin --dest=$CROSS_ARCH_SNAPSHOTS - node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=cross-arch-snapshots/v8_context_snapshot.bin --dest=$CROSS_ARCH_SNAPSHOTS - displayName: 'Download cross arch snapshot files' - env: - CIRCLE_TOKEN: $(CIRCLECI_TOKEN) - -- bash: | - export NATIVE_UNITTESTS_DEST=$PWD/src/out/Default - cd src/electron - node script/download-circleci-artifacts.js --buildNum=$CIRCLE_BUILD_NUM --name=shell_browser_ui_unittests --dest=$NATIVE_UNITTESTS_DEST - chmod +x $NATIVE_UNITTESTS_DEST/shell_browser_ui_unittests - displayName: 'Download native unittest executables' - env: - CIRCLE_TOKEN: $(CIRCLECI_TOKEN) - -- bash: | - sh -e /etc/init.d/xvfb start - displayName: Setup for headless testing - env: - DISPLAY: ":99.0" - -- bash: | - # Next line needed to avoid crash on arm32 - sudo gdk-pixbuf-query-loaders --update-cache - cd src - export ELECTRON_OUT_DIR=Default - (cd electron && node script/yarn test -- --enable-logging) - displayName: 'Run Electron tests' - timeoutInMinutes: 20 - env: - ELECTRON_DISABLE_SECURITY_WARNINGS: 1 - IGNORE_YARN_INSTALL_ERROR: 1 - ELECTRON_TEST_RESULTS_DIR: junit - CI: 1 - -- bash: | - cd src - python electron/script/verify-ffmpeg.py --source-root "$PWD" --build-dir out/Default --ffmpeg-path out/ffmpeg - displayName: Verify non proprietary ffmpeg - timeoutInMinutes: 5 - -- bash: | - cd src - echo Verify cross arch snapshot - python electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --snapshot-files-dir $PWD/out/Default/cross-arch-snapshots - displayName: Verify cross arch snapshot - timeoutInMinutes: 5 - -- task: PublishTestResults@2 - displayName: 'Publish Test Results' - inputs: - testResultsFiles: '*.xml' - - searchFolder: '$(System.DefaultWorkingDirectory)/src/junit/' - - condition: succeededOrFailed() - -- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3 - displayName: 'Clean Agent Directories' - - condition: always() diff --git a/vsts-arm32v7.yml b/vsts-arm32v7.yml deleted file mode 100644 index feeb920ba8f39..0000000000000 --- a/vsts-arm32v7.yml +++ /dev/null @@ -1,13 +0,0 @@ -resources: - containers: - - container: arm32v7-test-container - image: ghcr.io/electron/build:arm32v7-27db4a3e3512bfd2e47f58cea69922da0835f1d9 - options: --shm-size 128m - -jobs: -- job: Test_Arm32v7 - container: arm32v7-test-container - displayName: Test Arm on Arm32v7 hardware - timeoutInMinutes: 30 - steps: - - template: vsts-arm-test-steps.yml diff --git a/vsts-arm64v8.yml b/vsts-arm64v8.yml deleted file mode 100644 index e64708663b393..0000000000000 --- a/vsts-arm64v8.yml +++ /dev/null @@ -1,13 +0,0 @@ -resources: - containers: - - container: arm64v8-test-container - image: ghcr.io/electron/build:arm64v8-27db4a3e3512bfd2e47f58cea69922da0835f1d9 - options: --shm-size 128m - -jobs: -- job: Test_Arm64 - container: arm64v8-test-container - displayName: Test Arm64 on Arm64 hardware - timeoutInMinutes: 30 - steps: - - template: vsts-arm-test-steps.yml