Skip to content
This repository was archived by the owner on Oct 26, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
e7c16a0
Update .gitignore
PurpleRhythms Jul 7, 2021
1840c9f
Added check for uncommitted MU protobuf changes
PurpleRhythms Jul 7, 2021
2446b93
Merge branch 'master' into soft_501_commit_generated_code
PurpleRhythms Jul 8, 2021
2346da2
Avoiding duplicate ifs
PurpleRhythms Jul 8, 2021
9479c16
Merge branch 'soft_501_commit_generated_code' of https://github.com/u…
PurpleRhythms Jul 8, 2021
1c81e14
make mu_protos disambiguation
PurpleRhythms Jul 8, 2021
3bc0525
Testing
PurpleRhythms Jul 10, 2021
e2c6ce9
Testing #2
PurpleRhythms Jul 15, 2021
6a70e4e
Testing #3
PurpleRhythms Jul 15, 2021
8b179ed
Testing #4
PurpleRhythms Jul 15, 2021
e198ceb
More testing
PurpleRhythms Jul 17, 2021
2d7684c
Continued testing #2
PurpleRhythms Jul 17, 2021
24e5a46
Git conflict
PurpleRhythms Jul 17, 2021
d912b48
Merge branch 'master' into soft_501_commit_generated_code
PurpleRhythms Jul 21, 2021
ccaaf90
More testing!
PurpleRhythms Jul 21, 2021
8a8b73e
Merge branch 'soft_501_commit_generated_code' of https://github.com/u…
PurpleRhythms Jul 21, 2021
8348ee0
Installing Go and protobufs
PurpleRhythms Jul 21, 2021
603eb72
Test installation
PurpleRhythms Jul 21, 2021
a30692d
Get .tar file for Go
PurpleRhythms Jul 21, 2021
8f6654a
Sudo tar instead of just tar
PurpleRhythms Jul 21, 2021
9ee8485
--version -> version
PurpleRhythms Jul 21, 2021
cb488c2
More sudos
PurpleRhythms Jul 21, 2021
1e70afa
Removed go and protobuf compilers
PurpleRhythms Jul 22, 2021
2d97ba3
Set up protobuf-c from Jess Muir
PurpleRhythms Jul 22, 2021
c24df6c
Brute installing protoc
PurpleRhythms Jul 22, 2021
d388982
Install pkg-config
PurpleRhythms Jul 24, 2021
baa276c
autoconfig
PurpleRhythms Jul 24, 2021
fac4b74
autoreconfig install
PurpleRhythms Jul 24, 2021
0f96adc
Installing folly
PurpleRhythms Jul 24, 2021
47be59d
Copy Paste Jess' code
PurpleRhythms Jul 24, 2021
9aee41c
Merge branch 'master' into soft_501_commit_generated_code
PurpleRhythms Jul 24, 2021
eff696e
Empty commit to rerun CI
PurpleRhythms Jul 24, 2021
fc35373
Comments were causing syntax error?
PurpleRhythms Jul 24, 2021
6ebda13
Update main.yml
PurpleRhythms Jul 24, 2021
113782f
More testing!!
PurpleRhythms Aug 13, 2021
2d768ac
More dependecies
PurpleRhythms Aug 13, 2021
c94b54b
Obselete package
PurpleRhythms Aug 13, 2021
2c06ace
Some includes
PurpleRhythms Aug 14, 2021
25ec03e
Merge branch 'master' into soft_501_commit_generated_code
PurpleRhythms Aug 14, 2021
7021e3e
Empty commit
PurpleRhythms Aug 14, 2021
2c39fc1
Merge branch 'soft_501_commit_generated_code' of https://github.com/u…
PurpleRhythms Aug 14, 2021
9d9335f
Removing comments
PurpleRhythms Aug 14, 2021
e07720b
All in ~
PurpleRhythms Aug 14, 2021
fb1695f
Start from scratch
PurpleRhythms Aug 14, 2021
e717694
pkg-config
PurpleRhythms Aug 14, 2021
7a8e93f
Update main.yml
PurpleRhythms Aug 14, 2021
e9459ca
Update main.yml
PurpleRhythms Aug 14, 2021
0b770e8
Update main.yml
PurpleRhythms Aug 14, 2021
feb72a3
Sudo on --version but keeping usr/local dir
PurpleRhythms Aug 21, 2021
49d15c5
Please work
PurpleRhythms Aug 21, 2021
81d30bb
PATH change?
PurpleRhythms Aug 21, 2021
1579487
Try again with paths
PurpleRhythms Aug 21, 2021
4c431ba
Adding $HOME to $GITHUB_PATH
PurpleRhythms Aug 21, 2021
2a9d2f1
/bin is also extracted
PurpleRhythms Aug 21, 2021
6417cb0
Return to .local/bin
PurpleRhythms Aug 21, 2021
3e19e00
Rollback to when protoc --version worked
PurpleRhythms Aug 21, 2021
01f3b9a
Attempting to install protobuf-c
PurpleRhythms Aug 23, 2021
25ac386
Spaces matter
PurpleRhythms Aug 23, 2021
217a4d3
Fix ZIP download link
PurpleRhythms Aug 23, 2021
b24afdd
Linux different?
PurpleRhythms Aug 23, 2021
68511f7
Extracting wrong files
PurpleRhythms Sep 1, 2021
6f98e89
cd before running autogen.sh
PurpleRhythms Sep 1, 2021
15901a3
Update main.yml
PurpleRhythms Sep 1, 2021
5f52ece
wokd
PurpleRhythms Sep 1, 2021
99096f5
tree
PurpleRhythms Sep 1, 2021
deab9c5
Update main.yml
PurpleRhythms Sep 1, 2021
5d79e49
Absolute Path
PurpleRhythms Sep 1, 2021
02642e7
Unzip stopped working
PurpleRhythms Sep 1, 2021
d9fc1bb
Just tree
PurpleRhythms Sep 1, 2021
0512585
Merge branch 'master' into soft_501_commit_generated_code
PurpleRhythms Sep 1, 2021
02cb386
No $ variables
PurpleRhythms Sep 1, 2021
551cb2f
Trying to run autogen.sh twice
PurpleRhythms Sep 3, 2021
eabee34
Continue on error to run twice
PurpleRhythms Sep 3, 2021
95285c5
Adding test step
PurpleRhythms Sep 3, 2021
0cab591
Re-cd next step
PurpleRhythms Sep 3, 2021
6fb5e8b
Sudo all installation lines + apt get libtool
PurpleRhythms Sep 3, 2021
aed5f30
Try installing protobuf cpp as protobuf for protobuf c installation
PurpleRhythms Sep 8, 2021
b9d230d
Fix protobuf installation script
PurpleRhythms Sep 9, 2021
e8067fb
Retest protobuf-c pakage installation
PurpleRhythms Sep 9, 2021
4568f00
Removing make check and increasing job time
PurpleRhythms Sep 9, 2021
792a838
Adding Caching to protobuf installation
PurpleRhythms Sep 11, 2021
62ebb15
Merge branch 'master' into soft_501_commit_generated_code
PurpleRhythms Sep 11, 2021
5f120c9
Rerun with increased timeout
PurpleRhythms Sep 11, 2021
6ad5a48
Merge branch 'soft_501_commit_generated_code' of https://github.com/u…
PurpleRhythms Sep 11, 2021
24acd4b
Specify protobuf usr/local paths for caching, Increase timeout minute…
PurpleRhythms Sep 11, 2021
b2fc596
Empty Commit to test caching
PurpleRhythms Sep 14, 2021
ec1d6af
Merge branch 'master' into soft_501_commit_generated_code
PurpleRhythms Sep 18, 2021
efc735c
Change permissions for caching
PurpleRhythms Sep 18, 2021
87b17d4
Fix permissions for all cached folders
PurpleRhythms Sep 18, 2021
8734926
Add sudo
PurpleRhythms Sep 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 98 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,38 @@ env:
jobs:
build:
runs-on: ubuntu-16.04
timeout-minutes: 12
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try and rerun the CI jobs to see if the caching works; if it does, great, but if it doesn't, I worry that caching all of /usr/local/lib will cause issues. I assume there's a particular protobuf library in there that you want to cache, so to cache only that library I'd recommend copying it from /usr/local/lib to some path you can restore (like make ~/.cache/protobuf or something and copy it there) in the install-protobuf step, then copying it back in a step that runs if the cache successfully restored.

