Skip to content

Commit 0caf7ac

Browse files
committed
CI: reusable_test-image: introduce reusable test-image workflow
Introduce reusable test-image workflow. Currently only QEMU is supported. This assume it's run after an artifact is uploaded by other workflow. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
1 parent 69850df commit 0caf7ac

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Test Image
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
target:
7+
required: true
8+
type: string
9+
subtarget:
10+
required: true
11+
type: string
12+
testing:
13+
type: boolean
14+
image:
15+
required: true
16+
type: string
17+
use_qemu:
18+
type: boolean
19+
qemu_target:
20+
type: string
21+
qemu_bin:
22+
type: string
23+
24+
jobs:
25+
test:
26+
name: Test image ${{ inputs.target }}/${{ inputs.subtarget }}
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
with:
33+
repository: aparcar/openwrt-tests
34+
35+
- name: Install dependencies
36+
run: |
37+
sudo apt install python3-pip
38+
39+
- name: Install QEMU dependency
40+
if: inputs.use_qemu == true
41+
run: |
42+
sudo apt install qemu-system-${{ inputs.qemu_target }}
43+
44+
- name: Install test project dependencies
45+
run: |
46+
pip3 install poetry
47+
poetry install
48+
49+
- name: Download compiled images from build job
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: ${{ inputs.target }}-${{ inputs.subtarget }}${{ inputs.testing == true && '-testing' || '' }}-images
53+
54+
- name: Run test with QEMU
55+
if: inputs.use_qemu == true
56+
run: |
57+
export LG_QEMU_BIN=qemu-system-${{ inputs.qemu_bin || inputs.qemu_target }}
58+
59+
poetry run pytest \
60+
--lg-env tests/qemu.yaml \
61+
--target ${{ inputs.target }}-${{ inputs.subtarget }} \
62+
--firmware "$(pwd)"/${{ inputs.image }}
63+

0 commit comments

Comments
 (0)