-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (52 loc) · 1.57 KB
/
BrokerTest.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
name: Test Broker
on:
workflow_dispatch:
workflow_call:
push:
env:
PYTHON_VERSION: 3.11
jobs:
discover:
name: Discover Microservices
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.find_tests.outputs.matrix }}
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Find testable apps
id: find_tests
run: |
# Find application directories containing a 'tests' subdirectory nd format the result as JSON
test_dirs=$(find broker/cloud_functions -type d -name "tests" -exec dirname {} \; | jq -R . | jq -s . | tr -d '\n')
echo "found $test_dirs"
echo "matrix={\"app_dir\":$test_dirs}" >> $GITHUB_OUTPUT
test:
name: Test Microservices
runs-on: ubuntu-latest
needs: [ discover ]
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.discover.outputs.matrix) }}
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
pip install coverage
pip install -r ${{ matrix.app_dir }}/requirements.txt
- name: Test ${{ matrix.app_dir }} app
run: coverage run -m unittest discover ${{ matrix.app_dir }}
report-status:
name: Report Test Status
if: always()
needs: [ test ]
runs-on: ubuntu-latest
steps:
- name: Check build status
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1