/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
Expand All @@ -43,6 +62,44 @@ jobs:
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'
Expand All @@ -61,7 +118,6 @@ jobs:
make install
cd ..
rm -rf $MAKE_PATH

- uses: actions/setup-python@v2
with:
python-version: '3.x'
Expand Down Expand Up @@ -91,6 +147,7 @@ jobs:
.venv/bin/pip3 freeze

- name: Format and lint
if: ${{ 'success' == 'failure' }}
run: |
make test_format
make lint
Expand All @@ -102,15 +159,26 @@ jobs:
make codegen_dbc

- name: Check for uncommitted codegen changes
id: check-uncommitted-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: Post PR comment on uncommitted changes
if: ${{ steps.check-uncommitted-changes.outcome == 'failure' }}
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: |
Expand All @@ -123,9 +191,28 @@ jobs:
repo: context.repo.repo,
body: comment,
});

- name: Fail on uncommitted changes
if: ${{ steps.check-uncommitted-changes.outcome == 'failure' }}

- 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
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/uncommitted-protobuf-changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- This is posted as a PR comment when CI detects uncommitted protobuf changes. -->
## Uncommitted MU protobuf changes detected!

Message in progress!

It looks like the generated .pb-c.c .pb-c.h and _pb2.py files in libraries/codegen-tooling don't match the CAN message definition file at codegen/can_messages.asciipb. If you've changed the CAN message definitions, please run `make codegen` locally and push the changes.

