-
-
Notifications
You must be signed in to change notification settings - Fork 254
83 lines (79 loc) · 2.76 KB
/
bats-action.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: BATS
on:
push:
paths:
- 'tests/Dockerfile.*-BATS'
- 'functions/*.bats'
- 'functions/*.bash'
- '!functions/wifi.bash'
- '!functions/system.bash'
- '!functions/openhab.bash'
- '!functions/openhabian.bash'
- '!functions/menu.bash'
- '!functions/find.bash'
- '!functions/ext-storage.bash'
- '!functions/config.bash'
- '!functions/backup.bash'
- '!functions/auth.bash'
- '.github/workflows/bats-action.yml'
pull_request:
paths:
- 'tests/Dockerfile.*-BATS'
- 'functions/*.bats'
- 'functions/*.bash'
- '!functions/wifi.bash'
- '!functions/system.bash'
- '!functions/openhab.bash'
- '!functions/openhabian.bash'
- '!functions/menu.bash'
- '!functions/find.bash'
- '!functions/ext-storage.bash'
- '!functions/config.bash'
- '!functions/backup.bash'
- '!functions/auth.bash'
- '.github/workflows/bats-action.yml'
jobs:
bats-tests:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
strategy:
matrix:
platform: [rpi4, amd64]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: sudo -E ./tests/ci-setup.bash github
- name: Set up QEMU
if: ${{ matrix.platform == 'rpi4' }}
uses: docker/[email protected]
with:
platforms: arm64
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
with:
driver-opts: network=host
- name: Build Docker image
uses: docker/[email protected]
with:
context: .
file: ./tests/Dockerfile.${{ matrix.platform }}-BATS
builder: ${{ steps.buildx.outputs.name }}
tags: localhost:5000/openhabian/${{ matrix.platform }}-openhabian:latest
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
- name: BATS tests on ${{ matrix.platform }} platform
run: |
docker run --rm --name "openhabian-${{ matrix.platform }}" -d localhost:5000/openhabian/${{ matrix.platform }}-openhabian
docker exec -i "openhabian-${{ matrix.platform }}" bash -c 'bats --tap --recursive --filter "development-." .'
docker exec -i "openhabian-${{ matrix.platform }}" bash -c 'bats --tap --recursive --filter "unit-." .'
docker exec -i "openhabian-${{ matrix.platform }}" bash -c 'bats --tap --recursive --filter "installation-." .'
docker exec -i "openhabian-${{ matrix.platform }}" bash -c 'bats --tap --recursive --filter "destructive-." .'
docker stop "openhabian-${{ matrix.platform }}"
shell: bash