Skip to content

Commit 382ba77

Browse files
authored
Merge pull request #616 from Cypherock/fix/ci
CI fix
2 parents 677e961 + 90ddce5 commit 382ba77

File tree

1 file changed

+152
-142
lines changed

1 file changed

+152
-142
lines changed

.github/workflows/ci-tests.yml

Lines changed: 152 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -7,80 +7,80 @@ on:
77
- develop
88
pull_request:
99
branches:
10-
- '**'
10+
- "**"
1111

1212
jobs:
1313
check-commit-msg:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 0
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
1919

20-
- name: Validate PR commits
21-
if: github.event_name == 'pull_request'
22-
run: bash ./utilities/ci/test-commit-msg.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
20+
- name: Validate PR commits
21+
if: github.event_name == 'pull_request'
22+
run: bash ./utilities/ci/test-commit-msg.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
2323

2424
check-format:
2525
runs-on: ubuntu-latest
2626
steps:
27-
- uses: actions/checkout@v3
28-
with:
29-
fetch-depth: 0
30-
31-
- name: Restore clang-tools
32-
id: cache-clang-tools
33-
uses: actions/cache@v3
34-
with:
35-
path: clang-tools
36-
key: clang-tools
37-
38-
- name: Check formatting
39-
env:
40-
CACHED: ${{ steps.cache-clang-tools.outputs.cache-hit }}
41-
SHA_BASE: ${{ github.event.pull_request.base.sha }}
42-
run: |
43-
if [ ! "${CACHED}" = "true" ]; then
44-
bash ./utilities/ci/setup-clang-tools.sh;
45-
fi
46-
PATH="$PATH:$(pwd)/clang-tools"
47-
# Check event type here so ci chaching can take effect
48-
if [ ${{ github.event_name }} = 'pull_request' ]; then
49-
bash ./utilities/ci/format-checker.sh ${SHA_BASE}
50-
fi
27+
- uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Restore clang-tools
32+
id: cache-clang-tools
33+
uses: actions/cache@v3
34+
with:
35+
path: clang-tools
36+
key: clang-tools
37+
38+
- name: Check formatting
39+
env:
40+
CACHED: ${{ steps.cache-clang-tools.outputs.cache-hit }}
41+
SHA_BASE: ${{ github.event.pull_request.base.sha }}
42+
run: |
43+
if [ ! "${CACHED}" = "true" ]; then
44+
bash ./utilities/ci/setup-clang-tools.sh;
45+
fi
46+
PATH="$PATH:$(pwd)/clang-tools"
47+
# Check event type here so ci chaching can take effect
48+
if [ ${{ github.event_name }} = 'pull_request' ]; then
49+
bash ./utilities/ci/format-checker.sh ${SHA_BASE}
50+
fi
5151
5252
static-checks:
5353
runs-on: ubuntu-latest
5454
steps:
55-
- uses: actions/checkout@v3
56-
with:
57-
fetch-depth: 0
58-
59-
- name: Restore clang-tools
60-
id: cache-clang-tools
61-
uses: actions/cache@v3
62-
with:
63-
path: clang-tools
64-
key: clang-tools
65-
66-
- name: Check formatting
67-
env:
68-
CACHED: ${{ steps.cache-clang-tools.outputs.cache-hit }}
69-
SHA_BASE: ${{ github.event.pull_request.base.sha }}
70-
run: |
71-
if [ ! "${CACHED}" = "true" ]; then
72-
bash ./utilities/ci/setup-clang-tools.sh;
73-
fi
74-
PATH="$PATH:$(pwd)/clang-tools"
75-
# Check event type here so ci chaching can take effect
76-
if [ ${{ github.event_name }} = 'pull_request' ]; then
77-
bash ./utilities/ci/static-analyzer.sh ${SHA_BASE}
78-
fi
79-
- name: Upload result
80-
uses: actions/upload-artifact@v3
81-
with:
82-
name: clang-tidy-result
83-
path: anaylysis.results
55+
- uses: actions/checkout@v3
56+
with:
57+
fetch-depth: 0
58+
59+
- name: Restore clang-tools
60+
id: cache-clang-tools
61+
uses: actions/cache@v3
62+
with:
63+
path: clang-tools
64+
key: clang-tools
65+
66+
- name: Check formatting
67+
env:
68+
CACHED: ${{ steps.cache-clang-tools.outputs.cache-hit }}
69+
SHA_BASE: ${{ github.event.pull_request.base.sha }}
70+
run: |
71+
if [ ! "${CACHED}" = "true" ]; then
72+
bash ./utilities/ci/setup-clang-tools.sh;
73+
fi
74+
PATH="$PATH:$(pwd)/clang-tools"
75+
# Check event type here so ci chaching can take effect
76+
if [ ${{ github.event_name }} = 'pull_request' ]; then
77+
bash ./utilities/ci/static-analyzer.sh ${SHA_BASE}
78+
fi
79+
- name: Upload result
80+
uses: actions/upload-artifact@v3
81+
with:
82+
name: clang-tidy-result
83+
path: anaylysis.results
8484

