From 1264486990da8b0e12a6be2307aaaf1bd394298c Mon Sep 17 00:00:00 2001 From: Fabricio Ribeiro Date: Mon, 25 Aug 2025 16:26:33 +0100 Subject: [PATCH 1/4] Add offline install test --- .../build_offline_installer_archives.yaml | 10 +- .github/workflows/test_offline.yml | 175 ++++++++++++++++++ tests/CLIRunner.test.js | 27 ++- tests/suites/CLI-offline.json | 13 ++ 4 files changed, 223 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test_offline.yml create mode 100644 tests/suites/CLI-offline.json diff --git a/.github/workflows/build_offline_installer_archives.yaml b/.github/workflows/build_offline_installer_archives.yaml index b1d71c2a..2e7560ef 100644 --- a/.github/workflows/build_offline_installer_archives.yaml +++ b/.github/workflows/build_offline_installer_archives.yaml @@ -12,7 +12,7 @@ on: workflow_dispatch: inputs: run_number: - description: 'The run number from which to take binaries' + description: "The run number from which to take binaries" required: true type: string @@ -115,3 +115,11 @@ jobs: asset_path: offline_installer-${{ matrix.package_name }}-${{ env.VERSION }}.zip asset_name: offline_installer-${{ matrix.package_name }}-${{ env.VERSION }}.zip asset_content_type: application/zip + + Autotest-CLI-Offline: + needs: [build-offline-archives] + if: needs.build-offline-archives.result == 'success' + uses: ./.github/workflows/test_offline.yml + with: + ref: ${{ github.event.pull_request.head.ref || github.ref }} + version: ${{ needs.build-offline-archives.outputs.VERSION }} diff --git a/.github/workflows/test_offline.yml b/.github/workflows/test_offline.yml new file mode 100644 index 00000000..025e2420 --- /dev/null +++ b/.github/workflows/test_offline.yml @@ -0,0 +1,175 @@ +name: Autotest + +on: + workflow_call: + inputs: + ref: + required: true + type: string + version: + required: true + type: string + +jobs: + test: + name: Offline (${{ matrix.package_name }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + package_name: linux-x64 + run_on: GitHub + - os: windows-latest + package_name: windows-x64 + run_on: GitHub + - os: macos-latest + package_name: macos-aarch64 + run_on: GitHub + - os: ubuntu-24.04-arm + package_name: linux-aarch64 + run_on: GitHub + - os: macos-13 + package_name: macos-x64 + run_on: GitHub + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref }} + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Download Archive + uses: actions/download-artifact@v5 + with: + name: offline_installer-${{ matrix.package_name }}-${{ inputs.version }} + path: ./artifacts + + # Non-Windows steps + + - name: Get CLI application version number (non-Windows) + if: matrix.os != 'windows-latest' + run: | + git fetch --tags + LATEST_TAG=$(git tag --sort=-creatordate | head -n 1) + STRIPPED_TAG=${LATEST_TAG#v} + echo "CLI_TAG=$STRIPPED_TAG" >> $GITHUB_ENV + + - name: Make EIM executable (non-Windows) + if: matrix.os != 'windows-latest' + run: | + ls -la ./artifacts/ + mv ./artifacts/archive_v${{inputs.version}}.zst /artifacts/archive.zst + chmod +x artifacts/eim + + - name: Install dependencies and node.js (Ubuntu) + if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' + run: | + sudo apt-get update + sudo apt-get install -y git wget flex bison gperf ccache libffi-dev libssl-dev dfu-util libusb-1.0-0-dev libgcrypt20 libglib2.0-0 libpixman-1-0 libsdl2-2.0-0 libslirp0 python3 python3-venv python3-pip + cd tests + npm ci + + - name: Install dependencies and node.js (MacOS) + if: matrix.os == 'macos-latest' || matrix.os == 'macos-13' + run: | + brew install dfu-util libgcrypt glib pixman sdl2 libslirp + cd tests + npm ci + + - name: Run IDF offline installation (non-Windows) + if: matrix.os != 'windows-latest' + run: | + export HTTP_PROXY="http://127.0.0.1:9" + export HTTPS_PROXY="http://127.0.0.1:9" + export NO_PROXY="localhost,127.0.0.1" + export LOG_TO_FILE="true" + export EIM_FILE_PATH="../artifacts/eim" + export EIM_CLI_VERSION="eim ${{ env.CLI_TAG }}" + cd tests + npm run test-CLI --file=CLI-offline + unset HTTP_PROXY HTTPS_PROXY NO_PROXY + continue-on-error: true + + # Windows steps + + - name: Get CLI application version number (Windows) + if: matrix.os == 'windows-latest' + run: | + git fetch --tags + $LATEST_TAG = (git tag --sort=-creatordate | Select-Object -First 1) + $STRIPPED_TAG = $LATEST_TAG -replace '^v', '' + echo "CLI_TAG=$STRIPPED_TAG" | Out-File -FilePath $env:GITHUB_ENV -Append + + - name: Check artifact (Windows) + if: matrix.os == 'windows-latest' + run: | + ls ./artifacts/ + Move-Item "./artifacts/archive_v${{inputs.version}}.zst" "artifacts/archive.zst" + + - name: Run IDF offline installation (Windows) + if: matrix.os == 'windows-latest' + run: | + $env:HTTP_PROXY = 'http://127.0.0.1:9' + $env:HTTPS_PROXY = 'http://127.0.0.1:9' + $env:NO_PROXY = 'localhost,127.0.0.1' + $env:LOG_TO_FILE="true" + $env:EIM_FILE_PATH = "..\artifacts\eim.exe" + $env:EIM_CLI_VERSION = "eim ${{ env.CLI_TAG }}" + Set-Location -Path "./tests" + Expand-Archive node_modules.zip + npm run test-CLI-win --file=CLI-offline + Remove-Item Env:HTTP_PROXY, Env:HTTPS_PROXY, Env:NO_PROXY -ErrorAction SilentlyContinue + continue-on-error: true + + # Copy eim log files to standard location for easier access + - name: Copy EIM Log files (ubuntu) + if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' + run: | + cp ~/.local/share/eim/logs/*.log ./tests/ + + - name: Copy EIM Log files (MacOS) + if: matrix.os == 'macos-latest' || matrix.os == 'macos-13' + run: | + cp ~/Library/Application\ Support/eim/logs/*.log ./tests/ + + - name: Copy EIM Log files (Windows) + if: matrix.os == 'windows-latest' + run: | + Move-Item -Path "$env:LOCALAPPDATA\eim\logs\*" -Destination ".\tests\" -Force + + # Upload test results + - name: Upload test results (non-windows) + uses: actions/upload-artifact@v4 + if: matrix.os != 'windows-latest' + with: + name: autotest-CLI-Offline-results-${{ matrix.package_name }} + path: | + ./tests/results-*.json + ./tests/*.log + + - name: Upload test results (windows) + uses: actions/upload-artifact@v4 + if: matrix.os == 'windows-latest' + with: + name: autotest-CLI-Offline-results-${{ matrix.package_name }} + path: | + ./tests/results-*.json + ./tests/*.log + + # Publish test results + - name: Publish Test Results + uses: dorny/test-reporter@v2 + if: always() + with: + name: CLI-Offline-Autotests-${{ matrix.package_name }} + path: ./tests/results-*.json + path-replace-backslashes: "false" + reporter: mocha-json + fail-on-empty: true diff --git a/tests/CLIRunner.test.js b/tests/CLIRunner.test.js index eecb7334..3dc570c5 100644 --- a/tests/CLIRunner.test.js +++ b/tests/CLIRunner.test.js @@ -3,7 +3,7 @@ * Entries should follow this format: * { "id": , // an ID to correlate with the test report - "type": "custom", // test type is either "prerequisites", "arguments", "default" or "custom" + "type": "custom", // test type is either "prerequisites", "arguments", "default", "custom" or "offline" "name": "", // A name for the test to correlate to logs and report "data": { // Only required for custom test type "targetList": "esp32s2", // Which targets to install "esp32|esp32c6" @@ -170,6 +170,31 @@ function testRun(jsonScript) { installFolder, }); }); + } else if (test.type === "offline") { + //routine for offline installation test + + const offlineArg = ["--use-local-archive archive.zst"]; + + const deleteAfterTest = + test.deleteAfterTest === undefined ? true : test.deleteAfterTest; + + describe(`Test${test.id} - ${test.name} ->`, function () { + this.timeout(6000000); + + runCLICustomInstallTest(pathToEIMCLI, offlineArg); + + runInstallVerification({ + installFolder: INSTALLFOLDER, + idfList: [IDFDefaultVersion], + toolsFolder: TOOLSFOLDER, + }); + + runCleanUp({ + installFolder: INSTALLFOLDER, + toolsFolder: TOOLSFOLDER, + deleteAfterTest, + }); + }); } else { logger.error(`Unknown test type: ${test.type}`); } diff --git a/tests/suites/CLI-offline.json b/tests/suites/CLI-offline.json new file mode 100644 index 00000000..1b68f77a --- /dev/null +++ b/tests/suites/CLI-offline.json @@ -0,0 +1,13 @@ +[ + { + "id": 1, + "type": "arguments", + "name": "CLI Arguments" + }, + { + "id": 2, + "type": "offline", + "name": "CLI Offline Installation", + "deleteAfterTest": true + } +] From a01943f4946dce1082b55f0d778b364b33eef5be Mon Sep 17 00:00:00 2001 From: Fabricio Ribeiro Date: Tue, 26 Aug 2025 08:51:08 +0100 Subject: [PATCH 2/4] Fix workflow call variables for offline build. --- .github/workflows/build.yaml | 6 ++-- .../build_offline_installer_archives.yaml | 25 +++++++++------ .github/workflows/test_cli.yml | 16 ++++++++-- .github/workflows/test_gui.yml | 19 ++++++++++-- .github/workflows/test_offline.yml | 31 ++++++++++++++----- 5 files changed, 72 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b4ed1ad5..5b2e64c1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -440,8 +440,8 @@ jobs: if: (needs.build-cli.result == 'success' || needs.build-cli.result == 'skipped') && (needs.build-cli-linux.result == 'success' || needs.build-cli-linux.result == 'skipped') && github.event_name == 'release' uses: ./.github/workflows/build_offline_installer_archives.yaml with: - run_number: ${{ github.run_number }} ref: ${{ github.event.pull_request.head.ref || github.ref }} + run_id: ${{ github.run_id }} build-gui: name: Build GUI (${{ matrix.package_name }}) @@ -736,7 +736,7 @@ jobs: if: needs.build-cli.result == 'success' && needs.build-cli-linux.result == 'success' uses: ./.github/workflows/test_cli.yml with: - run_number: ${{ github.run_number }} + run_id: ${{ github.run_id }} ref: ${{ github.event.pull_request.head.ref || github.ref }} Autotest-GUI: @@ -744,7 +744,7 @@ jobs: if: needs.build-gui.result == 'success' uses: ./.github/workflows/test_gui.yml with: - run_number: ${{ github.run_number }} + run_id: ${{ github.run_id }} ref: ${{ github.event.pull_request.head.ref || github.ref }} update-release-info: diff --git a/.github/workflows/build_offline_installer_archives.yaml b/.github/workflows/build_offline_installer_archives.yaml index 2e7560ef..9f002613 100644 --- a/.github/workflows/build_offline_installer_archives.yaml +++ b/.github/workflows/build_offline_installer_archives.yaml @@ -3,16 +3,17 @@ name: Build Offline Installer Archives on: workflow_call: inputs: - run_number: + ref: required: true type: string - ref: + run_id: required: true type: string + workflow_dispatch: inputs: - run_number: - description: "The run number from which to take binaries" + run_id: + description: "The run id from which to take binaries" required: true type: string @@ -37,16 +38,22 @@ jobs: package_name: macos-x64 steps: - name: Download offline_installer_builder artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v5 with: - name: offline_installer_builder-${{ matrix.package_name }}-${{ github.run_number }} + pattern: offline_installer_builder-${{ matrix.package_name }}-* + merge-multiple: true path: ./ + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ inputs.run_id || github.run_id }} - name: Download eim artifact uses: actions/download-artifact@v4 with: - name: eim-cli-${{ matrix.package_name }}-${{ github.run_number }} + pattern: eim-cli-${{ matrix.package_name }}-* + merge-multiple: true path: ./ + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ inputs.run_id || github.run_id }} - name: Make binary executable (Unix) if: runner.os != 'Windows' @@ -121,5 +128,5 @@ jobs: if: needs.build-offline-archives.result == 'success' uses: ./.github/workflows/test_offline.yml with: - ref: ${{ github.event.pull_request.head.ref || github.ref }} - version: ${{ needs.build-offline-archives.outputs.VERSION }} + ref: ${{ inputs.ref || github.ref }} + run_id: ${{ github.run_id }} diff --git a/.github/workflows/test_cli.yml b/.github/workflows/test_cli.yml index f6fdba45..dd2d4fc0 100644 --- a/.github/workflows/test_cli.yml +++ b/.github/workflows/test_cli.yml @@ -1,15 +1,22 @@ -name: Autotest +name: Autotest CLI on: workflow_call: inputs: - run_number: + run_id: required: true type: string ref: required: true type: string + workflow_dispatch: + inputs: + run_id: + description: "The run id from which to take binaries" + required: true + type: string + jobs: test: name: CLI (${{ matrix.package_name }}${{ matrix.run_on == 'MirrorRunner' && '-AlternateMirrors' || '' }}${{contains(github.event.pull_request.labels.*.name, 'CNRUNNER') && '-CN' || '' }}) @@ -51,8 +58,11 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: eim-cli-${{ matrix.package_name }}-${{ inputs.run_number }} + pattern: eim-cli-${{ matrix.package_name }}-* path: ./artifacts + merge-multiple: true + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ inputs.run_id }} # Non-Windows steps diff --git a/.github/workflows/test_gui.yml b/.github/workflows/test_gui.yml index 9fd8c7b4..1024a7af 100644 --- a/.github/workflows/test_gui.yml +++ b/.github/workflows/test_gui.yml @@ -3,13 +3,20 @@ name: Autotest GUI on: workflow_call: inputs: - run_number: + run_id: required: true type: string ref: required: true type: string + workflow_dispatch: + inputs: + run_id: + description: "The run id from which to take binaries" + required: true + type: string + jobs: test-cli-in-gui: name: CLI in GUI (${{ matrix.package_name }}) @@ -48,8 +55,11 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: eim-gui-${{ matrix.package_name }}-${{ inputs.run_number }} + pattern: eim-gui-${{ matrix.package_name }}-* path: ./artifacts + merge-multiple: true + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ inputs.run_id }} # Non-Windows steps @@ -214,8 +224,11 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: eim-gui-${{ matrix.package_name }}-${{ inputs.run_number }} + pattern: eim-gui-${{ matrix.package_name }}-* path: ./artifacts + merge-multiple: true + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ inputs.run_id }} # Non-Windows steps diff --git a/.github/workflows/test_offline.yml b/.github/workflows/test_offline.yml index 025e2420..a076a9bd 100644 --- a/.github/workflows/test_offline.yml +++ b/.github/workflows/test_offline.yml @@ -1,4 +1,4 @@ -name: Autotest +name: Autotest Offline on: workflow_call: @@ -6,7 +6,14 @@ on: ref: required: true type: string - version: + run_id: + required: true + type: string + + workflow_dispatch: + inputs: + run_id: + description: "The run id from which to take the offline installer archive" required: true type: string @@ -48,8 +55,11 @@ jobs: - name: Download Archive uses: actions/download-artifact@v5 with: - name: offline_installer-${{ matrix.package_name }}-${{ inputs.version }} + pattern: offline_installer-${{ matrix.package_name }}-* + merge-multiple: true path: ./artifacts + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ inputs.run_id }} # Non-Windows steps @@ -65,7 +75,9 @@ jobs: if: matrix.os != 'windows-latest' run: | ls -la ./artifacts/ - mv ./artifacts/archive_v${{inputs.version}}.zst /artifacts/archive.zst + unzip ./artifacts/offline_installer*.zip -d ./artifacts/ + mv ./artifacts/archive_v*.zst ./artifacts/archive.zst + ls -la ./artifacts/ chmod +x artifacts/eim - name: Install dependencies and node.js (Ubuntu) @@ -90,7 +102,7 @@ jobs: export HTTPS_PROXY="http://127.0.0.1:9" export NO_PROXY="localhost,127.0.0.1" export LOG_TO_FILE="true" - export EIM_FILE_PATH="../artifacts/eim" + export EIM_CLI_PATH="../artifacts/eim" export EIM_CLI_VERSION="eim ${{ env.CLI_TAG }}" cd tests npm run test-CLI --file=CLI-offline @@ -111,7 +123,9 @@ jobs: if: matrix.os == 'windows-latest' run: | ls ./artifacts/ - Move-Item "./artifacts/archive_v${{inputs.version}}.zst" "artifacts/archive.zst" + Expand-Archive ./artifacts/offline_installer*.zip -DestinationPath ./artifacts/ + ls ./artifacts/ + Move-Item "./artifacts/archive_v*.zst" "artifacts/archive.zst" - name: Run IDF offline installation (Windows) if: matrix.os == 'windows-latest' @@ -120,7 +134,7 @@ jobs: $env:HTTPS_PROXY = 'http://127.0.0.1:9' $env:NO_PROXY = 'localhost,127.0.0.1' $env:LOG_TO_FILE="true" - $env:EIM_FILE_PATH = "..\artifacts\eim.exe" + $env:EIM_CLI_PATH = "..\artifacts\eim.exe" $env:EIM_CLI_VERSION = "eim ${{ env.CLI_TAG }}" Set-Location -Path "./tests" Expand-Archive node_modules.zip @@ -133,16 +147,19 @@ jobs: if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' run: | cp ~/.local/share/eim/logs/*.log ./tests/ + continue-on-error: true - name: Copy EIM Log files (MacOS) if: matrix.os == 'macos-latest' || matrix.os == 'macos-13' run: | cp ~/Library/Application\ Support/eim/logs/*.log ./tests/ + continue-on-error: true - name: Copy EIM Log files (Windows) if: matrix.os == 'windows-latest' run: | Move-Item -Path "$env:LOCALAPPDATA\eim\logs\*" -Destination ".\tests\" -Force + continue-on-error: true # Upload test results - name: Upload test results (non-windows) From d4bc1fde2f71ecf64ac40ed920bf86a40bac1dcf Mon Sep 17 00:00:00 2001 From: Fabricio Ribeiro Date: Tue, 26 Aug 2025 10:22:34 +0100 Subject: [PATCH 3/4] Set env variable for path to offline archive file --- .github/workflows/test_offline.yml | 4 +++- tests/CLIRunner.test.js | 3 ++- tests/config.js | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_offline.yml b/.github/workflows/test_offline.yml index a076a9bd..67559353 100644 --- a/.github/workflows/test_offline.yml +++ b/.github/workflows/test_offline.yml @@ -103,6 +103,7 @@ jobs: export NO_PROXY="localhost,127.0.0.1" export LOG_TO_FILE="true" export EIM_CLI_PATH="../artifacts/eim" + export EIM_OFFLINE_ARCHIVE="../artifacts/archive.zst" export EIM_CLI_VERSION="eim ${{ env.CLI_TAG }}" cd tests npm run test-CLI --file=CLI-offline @@ -124,8 +125,8 @@ jobs: run: | ls ./artifacts/ Expand-Archive ./artifacts/offline_installer*.zip -DestinationPath ./artifacts/ - ls ./artifacts/ Move-Item "./artifacts/archive_v*.zst" "artifacts/archive.zst" + ls ./artifacts/ - name: Run IDF offline installation (Windows) if: matrix.os == 'windows-latest' @@ -135,6 +136,7 @@ jobs: $env:NO_PROXY = 'localhost,127.0.0.1' $env:LOG_TO_FILE="true" $env:EIM_CLI_PATH = "..\artifacts\eim.exe" + $env:EIM_OFFLINE_ARCHIVE = "..\artifacts\archive.zst" $env:EIM_CLI_VERSION = "eim ${{ env.CLI_TAG }}" Set-Location -Path "./tests" Expand-Archive node_modules.zip diff --git a/tests/CLIRunner.test.js b/tests/CLIRunner.test.js index 3dc570c5..95550993 100644 --- a/tests/CLIRunner.test.js +++ b/tests/CLIRunner.test.js @@ -36,6 +36,7 @@ import { pathToEIMCLI, INSTALLFOLDER, TOOLSFOLDER, + pathToOfflineArchive, } from "./config.js"; import os from "os"; import path from "path"; @@ -173,7 +174,7 @@ function testRun(jsonScript) { } else if (test.type === "offline") { //routine for offline installation test - const offlineArg = ["--use-local-archive archive.zst"]; + const offlineArg = [`--use-local-archive ${pathToOfflineArchive}`]; const deleteAfterTest = test.deleteAfterTest === undefined ? true : test.deleteAfterTest; diff --git a/tests/config.js b/tests/config.js index 7dabf876..710871dc 100644 --- a/tests/config.js +++ b/tests/config.js @@ -90,6 +90,11 @@ const getEIMPath = (pathFromCI, defaultFolder) => const pathToEIMCLI = getEIMPath(process.env.EIM_CLI_PATH, "eim-cli"); const pathToEIMGUI = getEIMPath(process.env.EIM_GUI_PATH, "eim-gui"); +// DEfault path for the offline archive file +const pathToOfflineArchive = + process.env.EIM_OFFLINE_ARCHIVE || + path.join(os.homedir(), "eim-offline", "archive.zst"); + // Default installation folder const INSTALLFOLDER = os.platform() !== "win32" ? path.join(os.homedir(), `.espressif`) : `C:\\esp`; @@ -112,4 +117,5 @@ export { EIMCLIVersion, INSTALLFOLDER, TOOLSFOLDER, + pathToOfflineArchive, }; From c2248c63e48e86e363d7ed7b53deda22d79491b9 Mon Sep 17 00:00:00 2001 From: Fabricio Ribeiro Date: Tue, 26 Aug 2025 19:00:47 +0100 Subject: [PATCH 4/4] Set python to version 3.11 --- .github/workflows/test_offline.yml | 13 ++++++++++--- tests/CLIRunner.test.js | 14 ++++++-------- tests/GUIRunner.test.js | 6 ++---- tests/config.js | 7 ++++++- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test_offline.yml b/.github/workflows/test_offline.yml index 67559353..89fb4b96 100644 --- a/.github/workflows/test_offline.yml +++ b/.github/workflows/test_offline.yml @@ -18,7 +18,7 @@ on: type: string jobs: - test: + test-offline: name: Offline (${{ matrix.package_name }}) runs-on: ${{ matrix.os }} strategy: @@ -83,15 +83,22 @@ jobs: - name: Install dependencies and node.js (Ubuntu) if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' run: | + sudo add-apt-repository ppa:deadsnakes/ppa -y sudo apt-get update - sudo apt-get install -y git wget flex bison gperf ccache libffi-dev libssl-dev dfu-util libusb-1.0-0-dev libgcrypt20 libglib2.0-0 libpixman-1-0 libsdl2-2.0-0 libslirp0 python3 python3-venv python3-pip + sudo apt-get install -y git wget flex bison gperf ccache libffi-dev libssl-dev dfu-util libusb-1.0-0-dev libgcrypt20 libglib2.0-0 libpixman-1-0 libsdl2-2.0-0 libslirp0 python3.11 python3.11-venv python3-pip + sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 3 + python3 --version cd tests npm ci - name: Install dependencies and node.js (MacOS) if: matrix.os == 'macos-latest' || matrix.os == 'macos-13' run: | - brew install dfu-util libgcrypt glib pixman sdl2 libslirp + brew install dfu-util libgcrypt glib pixman sdl2 libslirp python3 + brew install python@3.11 + rm /opt/homebrew/bin/python3 + ln -s ../Cellar/python@3.11/3.11.13/bin/python3.11 /opt/homebrew/bin/python3 + python3 --version cd tests npm ci diff --git a/tests/CLIRunner.test.js b/tests/CLIRunner.test.js index 95550993..4c382296 100644 --- a/tests/CLIRunner.test.js +++ b/tests/CLIRunner.test.js @@ -37,6 +37,7 @@ import { INSTALLFOLDER, TOOLSFOLDER, pathToOfflineArchive, + offlineIDFVersion, } from "./config.js"; import os from "os"; import path from "path"; @@ -74,8 +75,7 @@ function testRun(jsonScript) { } else if (test.type === "default") { //routine for default installation tests - const deleteAfterTest = - test.deleteAfterTest === undefined ? true : test.deleteAfterTest; + const deleteAfterTest = test.deleteAfterTest ?? true; describe(`Test${test.id} - ${test.name} ->`, function () { this.timeout(6000000); @@ -127,8 +127,7 @@ function testRun(jsonScript) { test.data.nonInteractive && installArgs.push(`-n ${test.data.nonInteractive}`); - const deleteAfterTest = - test.deleteAfterTest === undefined ? true : test.deleteAfterTest; + const deleteAfterTest = test.deleteAfterTest ?? true; describe(`Test${test.id} - ${test.name} ->`, function () { this.timeout(6000000); @@ -174,10 +173,9 @@ function testRun(jsonScript) { } else if (test.type === "offline") { //routine for offline installation test - const offlineArg = [`--use-local-archive ${pathToOfflineArchive}`]; + const offlineArg = [`--use-local-archive "${pathToOfflineArchive}"`]; - const deleteAfterTest = - test.deleteAfterTest === undefined ? true : test.deleteAfterTest; + const deleteAfterTest = test.deleteAfterTest ?? true; describe(`Test${test.id} - ${test.name} ->`, function () { this.timeout(6000000); @@ -186,7 +184,7 @@ function testRun(jsonScript) { runInstallVerification({ installFolder: INSTALLFOLDER, - idfList: [IDFDefaultVersion], + idfList: [offlineIDFVersion], toolsFolder: TOOLSFOLDER, }); diff --git a/tests/GUIRunner.test.js b/tests/GUIRunner.test.js index 672d413d..31daed98 100644 --- a/tests/GUIRunner.test.js +++ b/tests/GUIRunner.test.js @@ -59,8 +59,7 @@ function testRun(script) { } else if (test.type === "default") { //routine for default simplified installation - const deleteAfterTest = - test.deleteAfterTest === undefined ? true : test.deleteAfterTest; + const deleteAfterTest = test.deleteAfterTest ?? true; describe(`Test${test.id} - ${test.name} ->`, function () { runGUISimplifiedInstallTest(test.id, pathToEIMGUI); @@ -93,8 +92,7 @@ function testRun(script) { const IDFMirror = test.data.idfMirror || "github"; - const deleteAfterTest = - test.deleteAfterTest === undefined ? true : test.deleteAfterTest; + const deleteAfterTest = test.deleteAfterTest ?? true; describe(`Test${test.id} - ${test.name} ->`, function () { runGUICustomInstallTest( diff --git a/tests/config.js b/tests/config.js index 710871dc..58fa5a9c 100644 --- a/tests/config.js +++ b/tests/config.js @@ -90,11 +90,15 @@ const getEIMPath = (pathFromCI, defaultFolder) => const pathToEIMCLI = getEIMPath(process.env.EIM_CLI_PATH, "eim-cli"); const pathToEIMGUI = getEIMPath(process.env.EIM_GUI_PATH, "eim-gui"); -// DEfault path for the offline archive file +// Default path for the offline archive file const pathToOfflineArchive = process.env.EIM_OFFLINE_ARCHIVE || path.join(os.homedir(), "eim-offline", "archive.zst"); +// IDF version for the offline archive +const offlineIDFVersion = + process.env.EIM_OFFLINE_IDF_VERSION || IDFDefaultVersion; + // Default installation folder const INSTALLFOLDER = os.platform() !== "win32" ? path.join(os.homedir(), `.espressif`) : `C:\\esp`; @@ -118,4 +122,5 @@ export { INSTALLFOLDER, TOOLSFOLDER, pathToOfflineArchive, + offlineIDFVersion, };