Test #4130
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: | |
master | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
TEST_IMAGE_NODE_MAJOR_VERSION: 20 | |
jobs: | |
test-docker-build: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
nodeVersion: [ | |
20.18.1, | |
18.20.5, | |
16.20.2, | |
14.21.3 | |
] | |
steps: | |
- name: Checkout code repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Extract node major version to tag docker image | |
run: echo "NODE_TAG=$(cut -d '.' -f 1 <<< ${{ matrix.nodeVersion }})" >> $GITHUB_ENV | |
- name: Determine if Dockerfiles changed | |
id: changed-files-specific | |
uses: tj-actions/changed-files@c65cd883420fd2eb864698a825fc4162dd94482c # v44 | |
with: | |
files: docker/**/* | |
- name: Verify docker builds all images | |
# if: steps.changed-files-specific.outputs.any_changed == 'true' | |
shell: bash | |
run: | | |
bash docker/build.sh ${{ matrix.nodeVersion }} | |
docker save -o ${{ runner.temp }}/test-runner-node-${{ env.NODE_TAG }}-${{ github.run_id }}-${{ github.run_number }}.tar test-runner:${{ env.NODE_TAG }} | |
- name: Upload test runner image | |
# if: steps.changed-files-specific.outputs.any_changed == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-runner-node-${{ env.NODE_TAG }}-${{ github.run_id }}-${{ github.run_number }} | |
path: ${{ runner.temp }}/test-runner-node-${{ env.NODE_TAG }}-${{ github.run_id }}-${{ github.run_number }}.tar | |
retention-days: 1 | |
if-no-files-found: error | |
test-linux: | |
runs-on: ubuntu-22.04 | |
needs: test-docker-build | |
strategy: | |
fail-fast: false | |
matrix: | |
testFiles: | |
- ArtifactPublisherTest,BuildTest,ExtraBuildTest,RepoSlugTest,binDownloadTest,configurationValidationTest,filenameUtilTest,filesTest,globTest,ignoreTest,macroExpanderTest,mainEntryTest,urlUtilTest,extraMetadataTest,linuxArchiveTest,linuxPackagerTest,HoistedNodeModuleTest,MemoLazyTest | |
- snapTest,debTest,fpmTest,protonTest | |
steps: | |
- name: Checkout code repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
fetch-depth: 2 | |
- name: Setup Tests | |
uses: ./.github/actions/pretest | |
with: | |
cache-path: ~/.cache/electron | |
cache-key: v-23.3.10-linux-electron | |
- name: Check if a newly built docker test image exists | |
uses: softwareforgood/check-artifact-v4-existence@v0 | |
id: check-for-test-image | |
with: | |
name: test-runner-node-${{ env.TEST_IMAGE_NODE_MAJOR_VERSION }}-${{ github.run_id }}-${{ github.run_number }} | |
- name: Download test-runner if exists | |
if: steps.check-for-test-image.outputs.exists == 'true' | |
id: download-test-runner-image | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-runner-node-${{ env.TEST_IMAGE_NODE_MAJOR_VERSION }}-${{ github.run_id }}-${{ github.run_number }} | |
path: ${{ runner.temp }} | |
- name: Load test runner image if needed | |
if: steps.check-for-test-image.outputs.exists == 'true' | |
run: | | |
docker image load --input ${{ runner.temp }}/test-runner-node-${{ env.TEST_IMAGE_NODE_MAJOR_VERSION }}-${{ github.run_id }}-${{ github.run_number }}.tar | |
docker image ls -a | |
- name: Lint | |
run: pnpm pretest | |
- name: Run tests in docker image | |
run: | | |
echo $TEST_RUNNER_IMAGE_TAG | |
pnpm test-linux | |
env: | |
TEST_FILES: ${{ matrix.testFiles }} | |
FORCE_COLOR: 1 | |
TEST_RUNNER_IMAGE_TAG: test-runner:${{ env.TEST_IMAGE_NODE_MAJOR_VERSION }} | |
test-mac: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Setup Tests | |
uses: ./.github/actions/pretest | |
with: | |
cache-path: ~/Library/Caches/electron | |
cache-key: v-23.3.10-macos-electron | |
- name: Test | |
run: pnpm ci:test | |
env: | |
TEST_FILES: masTest,dmgTest,filesTest,macPackagerTest,differentialUpdateTest | |
FORCE_COLOR: 1 | |
# Need to separate from other tests because logic is specific to when TOKEN env vars are set | |
test-updater: | |
runs-on: ubuntu-22.04 | |
needs: test-docker-build | |
strategy: | |
fail-fast: false | |
matrix: | |
nodeVersion: [ | |
20, | |
18, | |
16, | |
14 | |
] | |
steps: | |
- name: Checkout code repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Setup Tests | |
uses: ./.github/actions/pretest | |
with: | |
cache-path: ~/.cache/electron | |
cache-key: v-23.3.10-update-electron | |
- name: Check if a newly built docker test image exists | |
uses: softwareforgood/check-artifact-v4-existence@v0 | |
id: check-for-test-image | |
with: | |
name: test-runner-node-${{ matrix.nodeVersion }}-${{ github.run_id }}-${{ github.run_number }} | |
- name: Download test-runner if exists | |
if: steps.check-for-test-image.outputs.exists == 'true' | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-runner-node-${{ matrix.nodeVersion }}-${{ github.run_id }}-${{ github.run_number }} | |
path: ${{ runner.temp }} | |
- name: Load test runner image if needed | |
if: steps.check-for-test-image.outputs.exists == 'true' | |
run: | | |
docker image load --input ${{ runner.temp }}/test-runner-node-${{ matrix.nodeVersion }}-${{ github.run_id }}-${{ github.run_number }}.tar | |
docker image ls -a | |
- name: Test | |
run: | | |
echo $TEST_RUNNER_IMAGE_TAG | |
pnpm test-linux | |
env: | |
TEST_FILES: nsisUpdaterTest,linuxUpdaterTest,PublishManagerTest,differentialUpdateTest | |
KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }} | |
BITBUCKET_TOKEN: ${{ secrets.BITBUCKET_TOKEN }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
FORCE_COLOR: 1 | |
TEST_RUNNER_IMAGE_TAG: test-runner:${{ matrix.nodeVersion }} | |
- name: Verify Docs Generation | |
run: pnpm generate-all | |
# test-windows: | |
# runs-on: windows-latest | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# testFiles: | |
# - winCodeSignTest,differentialUpdateTest | |
# - installerTest,appxTest,msiTest,portableTest,assistedInstallerTest,protonTest | |
# - BuildTest,oneClickInstallerTest,winPackagerTest,nsisUpdaterTest,webInstallerTest | |
# steps: | |
# - name: Checkout code repository | |
# uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
# - name: Setup Tests | |
# uses: ./.github/actions/pretest | |
# with: | |
# cache-key: v-23.3.10-windows-electron | |
# cache-path: ~\AppData\Local\electron\Cache | |
# - name: Test | |
# run: pnpm ci:test | |
# env: | |
# CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
# TEST_FILES: ${{ matrix.testFiles }} | |
# FORCE_COLOR: 1 |