• 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          - compiler: gcc
30            compiler-version: 10
31    runs-on: ${{ matrix.os }}
32    continue-on-error: ${{ matrix.ignore-errors }}
33
34    steps:
35    - uses: actions/checkout@v3
36
37    - name: Cache dependencies
38      uses: actions/cache@v3
39      with:
40        key: ${{matrix.os}}-${{matrix.compiler}}${{matrix.compiler-version}}
41        path: |
42          ${{github.workspace}}/build/_deps
43          !${{github.workspace}}/build/_deps/${{matrix.contrib}}-*/**
44
45    - name: Cache dependencies (contrib)
46      uses: actions/cache@v3
47      with:
48        key: ${{matrix.os}}-${{matrix.compiler}}${{matrix.compiler-version}}-${{matrix.contrib}}
49        path: |
50          ${{github.workspace}}/build/_deps/${{matrix.contrib}}-*/**
51
52    - name: Install ninja-build tool
53      uses: turtlesec-no/get-ninja@1.1.0
54
55    - name: Install/configure Clang compiler toolchain
56      if: matrix.compiler == 'clang'
57      run: |
58        sudo apt-get install -qy clang-${{matrix.compiler-version}}
59        echo "CXX=clang++-${{matrix.compiler-version}}" >> $GITHUB_ENV
60        echo "CC=clang-${{matrix.compiler-version}}" >> $GITHUB_ENV
61
62    - name: Install/configure GCC compiler toolchain
63      if: matrix.compiler == 'gcc'
64      run: |
65        sudo apt-get install -qy g++-${{matrix.compiler-version}}
66        echo "CXX=g++-${{matrix.compiler-version}}" >> $GITHUB_ENV
67        echo "CC=gcc-${{matrix.compiler-version}}" >> $GITHUB_ENV
68
69    - name: Install extra dependencies for contrib
70      if: matrix.contrib == 'libidn2'
71      run: |
72        sudo apt-get install -qy libidn2-dev libunistring-dev
73
74    - name: Install extra dependencies for contrib
75      if: matrix.contrib == 'libxls'
76      run: |
77        sudo apt-get install -qy autoconf-archive gettext
78
79    - name: Create Build Environment
80      run: |
81        pip3 install absl-py 'clang>=14,<15'
82        cmake -E make_directory $GITHUB_WORKSPACE/build
83
84    - name: Configure CMake
85      run: |
86        cmake \
87          -S $GITHUB_WORKSPACE/contrib/${{matrix.contrib}} \
88          -B $GITHUB_WORKSPACE/build \
89          -G Ninja \
90          -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
91          -DSAPI_BUILD_TESTING=ON \
92          -DSAPI_BUILD_EXAMPLES=ON
93
94    - name: Build
95      run: |
96        cmake \
97          --build $GITHUB_WORKSPACE/build \
98          --config $BUILD_TYPE
99
100    - name: Test
101      run: |
102        ctest \
103          --test-dir $GITHUB_WORKSPACE/build \
104          -C $BUILD_TYPE \
105          -E "^(sapi_|sandbox2_|regression_test)" \
106          --output-on-failure
107