Skip to content

Commit ab1fe80

Browse files
authored
[EIM-282] [Test] Create autotest for offline installation (#186)
Add offline install test Fix workflow call variables to use run_id
1 parent fc0b0cf commit ab1fe80

File tree

9 files changed

+310
-25
lines changed

9 files changed

+310
-25
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ jobs:
440440
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'
441441
uses: ./.github/workflows/build_offline_installer_archives.yaml
442442
with:
443-
run_number: ${{ github.run_number }}
444443
ref: ${{ github.event.pull_request.head.ref || github.ref }}
444+
run_id: ${{ github.run_id }}
445445

446446
build-gui:
447447
name: Build GUI (${{ matrix.package_name }})
@@ -736,15 +736,15 @@ jobs:
736736
if: needs.build-cli.result == 'success' && needs.build-cli-linux.result == 'success'
737737
uses: ./.github/workflows/test_cli.yml
738738
with:
739-
run_number: ${{ github.run_number }}
739+
run_id: ${{ github.run_id }}
740740
ref: ${{ github.event.pull_request.head.ref || github.ref }}
741741

742742
Autotest-GUI:
743743
needs: [build-gui]
744744
if: needs.build-gui.result == 'success'
745745
uses: ./.github/workflows/test_gui.yml
746746
with:
747-
run_number: ${{ github.run_number }}
747+
run_id: ${{ github.run_id }}
748748
ref: ${{ github.event.pull_request.head.ref || github.ref }}
749749

750750
update-release-info:

.github/workflows/build_offline_installer_archives.yaml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ name: Build Offline Installer Archives
33
on:
44
workflow_call:
55
inputs:
6-
run_number:
6+
ref:
77
required: true
88
type: string
9-
ref:
9+
run_id:
1010
required: true
1111
type: string
12+
1213
workflow_dispatch:
1314
inputs:
14-
run_number:
15-
description: 'The run number from which to take binaries'
15+
run_id:
16+
description: "The run id from which to take binaries"
1617
required: true
1718
type: string
1819

@@ -37,16 +38,22 @@ jobs:
3738
package_name: macos-x64
3839
steps:
3940
- name: Download offline_installer_builder artifact
40-
uses: actions/download-artifact@v4
41+
uses: actions/download-artifact@v5
4142
with:
42-
name: offline_installer_builder-${{ matrix.package_name }}-${{ github.run_number }}
43+
pattern: offline_installer_builder-${{ matrix.package_name }}-*
44+
merge-multiple: true
4345
path: ./
46+
github-token: ${{ secrets.GITHUB_TOKEN }}
47+
run-id: ${{ inputs.run_id || github.run_id }}
4448

4549
- name: Download eim artifact
4650
uses: actions/download-artifact@v4
4751
with:
48-
name: eim-cli-${{ matrix.package_name }}-${{ github.run_number }}
52+
pattern: eim-cli-${{ matrix.package_name }}-*
53+
merge-multiple: true
4954
path: ./
55+
github-token: ${{ secrets.GITHUB_TOKEN }}
56+
run-id: ${{ inputs.run_id || github.run_id }}
5057

5158
- name: Make binary executable (Unix)
5259
if: runner.os != 'Windows'
@@ -115,3 +122,11 @@ jobs:
115122
asset_path: offline_installer-${{ matrix.package_name }}-${{ env.VERSION }}.zip
116123
asset_name: offline_installer-${{ matrix.package_name }}-${{ env.VERSION }}.zip
117124
asset_content_type: application/zip
125+
126+
Autotest-CLI-Offline:
127+
needs: [build-offline-archives]
128+
if: needs.build-offline-archives.result == 'success'
129+
uses: ./.github/workflows/test_offline.yml
130+
with:
131+
ref: ${{ inputs.ref || github.ref }}
132+
run_id: ${{ github.run_id }}

.github/workflows/test_cli.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1-
name: Autotest
1+
name: Autotest CLI
22

33
on:
44
workflow_call:
55
inputs:
6-
run_number:
6+
run_id:
77
required: true
88
type: string
99
ref:
1010
required: true
1111
type: string
1212

13+
workflow_dispatch:
14+
inputs:
15+
run_id:
16+
description: "The run id from which to take binaries"
17+
required: true
18+
type: string
19+
1320
jobs:
1421
test:
1522
name: CLI (${{ matrix.package_name }}${{ matrix.run_on == 'MirrorRunner' && '-AlternateMirrors' || '' }}${{contains(github.event.pull_request.labels.*.name, 'CNRUNNER') && '-CN' || '' }})
@@ -51,8 +58,11 @@ jobs:
5158
- name: Download artifacts
5259
uses: actions/download-artifact@v4
5360
with:
54-
name: eim-cli-${{ matrix.package_name }}-${{ inputs.run_number }}
61+
pattern: eim-cli-${{ matrix.package_name }}-*
5562
path: ./artifacts
63+
merge-multiple: true
64+
github-token: ${{ secrets.GITHUB_TOKEN }}
65+
run-id: ${{ inputs.run_id }}
5666

5767
# Non-Windows steps
5868

.github/workflows/test_gui.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@ name: Autotest GUI
33
on:
44
workflow_call:
55
inputs:
6-
run_number:
6+
run_id:
77
required: true
88
type: string
99
ref:
1010
required: true
1111
type: string
1212

13+
workflow_dispatch:
14+
inputs:
15+
run_id:
16+
description: "The run id from which to take binaries"
17+
required: true
18+
type: string
19+
1320
jobs:
1421
test-cli-in-gui:
1522
name: CLI in GUI (${{ matrix.package_name }})
@@ -48,8 +55,11 @@ jobs:
4855
- name: Download artifacts
4956
uses: actions/download-artifact@v4
5057
with:
51-
name: eim-gui-${{ matrix.package_name }}-${{ inputs.run_number }}
58+
pattern: eim-gui-${{ matrix.package_name }}-*
5259
path: ./artifacts
60+
merge-multiple: true
61+
github-token: ${{ secrets.GITHUB_TOKEN }}
62+
run-id: ${{ inputs.run_id }}
5363

5464
# Non-Windows steps
5565

@@ -214,8 +224,11 @@ jobs:
214224
- name: Download artifacts
215225
uses: actions/download-artifact@v4
216226
with:
217-
name: eim-gui-${{ matrix.package_name }}-${{ inputs.run_number }}
227+
pattern: eim-gui-${{ matrix.package_name }}-*
218228
path: ./artifacts
229+
merge-multiple: true
230+
github-token: ${{ secrets.GITHUB_TOKEN }}
231+
run-id: ${{ inputs.run_id }}
219232

220233
# Non-Windows steps
221234

.github/workflows/test_offline.yml

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
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+
brew install [email protected]
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

Comments
 (0)