-
Notifications
You must be signed in to change notification settings - Fork 15
83 lines (73 loc) · 2.18 KB
/
github-actions-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
name: 'scos-sensor test'
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
run-scos-sensor-tests:
name: Test / Py ${{ matrix.py }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
py:
- "3.8"
- "3.9"
- "3.10"
steps:
- name: Set up Python ${{ matrix.py }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py }}
- name: Checkout scos-sensor
uses: actions/checkout@v3
- name: Install tox-gh
run: python -m pip install tox-gh
- name: Set up test suite
run: tox r --notest -c ./src/tox.ini -e coverage
- name: Run test suite
run: tox r -c ./src/tox.ini -e coverage
env:
PYTEST_ADDOPTS: "-vv --durations=0"
AUTHENTICATION: TOKEN
CALLBACK_AUTHENTICATION: TOKEN
SWITCH_CONFIGS_DIR: ../configs/switches
run-scos-sensor-docker:
name: Run SCOS Sensor / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create localhost certs
working-directory: ./scripts
run: sh create_localhost_cert.sh
- name: Create fake USB device # Required by API container
run : |
sudo mkdir -p /dev/bus/usb/001
sudo mknod /dev/bus/usb/001/001 c 189 260
- name: Create fake SSD device # Required by API container
run: |
sudo mknod /dev/nvme0n1 b 259 0
- name: Build and run Docker containers
run: |
source ./env.template
export MOCK_SIGAN=1
export MOCK_SIGAN_RANDOM=1
docker-compose build --no-cache
docker-compose up -d
- name: Wait for containers # wait for containers to finish starting
run: sleep 45
- name: Check API container
run: docker ps | grep api | grep -q healthy