|
| 1 | +name: Autotest Offline |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + ref: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + run_id: |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + |
| 13 | + workflow_dispatch: |
| 14 | + inputs: |
| 15 | + run_id: |
| 16 | + description: "The run id from which to take the offline installer archive" |
| 17 | + required: true |
| 18 | + type: string |
| 19 | + |
| 20 | +jobs: |
| 21 | + test-offline: |
| 22 | + name: Offline (${{ matrix.package_name }}) |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + include: |
| 28 | + - os: ubuntu-latest |
| 29 | + package_name: linux-x64 |
| 30 | + run_on: GitHub |
| 31 | + - os: windows-latest |
| 32 | + package_name: windows-x64 |
| 33 | + run_on: GitHub |
| 34 | + - os: macos-latest |
| 35 | + package_name: macos-aarch64 |
| 36 | + run_on: GitHub |
| 37 | + - os: ubuntu-24.04-arm |
| 38 | + package_name: linux-aarch64 |
| 39 | + run_on: GitHub |
| 40 | + - os: macos-13 |
| 41 | + package_name: macos-x64 |
| 42 | + run_on: GitHub |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout repository |
| 46 | + uses: actions/checkout@v4 |
| 47 | + with: |
| 48 | + ref: ${{ inputs.ref }} |
| 49 | + |
| 50 | + - name: Set up Node.js |
| 51 | + uses: actions/setup-node@v4 |
| 52 | + with: |
| 53 | + node-version: "20" |
| 54 | + |
| 55 | + - name: Download Archive |
| 56 | + uses: actions/download-artifact@v5 |
| 57 | + with: |
| 58 | + pattern: offline_installer-${{ matrix.package_name }}-* |
| 59 | + merge-multiple: true |
| 60 | + path: ./artifacts |
| 61 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + run-id: ${{ inputs.run_id }} |
| 63 | + |
| 64 | + # Non-Windows steps |
| 65 | + |
| 66 | + - name: Get CLI application version number (non-Windows) |
| 67 | + if: matrix.os != 'windows-latest' |
| 68 | + run: | |
| 69 | + git fetch --tags |
| 70 | + LATEST_TAG=$(git tag --sort=-creatordate | head -n 1) |
| 71 | + STRIPPED_TAG=${LATEST_TAG#v} |
| 72 | + echo "CLI_TAG=$STRIPPED_TAG" >> $GITHUB_ENV |
| 73 | +
|
| 74 | + - name: Make EIM executable (non-Windows) |
| 75 | + if: matrix.os != 'windows-latest' |
| 76 | + run: | |
| 77 | + ls -la ./artifacts/ |
| 78 | + unzip ./artifacts/offline_installer*.zip -d ./artifacts/ |
| 79 | + mv ./artifacts/archive_v*.zst ./artifacts/archive.zst |
| 80 | + ls -la ./artifacts/ |
| 81 | + chmod +x artifacts/eim |
| 82 | +
|
| 83 | + - name: Install dependencies and node.js (Ubuntu) |
| 84 | + if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' |
| 85 | + run: | |
| 86 | + sudo add-apt-repository ppa:deadsnakes/ppa -y |
| 87 | + sudo apt-get update |
| 88 | + 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 |
| 89 | + sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 3 |
| 90 | + python3 --version |
| 91 | + cd tests |
| 92 | + npm ci |
| 93 | +
|
| 94 | + - name: Install dependencies and node.js (MacOS) |
| 95 | + if: matrix.os == 'macos-latest' || matrix.os == 'macos-13' |
| 96 | + run: | |
| 97 | + brew install dfu-util libgcrypt glib pixman sdl2 libslirp python3 |
| 98 | + |
| 99 | + rm /opt/homebrew/bin/python3 |
| 100 | + ln -s ../Cellar/[email protected]/3.11.13/bin/python3.11 /opt/homebrew/bin/python3 |
| 101 | + python3 --version |
| 102 | + cd tests |
| 103 | + npm ci |
| 104 | +
|
| 105 | + - name: Run IDF offline installation (non-Windows) |
| 106 | + if: matrix.os != 'windows-latest' |
| 107 | + run: | |
| 108 | + export HTTP_PROXY="http://127.0.0.1:9" |
| 109 | + export HTTPS_PROXY="http://127.0.0.1:9" |
| 110 | + export NO_PROXY="localhost,127.0.0.1" |
| 111 | + export LOG_TO_FILE="true" |
| 112 | + export EIM_CLI_PATH="../artifacts/eim" |
| 113 | + export EIM_OFFLINE_ARCHIVE="../artifacts/archive.zst" |
| 114 | + export EIM_CLI_VERSION="eim ${{ env.CLI_TAG }}" |
| 115 | + cd tests |
| 116 | + npm run test-CLI --file=CLI-offline |
| 117 | + unset HTTP_PROXY HTTPS_PROXY NO_PROXY |
| 118 | + continue-on-error: true |
| 119 | + |
| 120 | + # Windows steps |
| 121 | + |
| 122 | + - name: Get CLI application version number (Windows) |
| 123 | + if: matrix.os == 'windows-latest' |
| 124 | + run: | |
| 125 | + git fetch --tags |
| 126 | + $LATEST_TAG = (git tag --sort=-creatordate | Select-Object -First 1) |
| 127 | + $STRIPPED_TAG = $LATEST_TAG -replace '^v', '' |
| 128 | + echo "CLI_TAG=$STRIPPED_TAG" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 129 | +
|
| 130 | + - name: Check artifact (Windows) |
| 131 | + if: matrix.os == 'windows-latest' |
| 132 | + run: | |
| 133 | + ls ./artifacts/ |
| 134 | + Expand-Archive ./artifacts/offline_installer*.zip -DestinationPath ./artifacts/ |
| 135 | + Move-Item "./artifacts/archive_v*.zst" "artifacts/archive.zst" |
| 136 | + ls ./artifacts/ |
| 137 | +
|
| 138 | + - name: Run IDF offline installation (Windows) |
| 139 | + if: matrix.os == 'windows-latest' |
| 140 | + run: | |
| 141 | + $env:HTTP_PROXY = 'http://127.0.0.1:9' |
| 142 | + $env:HTTPS_PROXY = 'http://127.0.0.1:9' |
| 143 | + $env:NO_PROXY = 'localhost,127.0.0.1' |
| 144 | + $env:LOG_TO_FILE="true" |
| 145 | + $env:EIM_CLI_PATH = "..\artifacts\eim.exe" |
| 146 | + $env:EIM_OFFLINE_ARCHIVE = "..\artifacts\archive.zst" |
| 147 | + $env:EIM_CLI_VERSION = "eim ${{ env.CLI_TAG }}" |
| 148 | + Set-Location -Path "./tests" |
| 149 | + Expand-Archive node_modules.zip |
| 150 | + npm run test-CLI-win --file=CLI-offline |
| 151 | + Remove-Item Env:HTTP_PROXY, Env:HTTPS_PROXY, Env:NO_PROXY -ErrorAction SilentlyContinue |
| 152 | + continue-on-error: true |
| 153 | + |
| 154 | + # Copy eim log files to standard location for easier access |
| 155 | + - name: Copy EIM Log files (ubuntu) |
| 156 | + if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' |
| 157 | + run: | |
| 158 | + cp ~/.local/share/eim/logs/*.log ./tests/ |
| 159 | + continue-on-error: true |
| 160 | + |
| 161 | + - name: Copy EIM Log files (MacOS) |
| 162 | + if: matrix.os == 'macos-latest' || matrix.os == 'macos-13' |
| 163 | + run: | |
| 164 | + cp ~/Library/Application\ Support/eim/logs/*.log ./tests/ |
| 165 | + continue-on-error: true |
| 166 | + |
| 167 | + - name: Copy EIM Log files (Windows) |
| 168 | + if: matrix.os == 'windows-latest' |
| 169 | + run: | |
| 170 | + Move-Item -Path "$env:LOCALAPPDATA\eim\logs\*" -Destination ".\tests\" -Force |
| 171 | + continue-on-error: true |
| 172 | + |
| 173 | + # Upload test results |
| 174 | + - name: Upload test results (non-windows) |
| 175 | + uses: actions/upload-artifact@v4 |
| 176 | + if: matrix.os != 'windows-latest' |
| 177 | + with: |
| 178 | + name: autotest-CLI-Offline-results-${{ matrix.package_name }} |
| 179 | + path: | |
| 180 | + ./tests/results-*.json |
| 181 | + ./tests/*.log |
| 182 | +
|
| 183 | + - name: Upload test results (windows) |
| 184 | + uses: actions/upload-artifact@v4 |
| 185 | + if: matrix.os == 'windows-latest' |
| 186 | + with: |
| 187 | + name: autotest-CLI-Offline-results-${{ matrix.package_name }} |
| 188 | + path: | |
| 189 | + ./tests/results-*.json |
| 190 | + ./tests/*.log |
| 191 | +
|
| 192 | + # Publish test results |
| 193 | + - name: Publish Test Results |
| 194 | + uses: dorny/test-reporter@v2 |
| 195 | + if: always() |
| 196 | + with: |
| 197 | + name: CLI-Offline-Autotests-${{ matrix.package_name }} |
| 198 | + path: ./tests/results-*.json |
| 199 | + path-replace-backslashes: "false" |
| 200 | + reporter: mocha-json |
| 201 | + fail-on-empty: true |
0 commit comments