-
Notifications
You must be signed in to change notification settings - Fork 11
145 lines (139 loc) · 4.82 KB
/
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Test
on:
workflow_call:
workflow_dispatch:
pull_request:
branches: ['main']
push:
branches:
- '**'
tags-ignore:
- '**'
jobs:
changes:
name: Calculate changes
runs-on: ubuntu-latest
outputs:
src-esp32: ${{ steps.filter.outputs.src-esp32 }}
src-native: ${{ steps.filter.outputs.src-native }}
src-common: ${{ steps.filter.outputs.src-common }}
src-servers: ${{ steps.filter.outputs.src-servers }}
src-cli: ${{ steps.filter.outputs.src-cli }}
src-ffi: ${{ steps.filter.outputs.src-ffi }}
container:
image: ghcr.io/viamrobotics/micro-rdk-dev-env:amd64
steps:
- name : Checkout main branch code
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check out PR branch code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: path filter
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src-esp32:
- 'micro-rdk/src/esp32/**'
src-common:
- 'micro-rdk/src/common/**'
- 'micro-rdk/src/gen/**'
src-native:
- 'micro-rdk/src/native/**'
src-servers:
- 'micro-rdk-server/**'
src-cli:
- 'micro-rdk-installer/**'
src-ffi:
- 'micro-rdk-ffi/**'
build_cli:
needs: changes
name: Tests, Format, Clippy Micro-RDK installer
if: ${{ needs.changes.outputs.src-cli == 'true'}}
runs-on: ubuntu-latest
container:
image: ghcr.io/viamrobotics/micro-rdk-dev-env:amd64
steps:
- name : Checkout main branch code
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check out PR branch code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- name: Clippy Micro-RDK Installer
run: |
bash -c 'make clippy-cli'
check_ffi:
needs: changes
name: Tests, Format, Clippy Micro-RDK FFI
if: ${{ needs.changes.outputs.src-ffi == 'true'}}
runs-on: ubuntu-latest
container:
image: ghcr.io/viamrobotics/micro-rdk-dev-env:amd64
steps:
- name : Checkout main branch code
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check out PR branch code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- name: Format Micro-RDK FFI
run: |
bash -c 'cargo fmt -p micro-rdk-ffi -- --check'
- name: Clippy Micro-RDK FFI
run: |
bash -c '. /home/testbot/.bash_profile ; git config --global --add safe.directory "$ESP_ROOT"/esp-idf && make clippy-ffi'
test_and_build:
needs: changes
name: Tests, Format, Clippy Micro-Rdk
if : needs.changes.outputs.src-esp32 == 'true' || needs.changes.outputs.src-common == 'true' || needs.changes.outputs.src-native == 'true' || needs.changes.outputs.src-servers == 'true'
runs-on: ubuntu-latest
container:
image: ghcr.io/viamrobotics/micro-rdk-dev-env:amd64
timeout-minutes: 20
steps:
- name : Checkout main branch code
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check out PR branch code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- name: Format
run: |
bash -c 'make format'
- name: Test
if : needs.changes.outputs.src-esp32 == 'true' || needs.changes.outputs.src-common == 'true' || needs.changes.outputs.src-native == 'true'
run: |
bash -c 'make test'
- name: ESP32 Build & Clippy
if : needs.changes.outputs.src-esp32 == 'true' || needs.changes.outputs.src-common == 'true' || needs.changes.outputs.src-servers == 'true'
run: |
bash -c '. /home/testbot/.bash_profile ; git config --global --add safe.directory "$ESP_ROOT"/esp-idf && make clippy-esp32'
bash -c '. /home/testbot/.bash_profile ; cd micro-rdk-server && cd ../ && make build-esp32-bin'
- name: Native Build & Clippy
if : needs.changes.outputs.src-native == 'true' || needs.changes.outputs.src-common == 'true' || needs.changes.outputs.src-servers == 'true'
run: |
bash -c 'make clippy-native'
bash -c 'make build-native'