rusefi/.github/workflows/gen-configs.yaml

145 lines
5.5 KiB
YAML

name: Configs & Live Docs
on:
push:
branches:
- master
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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
- name: Install Tools
run: |
sudo apt-get -o Acquire::Retries=3 update
sudo apt-get install sshpass sshpass mtools
- name: Generate Enum Strings
working-directory: ./firmware/
run: ./gen_enum_to_string.sh
- 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: Fix The Mess
working-directory: ./firmware/
run: |
git checkout -- ./controllers/generated/engine_configuration_generated_structures.h
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
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub gen-configs Action"
git add firmware/tunerstudio/generated
git add firmware/controllers/generated
git add 'firmware/*/auto_generated*.cpp'
git add 'firmware/*/auto_generated*.h'
git add 'firmware/config/boards/*/generated_ts_name_by_pin.cpp'
git add java_console/io/src/main/java/com/rusefi/enums
git add java_console/models/src/main/java/com/rusefi/config/generated
git add *_generated.h
# get the original ramdisk images back in order to not overwrite the default placeholder
git checkout -- firmware/hw_layer/mass_storage/ramdisk_image.h firmware/hw_layer/mass_storage/ramdisk_image_compressed.h
git status
OUT=$(git commit -am "Auto-generated configs and docs" 2>&1) || echo "commit failed, finding out why"
if echo "$OUT" | grep 'nothing to commit'; then
echo "headers: looks like nothing to commit"
echo "::set-env name=NOCOMMIT::true"
exit 0
elif echo "$OUT" | grep 'changed'; then
echo "headers: looks like something has changed"
exit 0
else
echo "headers: looks like something unexpected"
exit 1
fi
# We need to know what branch this is in order to push to the correct branch
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Push configs
if: ${{env.NOCOMMIT != 'true'}}
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ steps.extract_branch.outputs.branch }}
- 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: ASAN_OPTIONS=detect_stack_use_after_return=1 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
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
#
# we have minor drama - looks like unit_tests are invoked from root folder while a more natural is to invoke those
# from 'unit_tests' folder
# as a work-around to leverage unit_tests/.gitignore we move those files into expected folder for now
#
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub build-unit-tests Action"
git status
git remote -v
echo See https://github.com/rusefi/rusefi/issues/2446
git pull https://github.com/rusefi/rusefi master
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 -E 'nothing to commit|no changes added'; then
echo "triggers: looks like nothing to commit"
echo "::set-env name=NOCOMMIT::true"
exit 0
elif echo "$OUT" | grep 'changed'; then
echo "::set-env name=NOCOMMIT::false"
echo "triggers: looks like something has changed"
exit 0
else
echo "triggers: looks like something unexpected"
exit 1
fi
- name: Push fresh triggers.txt
if: ${{env.NOCOMMIT != 'true'}}
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ steps.extract_branch.outputs.branch }}