8585
build-firmwares:
8686
needs: check-format
@@ -93,60 +93,65 @@ jobs:
9393
runs-on: ubuntu-latest
9494

9595
steps:
96-
- uses: actions/checkout@v3
97-
with:
98-
submodules: recursive
99-
100-
- name: Restore build-tools
101-
id: cache-build-tools
102-
uses: actions/cache@v3
103-
with:
104-
path: build-tools
105-
key: build-tools
106-
107-
- name: Restore arm-gcc
108-
if: matrix.platform == 'device'
109-
id: cache-arm-gcc
110-
uses: actions/cache@v3
111-
with:
112-
path: arm-gcc
113-
key: arm-gcc
114-
115-
- name: Restore proto-tools
116-
id: cache-proto-tools
117-
uses: actions/cache@v3
118-
with:
119-
path: proto-tools
120-
key: proto-tools
121-
122-
- name: Install target dependencies
123-
if: matrix.platform == 'device'
124-
env:
125-
CACHED: ${{ steps.cache-arm-gcc.outputs.cache-hit }}
126-
PROTO_CACHED: ${{ steps.cache-proto-tools.outputs.cache-hit }}
127-
run: |
128-
if [ ! "${CACHED}" = "true" ]; then
129-
bash ./utilities/ci/setup-arm-gcc.sh;
130-
fi
131-
if [ ! "${PROTO_CACHED}" = "true" ]; then
132-
bash ./utilities/ci/setup-protoc.sh;
133-
fi
134-
pip install -r utilities/script/requirements.txt
135-
136-
- name: Install simulator dependencies
137-
if: matrix.platform == 'simulator'
138-
run: sudo apt update && sudo apt install libsdl2-dev --no-install-recommends -y
139-
140-
- name: Build binaries
141-
env:
142-
CACHED: ${{ steps.cache-build-tools.outputs.cache-hit }}
143-
run: |
144-
if [ ! "${CACHED}" = "true" ]; then
145-
bash ./utilities/ci/setup-build-tools.sh;
146-
fi
147-
pip install -r vendor/nanopb/extra/requirements.txt
148-
PATH="$PATH:$(pwd)/build-tools:$(pwd)/arm-gcc/bin:$(pwd)/proto-tools/bin"
149-
./utilities/build.sh -u -f ${{ matrix.firmware }} -t ${{ matrix.target }} -p ${{ matrix.platform }}
96+
- uses: actions/checkout@v3
97+
with:
98+
submodules: recursive
99+
100+
- uses: actions/setup-python@v5
101+
with:
102+
python-version: "3.9"
103+
cache: "pip"
104+
105+
- name: Restore build-tools
106+
id: cache-build-tools
107+
uses: actions/cache@v3
108+
with:
109+
path: build-tools
110+
key: build-tools
111+
112+
- name: Restore arm-gcc
113+
if: matrix.platform == 'device'
114+
id: cache-arm-gcc
115+
uses: actions/cache@v3
116+
with:
117+
path: arm-gcc
118+
key: arm-gcc
119+
120+
- name: Restore proto-tools
121+
id: cache-proto-tools
122+
uses: actions/cache@v3
123+
with:
124+
path: proto-tools
125+
key: proto-tools
126+
127+
- name: Install target dependencies
128+
if: matrix.platform == 'device'
129+
env:
130+
CACHED: ${{ steps.cache-arm-gcc.outputs.cache-hit }}
131+
PROTO_CACHED: ${{ steps.cache-proto-tools.outputs.cache-hit }}
132+
run: |
133+
if [ ! "${CACHED}" = "true" ]; then
134+
bash ./utilities/ci/setup-arm-gcc.sh;
135+
fi
136+
if [ ! "${PROTO_CACHED}" = "true" ]; then
137+
bash ./utilities/ci/setup-protoc.sh;
138+
fi
139+
pip install -r utilities/script/requirements.txt
140+
141+
- name: Install simulator dependencies
142+
if: matrix.platform == 'simulator'
143+
run: sudo apt update && sudo apt install libsdl2-dev --no-install-recommends -y
144+
145+
- name: Build binaries
146+
env:
147+
CACHED: ${{ steps.cache-build-tools.outputs.cache-hit }}
148+
run: |
149+
if [ ! "${CACHED}" = "true" ]; then
150+
bash ./utilities/ci/setup-build-tools.sh;
151+
fi
152+
pip install -r vendor/nanopb/extra/requirements.txt
153+
PATH="$PATH:$(pwd)/build-tools:$(pwd)/arm-gcc/bin:$(pwd)/proto-tools/bin"
154+
./utilities/build.sh -u -f ${{ matrix.firmware }} -t ${{ matrix.target }} -p ${{ matrix.platform }}
150155
151156
run-unit-tests:
152157
needs: check-format
@@ -160,31 +165,36 @@ jobs:
160165
runs-on: ubuntu-latest
161166

