Autotest Offline #33
This file contains hidden or 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: Autotest Offline | |
| on: | |
| workflow_call: | |
| inputs: | |
| ref: | |
| required: true | |
| type: string | |
| run_id: | |
| required: true | |
| type: string | |
| eim_cli_run_id: | |
| required: false | |
| type: string | |
| default: "release" | |
| workflow_dispatch: | |
| inputs: | |
| run_id: | |
| description: "The run id from which to take the offline installer archive" | |
| required: true | |
| type: string | |
| eim_cli_run_id: | |
| description: "The run id from which to take the eim-cli binary - Use 'release' to take from latest release" | |
| required: false | |
| type: string | |
| default: "release" | |
| jobs: | |
| test-offline: | |
| name: Offline Installation (${{ matrix.package_name }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| package_name: linux-x64 | |
| run_on: GitHub | |
| - os: ubuntu-24.04-arm | |
| package_name: linux-aarch64 | |
| run_on: GitHub | |
| - os: windows-latest | |
| package_name: windows-x64 | |
| run_on: GitHub | |
| - os: macos-latest | |
| package_name: macos-aarch64 | |
| run_on: GitHub | |
| - os: macos-15-intel | |
| package_name: macos-x64 | |
| run_on: GitHub | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.ref || github.ref }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Set up Python | |
| uses: actions/[email protected] | |
| with: | |
| python-version: "3.12.9" | |
| - name: Download Build Info files | |
| uses: actions/download-artifact@v5 | |
| with: | |
| pattern: build-info-*-${{ matrix.package_name }} | |
| path: ./artifacts | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ inputs.run_id }} | |
| - name: Download EIM-CLI artifacts from another run id | |
| uses: actions/download-artifact@v4 | |
| if: inputs.eim_cli_run_id != 'release' | |
| with: | |
| pattern: eim-cli-${{ matrix.package_name }}-* | |
| path: ./artifacts | |
| merge-multiple: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ inputs.eim_cli_run_id }} | |
| # Non-Windows steps | |
| - name: Download latest EIM CLI binary (non-Windows) | |
| if: matrix.os != 'windows-latest' && inputs.eim_cli_run_id == 'release' | |
| run: | | |
| latest_release=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/espressif/idf-im-ui/releases/latest) | |
| eim_cli_url=$(echo "$latest_release" | jq -r '.assets[] | select(.name | test("eim-cli-${{matrix.package_name}}.zip")) | .browser_download_url') | |
| curl -L -o ./artifacts/eim-cli.zip "$eim_cli_url" | |
| ls -la ./artifacts/ | |
| unzip ./artifacts/eim-cli.zip -d ./artifacts/ | |
| - name: Check artifact and make it executable (non-Windows) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| ls -la ./artifacts/ | |
| 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 | |
| cd tests | |
| npm ci | |
| - name: Install dependencies and node.js (MacOS) | |
| if: matrix.os == 'macos-latest' || matrix.os == 'macos-15-intel' | |
| 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: | | |
| python3 --version | |
| SETUP_PYTHON=$(which python3) | |
| echo "Setup python is at: $SETUP_PYTHON" | |
| mkdir -p $HOME/.local/bin | |
| ln -sf $SETUP_PYTHON $HOME/.local/bin/python3 | |
| export PATH="$HOME/.local/bin:$PATH" | |
| python3 --version | |
| which python3 | |
| export LOG_TO_FILE="true" | |
| export EIM_CLI_PATH="../artifacts/eim" | |
| export BUILD_INFO_PATH="../artifacts" | |
| cd tests | |
| npm run test-offline | |
| continue-on-error: true | |
| # Windows steps | |
| - name: Download latest EIM CLI binary (Windows) | |
| if: matrix.os == 'windows-latest' && inputs.eim_cli_run_id == 'release' | |
| run: | | |
| $latest_release = Invoke-RestMethod -Uri "https://api.github.com/repos/espressif/idf-im-ui/releases/latest" | |
| $eim_cli_url = $latest_release.assets | Where-Object { $_.name -like "eim-cli-${{ matrix.package_name }}.exe" } | Select-Object -ExpandProperty browser_download_url | |
| Invoke-WebRequest -Uri $eim_cli_url -OutFile ".\artifacts\eim.exe" | |
| ls ./artifacts/ | |
| - name: Run IDF offline installation (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| python3 --version | |
| $env:LOG_TO_FILE="true" | |
| $env:EIM_CLI_PATH = "..\artifacts\eim.exe" | |
| $env:BUILD_INFO_PATH = "..\artifacts" | |
| Set-Location -Path "./tests" | |
| Expand-Archive node_modules.zip | |
| npm run test-offline | |
| 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/ | |
| continue-on-error: true | |
| - name: Copy EIM Log files (MacOS) | |
| if: matrix.os == 'macos-latest' || matrix.os == 'macos-15-intel' | |
| 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) | |
| 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 |