2019-11-20 20:34:55 -08:00
|
|
|
name: Unit Test CI
|
2019-11-20 16:22:16 -08:00
|
|
|
|
2019-11-20 20:34:55 -08:00
|
|
|
on: [push,pull_request]
|
2019-11-20 16:22:16 -08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2021-01-04 19:10:51 -08:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-20.04, macos-latest]
|
|
|
|
|
2019-11-20 16:22:16 -08:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2019-11-20 16:28:14 -08:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
2020-12-12 18:36:41 -08:00
|
|
|
fetch-depth: 0
|
2020-11-19 18:38:45 -08:00
|
|
|
|
|
|
|
- name: Discover cores
|
2021-01-04 19:10:51 -08:00
|
|
|
if: ${{ matrix.os != 'macos-latest' }}
|
2020-11-19 18:38:45 -08:00
|
|
|
run: lscpu | egrep 'Model name|Socket|Thread|NUMA|CPU\(s\)'
|
|
|
|
|
2020-06-18 15:31:54 -07:00
|
|
|
- name: Generate Configs
|
|
|
|
working-directory: ./firmware/
|
2020-07-14 07:28:26 -07:00
|
|
|
run: bash gen_config_default.sh
|
2020-06-18 15:31:54 -07:00
|
|
|
|
2021-01-09 10:21:43 -08:00
|
|
|
- name: Generate Enums
|
|
|
|
working-directory: ./firmware/
|
|
|
|
run: bash gen_enum_to_string.sh
|
|
|
|
|
2020-06-18 15:31:54 -07:00
|
|
|
- name: Generate Live Documentation
|
|
|
|
working-directory: ./firmware/
|
2020-07-14 07:28:26 -07:00
|
|
|
run: bash gen_live_documentation.sh
|
2020-06-18 15:31:54 -07:00
|
|
|
|
2021-01-04 19:10:51 -08:00
|
|
|
- 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
|
2020-09-08 09:45:33 -07:00
|
|
|
working-directory: .
|
2020-09-08 10:27:07 -07:00
|
|
|
run: gcc -v
|
2020-09-08 09:45:33 -07:00
|
|
|
|
2019-11-20 16:36:14 -08:00
|
|
|
- name: Build Tests
|
2019-11-20 16:28:14 -08:00
|
|
|
working-directory: ./unit_tests/
|
2019-11-20 16:36:28 -08:00
|
|
|
run: make -j4
|
2019-11-20 16:36:14 -08:00
|
|
|
|
|
|
|
- name: Run Tests
|
2021-05-24 05:46:23 -07:00
|
|
|
working-directory: ./unit_tests/
|
|
|
|
run: build/rusefi_test
|
2020-06-16 14:39:50 -07:00
|
|
|
|
|
|
|
- name: Install Coverage Tools
|
2021-01-04 19:10:51 -08:00
|
|
|
if: ${{ matrix.os != 'macos-latest' }}
|
2020-06-16 14:39:50 -07:00
|
|
|
run: sudo apt-get install ncftp lcov
|
|
|
|
|
|
|
|
- name: Generate Code Coverage
|
2021-01-04 19:10:51 -08:00
|
|
|
if: ${{ matrix.os != 'macos-latest' }}
|
2020-06-16 14:39:50 -07:00
|
|
|
working-directory: ./unit_tests/
|
|
|
|
run: ./ci_gcov.sh ${{ secrets.RUSEFI_DOXYGEN_FTP_USER }} ${{ secrets.RUSEFI_DOXYGEN_FTP_PASS }} ${{ secrets.RUSEFI_FTP_SERVER }}
|
2020-12-12 18:36:41 -08:00
|
|
|
|
|
|
|
# Commit changes and catch the error that occurs if nothing has been changed (without catching other errors)
|
2020-12-30 07:43:50 -08:00
|
|
|
- name: Commit fresh triggers.txt
|
2021-01-04 19:10:51 -08:00
|
|
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.os != 'macos-latest' }}
|
2020-12-12 18:36:41 -08:00
|
|
|
env:
|
|
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
2020-12-12 19:40:12 -08:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
2020-12-12 18:36:41 -08:00
|
|
|
run: |
|
|
|
|
git config --local user.email "action@github.com"
|
|
|
|
git config --local user.name "GitHub build-unit-tests Action"
|
2021-03-13 20:45:19 -08:00
|
|
|
git status
|
|
|
|
git remote -v
|
2021-03-13 20:46:12 -08:00
|
|
|
echo See https://github.com/rusefi/rusefi/issues/2446
|
2021-03-14 00:23:55 -08:00
|
|
|
git pull https://github.com/rusefi/rusefi master
|
2020-12-12 20:12:23 -08:00
|
|
|
git add unit_tests/triggers.txt
|
2020-12-12 18:36:41 -08:00
|
|
|
git status
|
2020-12-12 20:42:37 -08:00
|
|
|
OUT=$(git commit -m "Trigger wheel definitions" unit_tests/triggers.txt 2>&1) || echo "commit failed, finding out why"
|
2020-12-12 18:36:41 -08:00
|
|
|
echo "$OUT"
|
2021-02-12 19:27:29 -08:00
|
|
|
if echo "$OUT" | grep -E 'nothing to commit|no changes added'; then
|
2020-12-12 18:36:41 -08:00
|
|
|
echo "::set-env name=NOCOMMIT::true"
|
|
|
|
exit 0
|
|
|
|
elif echo "$OUT" | grep 'changed'; then
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Push configs
|
2021-01-04 19:10:51 -08:00
|
|
|
if: ${{github.event_name == 'push' && github.ref == 'refs/heads/master' && env.NOCOMMIT != 'true' && matrix.os != 'macos-latest'}}
|
2020-12-12 18:36:41 -08:00
|
|
|
uses: ad-m/github-push-action@master
|
|
|
|
with:
|
|
|
|
github_token: ${{ github.token }}
|
|
|
|
branch: master
|