• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: ubuntu-cmake-contrib
2
3on: [push, pull_request]
4
5env:
6  BUILD_TYPE: Release
7
8jobs:
9  build:
10    strategy:
11      fail-fast: false
12      matrix:
13        os: [ubuntu-22.04]
14        contrib:
15          - brotli
16          - c-blosc
17          - jsonnet
18          - libidn2
19          - libraw
20          - libtiff
21          - libxls
22          - libzip
23          - lodepng
24          - pffft
25        ignore-errors: [true]
26        include:
27          - compiler: clang
28            compiler-version: 11
29            libclang-version: 11
30          - compiler: gcc
31            compiler-version: 10
32            libclang-version: 11
33    runs-on: ${{ matrix.os }}
34    continue-on-error: ${{ matrix.ignore-errors }}
35
36    steps:
37    - uses: actions/checkout@v3
38
39    - name: Cache dependencies
40      uses: actions/cache@v3
41      with:
42        key: ${{matrix.os}}-${{matrix.compiler}}${{matrix.compiler-version}}
43        path: |
44          ${{github.workspace}}/build/_deps
45          !${{github.workspace}}/build/_deps/${{matrix.contrib}}-*/**
46
47    - name: Cache dependencies (contrib)
48      uses: actions/cache@v3
49      with:
50        key: ${{matrix.os}}-${{matrix.compiler}}${{matrix.compiler-version}}-${{matrix.contrib}}
51        path: |
52          ${{github.workspace}}/build/_deps/${{matrix.contrib}}-*/**
53
54    - name: Install ninja-build tool
55      uses: turtlesec-no/get-ninja@1.1.0
56
57    - name: Install/configure Clang compiler toolchain
58      if: matrix.compiler == 'clang'
59      run: |
60        sudo apt-get install -qy \
61          clang-${{matrix.compiler-version}} \
62          libclang1-${{matrix.libclang-version}} \
63          python3-clang-${{matrix.libclang-version}}
64        echo "CXX=clang++-${{matrix.compiler-version}}" >> $GITHUB_ENV
65        echo "CC=clang-${{matrix.compiler-version}}" >> $GITHUB_ENV
66
67    - name: Install/configure GCC compiler toolchain
68      if: matrix.compiler == 'gcc'
69      run: |
70        sudo apt-get install -qy \
71          g++-${{matrix.compiler-version}} \
72          libclang1-${{matrix.libclang-version}} \
73          python3-clang-${{matrix.libclang-version}}
74        echo "CXX=g++-${{matrix.compiler-version}}" >> $GITHUB_ENV
75        echo "CC=gcc-${{matrix.compiler-version}}" >> $GITHUB_ENV
76
77    - name: Install extra dependencies for contrib
78      if: matrix.contrib == 'libidn2'
79      run: |
80        sudo apt-get install -qy libidn2-dev libunistring-dev
81
82    - name: Install extra dependencies for contrib
83      if: matrix.contrib == 'libxls'
84      run: |
85        sudo apt-get install -qy autoconf-archive gettext
86
87    - name: Create Build Environment
88      run: |
89        pip3 install absl-py
90        cmake -E make_directory $GITHUB_WORKSPACE/build
91
92    - name: Configure CMake
93      run: |
94        cmake \
95          -S $GITHUB_WORKSPACE/contrib/${{matrix.contrib}} \
96          -B $GITHUB_WORKSPACE/build \
97          -G Ninja \
98          -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
99          -DSAPI_BUILD_TESTING=ON \
100          -DSAPI_BUILD_EXAMPLES=ON
101
102    - name: Build
103      run: |
104        cmake \
105          --build $GITHUB_WORKSPACE/build \
106          --config $BUILD_TYPE
107
108    - name: Test
109      run: |
110        ctest \
111          --test-dir $GITHUB_WORKSPACE/build \
112          -C $BUILD_TYPE \
113          -E "^(sapi_|sandbox2_|regression_test)" \
114          --output-on-failure
115