Skip to content

Commit d203f1a

Browse files
committed
ci: add github actions
1 parent d71e8ec commit d203f1a

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/main.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Main Workflow
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
# socketcan/libcanard
7+
socketcan:
8+
strategy:
9+
matrix:
10+
build_type: ["Debug", "Release"]
11+
12+
env:
13+
CC: gcc-10
14+
CXX: g++-10
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
submodules: 'recursive'
22+
23+
- name: Install Dependencies
24+
run: |
25+
sudo dpkg --add-architecture i386
26+
sudo apt install gcc-10 g++-10 linux-libc-dev:i386 linux-*-extra-$(uname -r)
27+
28+
- name: Configure CMake
29+
env:
30+
BUILD_TYPE: ${{ matrix.build_type }}
31+
working-directory: ${{github.workspace}}/socketcan/libcanard/
32+
run: cmake test -DCMAKE_BUILD_TYPE=$BUILD_TYPE
33+
34+
- name: Build
35+
working-directory: ${{github.workspace}}/socketcan/libcanard/
36+
run: make all VERBOSE=1
37+
38+
- name: Test
39+
working-directory: ${{github.workspace}}/socketcan/libcanard/
40+
run: make test
41+
42+
# stm32/libcanard/bxcan
43+
stm32:
44+
env:
45+
CC: gcc-10
46+
CXX: g++-10
47+
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- uses: actions/checkout@v2
52+
with:
53+
submodules: 'recursive'
54+
55+
- name: Install Dependencies
56+
run: |
57+
sudo apt install gcc-10 g++-10 gcc-10-multilib g++-10-multilib clang-tidy-10 clang-format-10
58+
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 10
59+
60+
- name: Static analysis
61+
working-directory: ${{github.workspace}}/stm32/libcanard/bxcan/
62+
run: clang-tidy-10 src/*.c --extra-arg='-DBXCAN_MAX_IFACE_INDEX=1' --extra-arg='-DBXCAN_BUSYWAIT_DELAY_SYSTEM_CORE_CLOCK=72000000'
63+
64+
- name: Format check
65+
working-directory: ${{github.workspace}}/stm32/libcanard/bxcan/
66+
run: |
67+
clang-format-10 -i -fallback-style=none -style=file --verbose src/*.[ch]
68+
modified="$(git status --porcelain --untracked-files=no)"
69+
if [ -n "$modified" ]; then echo "Please format code properly."; exit 1; fi

0 commit comments

Comments
 (0)