-
Notifications
You must be signed in to change notification settings - Fork 0
234 lines (205 loc) · 8.94 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: Autotest
on:
workflow_call:
inputs:
run_id:
required: true
type: string
ref:
required: true
type: string
jobs:
test:
name: Automated test scripts
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-latest
package_name: linux-x64
run_on: CNRunner
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 artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- name: Get CLI application version number (non-Windows)
if: runner.os != 'Windows'
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: Fetch latest IDF release
if: runner.os != 'Windows'
run: |
curl -v -s https://dl.espressif.com/dl/esp-idf/idf_versions.json > IDF_latest_release.json
IDF_TAG=$(jq -r .VERSIONS[1].name IDF_latest_release.json)
echo "IDF_TAG=$IDF_TAG" >> $GITHUB_ENV
echo "Latest IDF for default install: $IDF_TAG"
- name: Extract artifact (non-Windows)
if: runner.os != 'Windows'
run: |
mkdir -p test-bin
unzip ./artifacts/eim-${{ inputs.run_id }}-${{ matrix.package_name }}/eim.zip -d test-bin
# unzip ./test-bin/eim.zip -d test-bin
- name: Set executable permissions (non-Windows)
if: runner.os != 'Windows'
run: |
chmod +x ./test-bin/eim
- name: Run prerequisites test script (non-Windows), skip for CNRunner
continue-on-error: true
if: runner.os != 'Windows' && matrix.run_on != 'CNRunner'
run: |
export LOG_TO_FILE="true"
export EIM_FILE_PATH="../test-bin/eim"
export EIM_VERSION="eim ${{ env.CLI_TAG }}"
cd tests
npm ci
npm run pre-test
- name: Install dependencies (Ubuntu)
if: |
runner.os == 'Linux'
run: |
sudo apt-get install -y git cmake ninja-build wget flex bison gperf ccache libffi-dev libssl-dev dfu-util libusb-1.0-0-dev python3 python3-venv python3-pip
- name: Install dependencies (MacOS)
if: |
runner.os == 'macOS'
run: |
brew install cmake ninja dfu-util
- name: Run IDF basic install test script (non-Windows)
continue-on-error: true
if: |
runner.os != 'Windows' &&
matrix.run_on != 'CNRunner'
run: |
export LOG_TO_FILE="true"
export EIM_FILE_PATH="../test-bin/eim"
export EIM_VERSION="eim ${{ env.CLI_TAG }}"
export IDF_VERSION="${{ env.IDF_TAG }}"
cd tests
npm run test --file=basic-test
- name: Run IDF extended install test script (non-Windows)
continue-on-error: true
if: |
runner.os != 'Windows' &&
matrix.run_on != 'CNRunner'
run: |
export LOG_TO_FILE="true"
export EIM_FILE_PATH="../test-bin/eim"
export EIM_VERSION="eim ${{ env.CLI_TAG }}"
export IDF_VERSION="${{ env.IDF_TAG }}"
cd tests
npm run test --file=extended-test
- name: Run IDF installation from alternative mirrors
continue-on-error: true
if: matrix.run_on == 'CNRunner'
run: |
export LOG_TO_FILE="true"
export EIM_FILE_PATH="../test-bin/eim"
export EIM_VERSION="eim ${{ env.CLI_TAG }}"
export IDF_VERSION="${{ env.IDF_TAG }}"
cd tests
npm ci
npm run test --file=mirrors-test
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- name: Get CLI application version number (Windows)
if: runner.os == 'Windows'
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: Fetch latest IDF release
if: runner.os == 'Windows'
run: |
$json = Invoke-RestMethod -Uri "https://dl.espressif.com/dl/esp-idf/idf_versions.json"
$IDF_TAG = $json.VERSIONS[1].name
echo "IDF_TAG=$IDF_TAG" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "Latest IDF for default install: $IDF_TAG"
- name: Extract artifact (Windows)
if: runner.os == 'Windows'
run: |
mkdir -p test-bin
7z x ./artifacts/eim-${{ inputs.run_id }}-${{ matrix.package_name }}/eim.zip -otest-bin
# 7z x ./test-bin/eim.zip -otest-bin
- name: Run prerequisites test script (Windows)
continue-on-error: true
if: runner.os == 'Windows'
run: |
$env:LOG_TO_FILE="true"
$env:EIM_FILE_PATH = "..\test-bin\eim.exe"
$env:EIM_VERSION = "eim ${{ env.CLI_TAG }}"
Set-Location -Path "./tests"
Expand-Archive node_modules.zip
npm run pre-test
npm run pre-install
- name: Install dependencies (Windows)
if: |
runner.os == 'windows'
run: |
choco install ninja -y
- name: Run IDF basic install test script (Windows)
continue-on-error: true
if: |
runner.os == 'Windows'
run: |
$env:LOG_TO_FILE="true"
$env:EIM_FILE_PATH = "..\test-bin\eim.exe"
$env:EIM_VERSION = "eim ${{ env.CLI_TAG }}"
$env:IDF_VERSION = "${{ env.IDF_TAG }}"
Set-Location -Path "./tests"
npm run test-win --file=basic-test
- name: Run IDF extended install test script (Windows)
continue-on-error: true
if: |
runner.os == 'Windows'
run: |
$env:LOG_TO_FILE="true"
$env:EIM_FILE_PATH = "..\test-bin\eim.exe"
$env:EIM_VERSION = "eim ${{ env.CLI_TAG }}"
$env:IDF_VERSION = "${{ env.IDF_TAG }}"
Set-Location -Path "./tests"
npm run test-win --file=extended-test
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.package_name }}-${{matrix.run_on}}.zip
path: |
./tests/results-*.json
./tests/test.log
publish-test-results:
name: Automated Test Results
needs: test
runs-on: ubuntu-latest
if: always()
steps:
- name: Publish Test Results
uses: dorny/test-reporter@v1
with:
artifact: /test-results-(.*)/
name: "Tests $1"
path: "*.json"
reporter: mocha-json
fail-on-empty: "true"