Alternatively, maybe you've edited can_messages.asciipb in the [codegen-tooling-msxiv][1] repo. This [has been deprecated][2]: please make your changes to codegen/can_messages.asciipb instead.

[1]: https://github.com/uw-midsun/codegen-tooling-msxiv
[2]: https://uwmidsun.atlassian.net/l/c/ghJhoqbT
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,14 @@ codegen_protos:
@echo "Compiling protos..."
@mkdir -p $(CODEGEN_DIR)/genfiles
@protoc -I=$(CODEGEN_DIR)/schema --python_out=$(CODEGEN_DIR)/genfiles $(CODEGEN_DIR)/schema/can.proto

# Builds protos for MU
.PHONY: mu_protos
mu_protos:
@echo "Building protos..."
# @mkdir -p $(MU_DIR)/protogen
# @protoc -I=$(MU_DIR)/protos --c_out=$(MU_DIR)/protogen $(MU_DIR)/protos/*.proto
@$(call gen_mu)

.PHONY: pytest
pytest:
Expand Down
2 changes: 1 addition & 1 deletion make/filter.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ VALID_LIBRARIES := $(patsubst $(LIB_DIR)/%/rules.mk,%,$(wildcard $(LIB_DIR)/*/ru
# - For test, gdb, and program, check to see if PLATFORM and {PROJECT or {LIBRARY and TEST}} are valid
# - For build, check if PLATFORM and {PROJECT or LIBRARY} are valid

ifneq (,$(filter clean lint lint_quick pylint format format_quick build_all test_all codecov test_format socketcan codegen codegen_dbc codegen_protos codegen_test mock_can_data babydriver bootloader_protos install_mu mu fastmu pylint_quick pyformat pyformat_quick pytest_all pytest install_requirements,$(MAKECMDGOALS)))
ifneq (,$(filter clean lint lint_quick pylint format format_quick build_all test_all codecov test_format socketcan codegen codegen_dbc codegen_protos codegen_test mock_can_data babydriver bootloader_protos install_mu mu fastmu pylint_quick pyformat pyformat_quick pytest_all pytest install_requirements mu_protos, $(MAKECMDGOALS)))
# Universal operation: do nothing - args are not used or only PLATFORM is checked
else ifneq (,$(filter new,$(MAKECMDGOALS)))
# New project: just make sure PROJECT or LIBRARY is defined
Expand Down