1name: C/C++ CI
2
3on:
4  push:
5    branches: [ master, release/v8.* ]
6  pull_request:
7    branches: [ master, release/v8.* ]
8
9jobs:
10  build:
11    if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
12    runs-on: ubuntu-latest
13    strategy:
14      matrix:
15        # A valid option parameter to the cmake file.
16        # See BUILD_OPTIONS in tests/CMakeLists.txt.
17        build_option: ['OPTIONS_MINIMAL_MONOCHROME',
18                       'OPTIONS_NORMAL_8BIT',
19                       'OPTIONS_16BIT',
20                       'OPTIONS_16BIT_SWAP',
21                       'OPTIONS_FULL_32BIT']
22    name: Build ${{ matrix.build_option }}
23    steps:
24    - uses: actions/checkout@v2
25    - uses: ammaraskar/gcc-problem-matcher@master
26    - name: Install prerequisites
27      run: scripts/install-prerequisites.sh
28    - name: Building ${{ matrix.build_option }}
29      run: python tests/main.py --build-option=${{ matrix.build_option }} build
30
31  test-native:
32    runs-on: ubuntu-latest
33    name: amd64 Executable Tests
34    steps:
35    - uses: actions/checkout@v2
36    - uses: ammaraskar/gcc-problem-matcher@master
37    - name: Install prerequisites
38      run: scripts/install-prerequisites.sh
39    - name: Fix kernel mmap rnd bits
40      # Asan in llvm 14 provided in ubuntu 22.04 is incompatible with
41      # high-entropy ASLR in much newer kernels that GitHub runners are
42      # using leading to random crashes: https://reviews.llvm.org/D148280
43      run: sudo sysctl vm.mmap_rnd_bits=28
44    - name: Run tests
45      run: python tests/main.py --report test
46    - name: Upload coverage to Codecov
47      uses: codecov/codecov-action@v2
48      if: github.event_name == 'push'
49      with:
50        fail_ci_if_error: true
51        verbose: true
52  test-cross:
53    # The host should always be linux
54    runs-on: ubuntu-latest
55    name: ${{ matrix.arch }} Executable Tests
56
57    # Run steps on a matrix of 3 arch/distro combinations
58    strategy:
59      matrix:
60        arch: [ 'aarch64', 'armv6', 'armv7' ]
61
62    steps:
63      - uses: actions/checkout@v2.1.0
64      - uses: ammaraskar/gcc-problem-matcher@master
65      - name: Setup cache
66        uses: actions/cache@v2
67        with:
68          path: |
69            ~/.ccache
70          key: lvgl_ci_cross_test_ccache_${{ matrix.arch }}_${{ github.sha }}
71          restore-keys: |
72            lvgl_ci_cross_test_ccache_${{ matrix.arch }}
73      - uses: uraimo/run-on-arch-action@v2.1.1
74        name: Run tests
75        id: build
76        with:
77          arch: ${{ matrix.arch }}
78          distro: bullseye
79
80          # Not required, but speeds up builds
81          githubToken: ${{ github.token }}
82
83          # The shell to run commands with in the container
84          shell: /bin/bash
85
86          # Create cached/volume directories on host
87          setup: |
88            mkdir -p ~/.ccache
89
90          # Mount cached directories in the container for faster builds
91          dockerRunArgs: |
92            --volume "${HOME}/.ccache:/root/.ccache"
93
94          install: |
95            apt-get update -y
96            apt-get install build-essential ccache python3 libpng-dev ruby-full gcovr cmake -q -y
97            /usr/sbin/update-ccache-symlinks
98            echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc
99
100          run: |
101            if [[ "${{ matrix.distro }}" == "ubuntu22.04" ]]; then
102              # ASan in llvm 14 provided in ubuntu-22.04 is incompatible with
103              # high-entropy ASLR configured in much newer kernels that GitHub
104              # runners are using leading to random crashes:
105              #   https://github.com/actions/runner-images/issues/9491
106              # can remove this once the issue is fixed.
107              sysctl -w vm.mmap_rnd_bits=28
108            fi
109            env PATH="/usr/lib/ccache:$PATH" ASAN_OPTIONS=detect_leaks=0 python3 tests/main.py test
110