162167
steps:
163-
- uses: actions/checkout@v3
164-
with:
165-
submodules: recursive
166-
167-
- name: Restore build-tools
168-
id: cache-build-tools
169-
uses: actions/cache@v3
170-
with:
171-
path: build-tools
172-
key: build-tools
173-
174-
- name: Install simulator dependencies
175-
run: sudo apt update && sudo apt install libsdl2-dev --no-install-recommends -y
176-
177-
- name: Run tests
178-
env:
179-
CACHED: ${{ steps.cache-build-tools.outputs.cache-hit }}
180-
run: |
181-
if [ ! "${CACHED}" = "true" ]; then
182-
bash ./utilities/ci/setup-build-tools.sh;
183-
fi
184-
PATH="$PATH:$(pwd)/build-tools"
185-
pip install -r vendor/nanopb/extra/requirements.txt
186-
# Ignore any non-zero exits from simulator run using '|| true'
187-
bash ./utilities/run_unit_tests.sh -f ${{ matrix.firmware }} -p ${{ matrix.platform }} > test_results.txt || true
188-
cat test_results.txt
189-
# Unity prints "OK" if all tests pass, "FAIL" if tests fail; return 1 to indicate failure
190-
if [ ! "$(tail -n 1 test_results.txt)" = "OK" ]; then exit 1; fi
168+
- uses: actions/checkout@v3
169+
with:
170+
submodules: recursive
171+
172+
- uses: actions/setup-python@v5
173+
with:
174+
python-version: "3.9"
175+
cache: "pip"
176+
177+
- name: Restore build-tools
178+
id: cache-build-tools
179+
uses: actions/cache@v3
180+
with:
181+
path: build-tools
182+
key: build-tools
183+
184+
- name: Install simulator dependencies
185+
run: sudo apt update && sudo apt install libsdl2-dev --no-install-recommends -y
186+
187+
- name: Run tests
188+
env:
189+
CACHED: ${{ steps.cache-build-tools.outputs.cache-hit }}
190+
run: |
191+
if [ ! "${CACHED}" = "true" ]; then
192+
bash ./utilities/ci/setup-build-tools.sh;
193+
fi
194+
PATH="$PATH:$(pwd)/build-tools"
195+
pip install -r vendor/nanopb/extra/requirements.txt
196+
# Ignore any non-zero exits from simulator run using '|| true'
197+
bash ./utilities/run_unit_tests.sh -f ${{ matrix.firmware }} -p ${{ matrix.platform }} > test_results.txt || true
198+
cat test_results.txt
199+
# Unity prints "OK" if all tests pass, "FAIL" if tests fail; return 1 to indicate failure
200+
if [ ! "$(tail -n 1 test_results.txt)" = "OK" ]; then exit 1; fi

0 commit comments

Comments
 (0)