forked from home-assistant/operating-system
-
-
Notifications
You must be signed in to change notification settings - Fork 6
98 lines (83 loc) · 2.64 KB
/
test.yaml
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
name: Test HAOS image
run-name: "Test HAOS ${{ inputs.version || format('(OS build #{0})', github.event.workflow_run.run_number) }}"
on:
# Manual test of specified version
workflow_dispatch:
inputs:
version:
description: Version of HAOS to test
required: true
type: string
# Called by other workflows (e.g. build.yaml)
workflow_call:
inputs:
use-artifact:
# Workaround for GH weirdness: https://github.com/actions/runner/discussions/1884
description: Download OS image using actions/download-artifact
required: false
type: boolean
default: true
version:
description: Version of HAOS to test (as used in the name of the qcow2 image artifact)
required: true
type: string
jobs:
test:
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
env:
NO_KVM: 1
name: Test in QEMU
runs-on: ubuntu-22.04
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install system dependencies
run: |
sudo apt update
sudo apt install -y qemu-system-x86 ovmf
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install Python requirements
run:
pip install -r tests/requirements.txt
- name: Download HAOS image
if: ${{ !inputs.use-artifact }}
run: |
curl -sfL -o haos.qcow2.xz https://os-artifacts.home-assistant.io/${{github.event.inputs.version}}/haos_ova-${{github.event.inputs.version}}.qcow2.xz
- name: Get OS image artifact
if: ${{ inputs.use-artifact }}
uses: actions/download-artifact@v4
with:
name: haos_ova-${{ inputs.version }}.qcow2.xz
- name: Extract OS image
run: |
xz -dc haos*.qcow2.xz > tests/haos.qcow2
rm haos*.qcow2.xz
- name: Run tests
run: |
./tests/run_tests.sh
- name: Archive logs
uses: actions/upload-artifact@v4
if: always()
with:
name: logs
path: |
tests/lg_logs/**
- name: Archive JUnit reports
uses: actions/upload-artifact@v4
if: always()
with:
name: junit_reports
path: |
tests/junit_reports/*.xml
- name: Publish test report
uses: mikepenz/action-junit-report@v4
if: always()
with:
report_paths: 'tests/junit_reports/*.xml'
annotate_only: true
detailed_summary: true