• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: fedora-cmake
2
3on: [push, pull_request]
4
5env:
6  BUILD_TYPE: Release
7
8jobs:
9  build:
10    strategy:
11      fail-fast: false
12      matrix:
13        include:
14          - container: fedora:38
15            compiler: gcc
16            compiler-version: 13
17            ignore-errors: false
18          - container: fedora:38
19            compiler: clang
20            compiler-version: 16
21            ignore-errors: false
22    runs-on: ubuntu-latest
23    continue-on-error: ${{ matrix.ignore-errors }}
24
25    env:
26      RUN_CMD: docker exec --tty ${{matrix.compiler}}-build-container
27
28    steps:
29    - uses: actions/checkout@v3
30
31    - name: Cache dependencies
32      uses: actions/cache@v3
33      with:
34        key: ${{matrix.container}}-${{matrix.compiler}}${{matrix.compiler-version}}
35        path: |
36          ${{github.workspace}}/build/_deps
37
38    - name: Prepare container
39      # Note: For the sandbox tests to work, we need a privileged, unconfined
40      #       container that retains its capabilities.
41      run: |
42        docker run --name ${{matrix.compiler}}-build-container \
43          --tty \
44          --privileged \
45          --cap-add ALL \
46          --security-opt apparmor:unconfined \
47          -v $GITHUB_WORKSPACE:$GITHUB_WORKSPACE \
48          -e TERM=dumb \
49          -e BUILD_TYPE \
50          -e GITHUB_WORKSPACE \
51          -d ${{matrix.container}} \
52          sleep infinity
53
54    - name: Install build tools
55      run: |
56        $RUN_CMD dnf update -y --quiet
57        $RUN_CMD dnf install -y --quiet \
58          git make automake diffutils file patch glibc-static \
59          libstdc++-static cmake ninja-build python3 python3-pip \
60          python3-clang clang-devel libcap-devel
61
62    - name: Create Build Environment
63      run: |
64        $RUN_CMD pip3 install --progress-bar=off absl-py
65        $RUN_CMD cmake -E make_directory $GITHUB_WORKSPACE/build
66
67    - name: Configure CMake
68      run: |
69        $RUN_CMD cmake \
70          -S $GITHUB_WORKSPACE \
71          -B $GITHUB_WORKSPACE/build \
72          -G Ninja \
73          -DCMAKE_BUILD_TYPE=$BUILD_TYPE
74
75    - name: Build
76      run: |
77        $RUN_CMD cmake \
78          --build $GITHUB_WORKSPACE/build \
79          --config $BUILD_TYPE
80
81    - name: Test
82      run: |
83        $RUN_CMD ctest \
84          --test-dir $GITHUB_WORKSPACE/build \
85          -C $BUILD_TYPE \
86          --output-on-failure \
87          -R SapiTest
88