forked from rusefi/rusefi
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (115 loc) · 4.53 KB
/
gen-configs.yaml
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
name: Configs & Live Docs
on:
push:
branches:
- master
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout Submodules
run: |
git submodule update --init --depth=1 unit_tests/googletest
git submodule update --init --depth=1 firmware/libfirmware
git submodule update --init --depth=1 firmware/ext/lua
git submodule update --init --depth=1 firmware/controllers/lua/luaaa
git submodule update --init --depth=1 firmware/controllers/can/wideband_firmware
git submodule update --init --depth=1 java_console/peak-can-basic
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
- name: Test Compiler
run: javac -version
- name: Install Tools
run: |
sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh
sudo apt-get install sshpass sshpass mtools
- name: Configuration Definition and Enum to String CI, without pushing new .jar
working-directory: ./java_tools
run: |
./gradlew :config_definition:shadowJar
./gradlew :config_definition_base:shadowJar
./gradlew :enum_to_string:shadowJar
- name: Generate Live Documentation
working-directory: ./firmware/
run: ./gen_live_documentation.sh
- name: Generate All Configs
working-directory: ./firmware/
run: bash gen_config.sh
# We want to force these files to come from the default "all" config, not the last board generated by gen_config.sh
- name: Reset Default Config Files
working-directory: ./firmware/
run: |
git checkout -- ../java_console/models/src/main/java/com/rusefi/config/generated/Fields.java
./gen_config_default.sh
# Commit changes and catch the error that occurs if nothing has been changed (without catching other errors)
- name: Commit fresh generated headers and TS project
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub gen-configs Action"
git add firmware/tunerstudio/generated
git add firmware/controllers/generated
git add 'firmware/*/*generated*.cpp'
git add 'firmware/*/*generated*.h'
git add 'firmware/config/boards/*/generated_ts_name_by_pin.cpp'
git add 'firmware/console/binary/generated/*.ini'
git add 'firmware/controllers/lua/generated/*.md'
git add *.java
git add *_generated.h
git status
OUT=$(git commit -m "Auto-generated configs and docs" 2>&1) || echo "commit failed, finding out why"
if echo "$OUT" | grep 'nothing to commit\|no changes added'; then
echo "headers: looks like nothing to commit"
exit 0
elif echo "$OUT" | grep 'changed'; then
echo "COMMIT=true" >> $GITHUB_ENV
echo "headers: looks like something has changed"
exit 0
else
echo "headers: looks like something unexpected"
exit 1
fi
- name: Print Compiler version
# NOTE: on mac, this is actually symlink'd to clang, not gcc, but that's ok - we want to build on both
working-directory: .
run: gcc -v
- name: Build Tests
working-directory: ./unit_tests/
run: make -j4
- name: Run Tests
working-directory: ./unit_tests/
run: build/rusefi_test
# Commit changes and catch the error that occurs if nothing has been changed (without catching other errors)
- name: Commit fresh triggers.txt
run: |
git status
git remote -v
echo See https://github.com/rusefi/rusefi/issues/2446
git add unit_tests/triggers.txt
git status
OUT=$(git commit -m "Trigger wheel definitions" unit_tests/triggers.txt 2>&1) || echo "commit failed, finding out why"
echo "$OUT"
if echo "$OUT" | grep 'nothing to commit\|no changes added'; then
echo "triggers: looks like nothing to commit"
exit 0
elif echo "$OUT" | grep 'changed'; then
echo "COMMIT=true" >> $GITHUB_ENV
echo "triggers: looks like something has changed"
exit 0
else
echo "triggers: looks like something unexpected"
exit 1
fi
- name: Git Pull
if: ${{env.COMMIT == 'true'}}
run: |
git stash
git pull --rebase
- name: Push fresh triggers.txt
if: ${{env.COMMIT == 'true'}}
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.ref }}