2021-07-24 13:23:03 -07:00
|
|
|
name: Unit Tests
|
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\)'
|
|
|
|
|
2021-07-30 17:18:53 -07:00
|
|
|
- name: Install required software (ubuntu)
|
|
|
|
if: ${{ matrix.os != 'macos-latest' }}
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2021-07-30 17:26:13 -07:00
|
|
|
sudo apt-get install mtools
|
|
|
|
sudo apt-get install zip
|
|
|
|
sudo apt-get install dosfstools
|
2021-07-30 17:18:53 -07:00
|
|
|
|
|
|
|
- name: Install required software (macos)
|
|
|
|
if: ${{ matrix.os == 'macos-latest' }}
|
|
|
|
run: |
|
|
|
|
brew install mtools zip dosfstools
|
|
|
|
|
2021-07-30 16:30:12 -07:00
|
|
|
- name: Generate Configs for unit tests
|
2020-06-18 15:31:54 -07:00
|
|
|
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/
|
2021-11-06 18:20:24 -07:00
|
|
|
run: make -j4 COVERAGE=yes
|
2019-11-20 16:36:14 -08:00
|
|
|
|
|
|
|
- name: Run Tests
|
2021-05-24 05:46:23 -07:00
|
|
|
working-directory: ./unit_tests/
|
2021-11-15 16:44:39 -08:00
|
|
|
run: ASAN_OPTIONS=detect_stack_use_after_return=1 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' }}
|
2021-10-25 05:22:31 -07:00
|
|
|
run: sudo apt-get install sshpass lcov
|
2020-06-16 14:39:50 -07:00
|
|
|
|
|
|
|
- name: Generate Code Coverage
|
2021-10-02 08:02:27 -07:00
|
|
|
if: ${{ matrix.os != 'macos-latest' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
2020-06-16 14:39:50 -07:00
|
|
|
working-directory: ./unit_tests/
|
2021-10-25 05:22:31 -07:00
|
|
|
run: ./ci_gcov.sh ${{ secrets.RUSEFI_SSH_USER }} ${{ secrets.RUSEFI_SSH_PASS }} ${{ secrets.RUSEFI_SSH_SERVER }}
|
2020-12-12 18:36:41 -08:00
|
|
|
|
2021-07-04 19:28:31 -07:00
|
|
|
- name: Run Tests (sharded)
|
|
|
|
working-directory: ./unit_tests/
|
|
|
|
run: bash ./run_sharded_tests.sh
|