This repository was archived by the owner on Oct 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
230 lines (201 loc) · 7.53 KB
/
Copy pathmain.yml
File metadata and controls
230 lines (201 loc) · 7.53 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: CI
on:
# Run on all pull requests and all pushes to master
push:
branches: [ master ]
pull_request:
# Allow running this workflow manually
workflow_dispatch:
env:
# Set defines for builds/tests
DEFINES: "LOG_LEVEL_VERBOSITY=LOG_LEVEL_WARN"
jobs:
build:
runs-on: ubuntu-16.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
# TODO: cache all the setup
- name: Cache
uses: actions/cache@v2.1.6
id: cache-packages
with:
path: |
/usr/local/bin/protoc
/usr/local/bin/protoc-c
/usr/local/bin/protoc-gen-c
/usr/local/include/google/protobuf
/usr/local/include/google/protobuf-c
/usr/local/include/protobuf-c
/usr/local/lib
/usr/local/protobuf-3.17.3
/usr/local/protobuf-c-master
key: ${{ runner.os }}-packages-${{ hashFiles('**/packages*.txt') }}
restore-keys: |
${{ runner.os }}-packages-
${{ runner.os }}-
- name: Setup directories
run: |
# create directory that will be on the PATH
mkdir -p ~/.local/bin
echo "${HOME}/.local/bin" >> $GITHUB_PATH
mkdir -p ~/source
- name: Install gcc, clang, clang-format
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-fast -y install gcc-6
sudo apt-fast -y install clang-5.0
sudo apt-fast -y install clang-format-5.0
sudo apt-fast -y install libc6-i386
# for vcan module
sudo apt-fast -y install linux-modules-extra-$(uname -r)
ln -sf `which gcc-6` ~/.local/bin/gcc
ln -sf `which clang-5.0` ~/.local/bin/clang
ln -sf `which clang-format-5.0` ~/.local/bin/clang-format
- name: Install protobuf and dependencies
if: steps.cache-packages.outputs.cache-hit != 'true'
run: |
sudo apt-get install gcc g++
sudo apt-get update -y
sudo apt-get install -y pkg-config
sudo apt-get install libtool
sudo apt update
sudo apt install protobuf-c-compiler
sudo apt install protobuf-compiler
sudo apt-get install autoconf automake libtool curl make g++ unzip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protoc-3.14.0-linux-x86_64.zip
sudo unzip -o protoc-3.14.0-linux-x86_64.zip -d /usr/local bin/protoc
sudo unzip -o protoc-3.14.0-linux-x86_64.zip -d /usr/local 'include/*'
rm -f protoc-3.14.0-linux-x86_64.zip
sudo protoc --version
export PATH="$PATH:$HOME/.local/bin"
curl -OL https://github.com/protobuf-c/protobuf-c/archive/refs/heads/master.zip
sudo unzip -o master.zip -d /usr/local '*'
rm -f master.zip
cd /usr/local
sudo protoc --version
sudo pkg-config --version
sudo curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-cpp-3.17.3.zip
sudo unzip -o protobuf-cpp-3.17.3.zip -d /usr/local '*'
sudo rm -f protobuf-cpp-3.17.3.zip
cd /usr/local/protobuf-3.17.3
sudo ./configure
sudo make
sudo make install
sudo ldconfig
cd /usr/local/protobuf-c-master
sudo ./autogen.sh && sudo ./configure && sudo make && sudo make install
- uses: fiam/arm-none-eabi-gcc@v1
with:
release: '6-2017-q2'
- name: Install GNU Make 4.1
env:
MAKE_PATH: make-4.1
MAKE_ARCHIVE_PATH: make-4.1.tar.gz
MAKE_URL: http://ftp.gnu.org/gnu/make/make-4.1.tar.gz
run: |
wget -nv $MAKE_URL
tar xvf $MAKE_ARCHIVE_PATH
cd $MAKE_PATH
./configure --prefix=${HOME}/.local
make
make install
cd ..
rm -rf $MAKE_PATH
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Python tooling
run: |
pip install --user virtualenv
pip install --upgrade pip
pip install --upgrade setuptools
make install_requirements
- name: Force PATH to update
run: hash -r
- name: Print versions of everything
run: |
arm-none-eabi-gcc --version
arm-none-eabi-objcopy --version
arm-none-eabi-objdump --version
arm-none-eabi-size --version
arm-none-eabi-gcc-ar --version
arm-none-eabi-gdb --version
gcc --version
make --version
clang --version
clang-format --version
.venv/bin/pip3 freeze
- name: Format and lint
if: ${{ 'success' == 'failure' }}
run: |
make test_format
make lint
make pylint
- name: Build codegen
run: |
make codegen
make codegen_dbc
- name: Check for uncommitted codegen changes
id: check-uncommited-codegen-changes
continue-on-error: true
# https://stackoverflow.com/a/3879077
run: |
git update-index --refresh || true
git diff-index --quiet HEAD --
- name: Build MU and bootloader protobufs # Bootloader protobufs use nanopb and not protoc
run: |
make mu_protos
- name: Check for uncommitted protobuf changes
id: check-uncommitted-protobuf-changes
continue-on-error: true
run: |
git update-index --refresh || true
git diff-index --quiet HEAD --
- name: Post PR comment on uncommitted codegen changes
if: ${{ steps.check-uncommited-codegen-changes.outcome == 'failure' }}
uses: actions/github-script@v4
with:
script: |
const fs = require('fs');
const comment = fs.readFileSync(
'./.github/workflows/uncommitted-codegen-changes.md', 'utf8');
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment,
});
- name: Post PR comment on uncommited protobuf changes
if: ${{ steps.check-uncommited-protobuf-changes.outcome == 'failure' }}
uses: actions/github-script@v4
with:
script: |
const fs = require('fs');
const comment = fs.readFileSync(
'./.github/workflows/uncommitted-protobuf-changes.md', 'utf8');
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment,
});
- name: Fail on uncommitted codegen changes
if: ${{ steps.check-uncommited-codegen-changes.outcome == 'failure' }}
run: exit 1
- name: Fail on uncommited protobuf changes
if: ${{ steps.check-uncommited-protobuf-changes.outcome == 'failure' }}
run: exit 1
- name: Build stm32f0xx
id: build-stm32
run: |
make build_all PLATFORM=stm32f0xx DEFINE="${DEFINES}"
make clean
- name: Build and test
id: build-test
run: |
make build_all PLATFORM=x86 DEFINE="${DEFINES}"
make test_all PLATFORM=x86 DEFINE="${DEFINES}"
make pytest_all
make build_all PLATFORM=x86 COMPILER=clang DEFINE="${DEFINES}"