99 lines
3.3 KiB
YAML
99 lines
3.3 KiB
YAML
name: Unit Tests
|
|
|
|
on: [push,pull_request]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-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
|
|
|
|
- name: Discover cores
|
|
if: ${{ matrix.os != 'macos-latest' }}
|
|
run: lscpu | egrep 'Model name|Socket|Thread|NUMA|CPU\(s\)'
|
|
|
|
- name: Install required software (ubuntu)
|
|
if: ${{ matrix.os != 'macos-latest' }}
|
|
run: |
|
|
sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh
|
|
sudo bash misc/actions/ubuntu-install-tools.sh
|
|
sudo apt-get install lcov valgrind
|
|
|
|
- name: Install required software (macos)
|
|
if: ${{ matrix.os == 'macos-latest' }}
|
|
run: |
|
|
brew install mtools zip dosfstools flock coreutils
|
|
|
|
- name: Print bash version
|
|
run: bash --version
|
|
|
|
- name: Test Java Compiler
|
|
run: javac -version
|
|
|
|
- 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
|
|
run: gcc -v
|
|
|
|
- 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
|
|
|
|
- name: Build Tests
|
|
working-directory: ./unit_tests/
|
|
run: make -j4 COVERAGE=yes
|
|
|
|
- name: Run Tests
|
|
working-directory: ./unit_tests/
|
|
run: ASAN_OPTIONS=detect_stack_use_after_return=1 build/rusefi_test
|
|
|
|
- name: Set FTP variables
|
|
env:
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
|
run: |
|
|
if [ "${{github.ref}}" = "refs/heads/master" ]; then
|
|
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
|
|
fi
|
|
|
|
- name: Generate Code Coverage
|
|
if: ${{ matrix.os != 'macos-latest' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
|
working-directory: ./unit_tests/
|
|
run: ./ci_gcov.sh ${{ secrets.RUSEFI_SSH_USER }} ${{ secrets.RUSEFI_SSH_PASS }} ${{ secrets.RUSEFI_SSH_SERVER }}
|
|
|
|
|
|
# - name: Run Tests (sharded)
|
|
# working-directory: ./unit_tests/
|
|
# run: bash ./run_sharded_tests.sh
|
|
|
|
- name: Rebuild Tests For Valgrind
|
|
# Valgrind isn't compatible with address sanitizer, so we have to rebuild the code
|
|
if: ${{ matrix.os != 'macos-latest' }}
|
|
working-directory: ./unit_tests/
|
|
run: |
|
|
make clean
|
|
make -j4 SANITIZE=no
|
|
|
|
- name: Run Tests (Valgrind)
|
|
if: ${{ matrix.os != 'macos-latest' }}
|
|
working-directory: ./unit_tests/
|
|
run: valgrind --error-exitcode=1 --exit-on-first-error=yes --leak-check=no --show-error-list=yes build/rusefi_test
|