2021-07-24 13:23:03 -07:00
|
|
|
name: Unit Tests
|
2019-11-20 16:22:16 -08:00
|
|
|
|
2024-03-15 10:08:43 -07: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:
|
2024-04-26 11:00:22 -07:00
|
|
|
os: [ubuntu-latest, macos-latest]
|
2021-01-04 19:10:51 -08:00
|
|
|
|
2019-11-20 16:22:16 -08:00
|
|
|
steps:
|
2023-09-05 06:09:12 -07:00
|
|
|
- uses: actions/checkout@v4
|
2023-01-29 01:43:27 -08:00
|
|
|
|
|
|
|
- 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
|
2023-12-15 08:55:25 -08:00
|
|
|
git submodule update --init --depth=1 java_console/peak-can-basic
|
2020-11-19 18:38:45 -08:00
|
|
|
|
|
|
|
- name: Discover cores
|
2024-04-26 11:00:22 -07: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)
|
2024-04-26 11:00:22 -07:00
|
|
|
if: ${{ matrix.os != 'macos-latest' }}
|
2021-07-30 17:18:53 -07:00
|
|
|
run: |
|
2023-02-25 15:07:31 -08:00
|
|
|
sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh
|
2024-10-14 11:03:07 -07:00
|
|
|
sudo bash misc/actions/ubuntu-install-tools.sh
|
|
|
|
sudo apt-get install lcov valgrind
|
2021-07-30 17:18:53 -07:00
|
|
|
|
|
|
|
- name: Install required software (macos)
|
2024-04-26 11:00:22 -07:00
|
|
|
if: ${{ matrix.os == 'macos-latest' }}
|
2021-07-30 17:18:53 -07:00
|
|
|
run: |
|
2024-02-26 19:18:56 -08:00
|
|
|
brew install mtools zip dosfstools flock coreutils
|
2021-07-30 17:18:53 -07:00
|
|
|
|
2023-11-04 10:18:55 -07:00
|
|
|
- name: Print bash version
|
|
|
|
run: bash --version
|
|
|
|
|
2023-11-04 06:15:17 -07:00
|
|
|
- name: Test Java Compiler
|
|
|
|
run: javac -version
|
|
|
|
|
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 10:27:07 -07:00
|
|
|
run: gcc -v
|
2020-09-08 09:45:33 -07:00
|
|
|
|
2024-04-24 07:30:41 -07:00
|
|
|
- name: Handle docs-enums separately just to make github logs more readable
|
|
|
|
working-directory: ./unit_tests/
|
|
|
|
run: make -j4 docs-enums
|
|
|
|
|
|
|
|
- name: Handle configs separately just to make github logs more readable
|
|
|
|
working-directory: ./unit_tests/
|
|
|
|
run: make -j4 config
|
|
|
|
|
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
|
2021-11-15 20:42:23 -08:00
|
|
|
|
2019-11-20 16:36:14 -08:00
|
|
|
- name: Run Tests
|
2021-05-24 05:46:23 -07:00
|
|
|
working-directory: ./unit_tests/
|
2024-03-15 10:08:43 -07:00
|
|
|
run: ASAN_OPTIONS=detect_stack_use_after_return=1 build/rusefi_test
|
2020-06-16 14:39:50 -07:00
|
|
|
|
2022-01-18 05:30:11 -08:00
|
|
|
- name: Set FTP variables
|
|
|
|
env:
|
|
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
|
|
|
run: |
|
|
|
|
if [ "${{github.ref}}" = "refs/heads/master" ]; then
|
2023-07-26 06:29:32 -07:00
|
|
|
echo "RUSEFI_SSH_SERVER=${{secrets.RUSEFI_SSH_SERVER}}" >> $GITHUB_ENV
|
|
|
|
echo "RUSEFI_SSH_USER=${{secrets.RUSEFI_SSH_USER}}" >> $GITHUB_ENV
|
|
|
|
echo "RUSEFI_SSH_PASS=${{secrets.RUSEFI_SSH_PASS}}" >> $GITHUB_ENV
|
2022-01-18 05:30:11 -08:00
|
|
|
fi
|
|
|
|
|
2020-06-16 14:39:50 -07:00
|
|
|
- name: Generate Code Coverage
|
2024-04-26 11:00:22 -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
|
|
|
|
2024-03-15 10:08:43 -07:00
|
|
|
|
|
|
|
# - name: Run Tests (sharded)
|
|
|
|
# working-directory: ./unit_tests/
|
|
|
|
# run: bash ./run_sharded_tests.sh
|
2021-11-15 20:42:23 -08:00
|
|
|
|
|
|
|
- name: Rebuild Tests For Valgrind
|
|
|
|
# Valgrind isn't compatible with address sanitizer, so we have to rebuild the code
|
2024-04-26 11:00:22 -07:00
|
|
|
if: ${{ matrix.os != 'macos-latest' }}
|
2021-11-15 20:42:23 -08:00
|
|
|
working-directory: ./unit_tests/
|
|
|
|
run: |
|
|
|
|
make clean
|
|
|
|
make -j4 SANITIZE=no
|
|
|
|
|
|
|
|
- name: Run Tests (Valgrind)
|
2024-04-26 11:00:22 -07:00
|
|
|
if: ${{ matrix.os != 'macos-latest' }}
|
2021-11-15 20:42:23 -08:00
|
|
|
working-directory: ./unit_tests/
|
2022-09-25 15:49:54 -07:00
|
|
|
run: valgrind --error-exitcode=1 --exit-on-first-error=yes --leak-check=no --show-error-list=yes build/rusefi_test
|