-
Notifications
You must be signed in to change notification settings - Fork 90
87 lines (77 loc) · 3.03 KB
/
unittests.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
name: "Unittests Core"
#on: [workflow_dispatch, push]
on:
workflow_dispatch:
push:
branches:
- '*'
- '!release_doc'
pull_request:
branches:
- 'develop'
jobs:
build:
runs-on: ubuntu-20.04 #latest
strategy:
fail-fast: false
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
name: Python ${{ matrix.python-version }}
steps:
- name: Setup OS (Ubuntu)
run: |
sudo apt-get update
sudo apt-get install libudev-dev
sudo apt-get install librrd-dev libpython3-dev
sudo apt-get install gcc --only-upgrade
- name: Get branch name
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
id: extract_branch
- name: Workflow Information
run: |
echo github.event_name '${{ github.event_name }}'
echo github.workflow '${{ github.workflow }}'
echo github.action_repository '${{ github.action_repository }}'
echo github.actor '${{ github.actor }}'
echo github.ref_name '${{ github.ref_name }}'
echo github.ref '${{ github.ref }}'
echo github.base_ref '${{ github.base_ref }}'
echo github.head_ref '${{ github.head_ref }}'
echo github.pull_request.base.ref '${{ github.pull_request.base.ref }}'
echo steps.extract_branch.outputs.branch '${{ steps.extract_branch.outputs.branch }}'
- name: Checkout core from branch '${{ github.base_ref }} branch'
uses: actions/checkout@v3
with:
repository: smarthomeNG/smarthome
ref: ${{ github.base_ref }}
- name: Checkout plugins from branch '${{steps.extract_branch.outputs.branch}}' (for push)
if: github.event_name != 'pull_request'
uses: actions/checkout@v3
with:
repository: smarthomeNG/plugins
ref: ${{steps.extract_branch.outputs.branch}}
path: plugins
- name: Checkout plugins from branch 'develop' (for pull request)
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
repository: smarthomeNG/plugins
ref: develop
path: plugins
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- run: python3 -m pip install --upgrade pip
- name: Install requirements for unit testing
run: pip install -r tests/requirements.txt
- name: Build Requirements for SmartHomeNG
run: python3 tools/build_requirements.py
- name: Install SmartHomeNG base requirements
# base requirements are needed for pytest to run
run: pip install -r requirements/base.txt
# --- up to here, the workflow is identical for CORE and PLUGINS ---
- name: '>>> Run Python Unittests for CORE <<<'
working-directory: ./tests
run: pytest