forked from FOME-Tech/fome-fw
-
Notifications
You must be signed in to change notification settings - Fork 2
78 lines (63 loc) · 2.53 KB
/
build-unit-tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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
with:
submodules: true
- 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' }}
working-directory: ./.github/workflows/
run: |
sudo ./add-ubuntu-latest-apt-mirrors.sh
sudo apt-get install mtools zip dosfstools sshpass lcov valgrind
- name: Install required software (macos)
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install mtools zip dosfstools
- 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 COVERAGE=yes
- name: Run Tests
working-directory: ./unit_tests/
#run: ASAN_OPTIONS=detect_stack_use_after_return=1 build/fome_test
run: build/fome_test
- name: Set FTP variables
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
if [ "${{github.ref}}" = "refs/heads/master" ]; then
echo "::set-env name=RUSEFI_SSH_SERVER::${{secrets.RUSEFI_SSH_SERVER}}";
echo "::set-env name=RUSEFI_SSH_USER::${{secrets.RUSEFI_SSH_USER}}";
echo "::set-env name=RUSEFI_SSH_PASS::${{secrets.RUSEFI_SSH_PASS}}";
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/fome_test