1name: Run tests with various compilers
2
3on:
4  workflow_dispatch:
5  workflow_call:
6
7jobs:
8  test_linux:
9    name: Test with gcc & clang on Ubuntu
10    runs-on: ubuntu-20.04
11
12    steps:
13      - name: Check out code from GitHub
14        uses: actions/checkout@v2
15        with:
16          path: nanopb
17          fetch-depth: "0"
18
19      - name: Install dependencies
20        run: |
21          sudo dpkg --add-architecture i386
22          sudo apt-get update
23          sudo apt-get install python3-protobuf protobuf-compiler scons
24          sudo apt-get install clang valgrind splint cmake
25          sudo apt-get install libstdc++6:i386 libgcc-s1:i386 lib32gcc-9-dev lib32stdc++-9-dev libncurses5:i386 libc6-dbg:i386 libc6-dev:i386 binutils-multiarch
26
27      - name: Test with 64-bit GCC
28        run: |
29          cd nanopb/tests
30          rm -rf build
31          scons CC=gcc CXX=g++ CCFLAGS="-O3"
32          rm -rf build
33          scons CC=gcc CXX=g++ CCFLAGS="-Os -flto"
34          rm -rf build
35          scons CC=gcc CXX=g++ CCFLAGS="-O1 -DPB_FIELD_32BIT=1"
36
37      - name: Test with 32-bit GCC
38        run: |
39          cd nanopb/tests
40          rm -rf build
41          scons CC=gcc CXX=g++ CCFLAGS="-O3 -m32" LINKFLAGS="-m32"
42          rm -rf build
43          scons CC=gcc CXX=g++ CCFLAGS="-Os -flto -m32" LINKFLAGS="-m32"
44          rm -rf build
45          scons CC=gcc CXX=g++ CCFLAGS="-O1 -DPB_FIELD_32BIT=1 -m32" LINKFLAGS="-m32"
46
47      - name: Test with 64-bit clang
48        run: |
49          cd nanopb/tests
50          rm -rf build
51          scons CC=clang CXX=clang++ CCFLAGS="-O3"
52          rm -rf build
53          scons CC=clang CXX=clang++ CCFLAGS="-Os -DPB_FIELD_32BIT=1"
54
55      - name: Test with 32-bit clang
56        run: |
57          cd nanopb/tests
58          rm -rf build
59          scons CC=clang CXX=clang++ CCFLAGS="-O3 -m32" LINKFLAGS="-m32"
60          rm -rf build
61          scons CC=clang CXX=clang++ CCFLAGS="-Os -DPB_FIELD_32BIT=1 -m32" LINKFLAGS="-m32"
62
63