2022-01-04 21:07:37 +08:00
|
|
|
name: CMake Ubuntu
|
2020-12-09 20:14:07 +08:00
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
env:
|
|
|
|
BUILD_TYPE: Release
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
2021-04-07 19:23:48 +08:00
|
|
|
fail-fast: false
|
2020-12-09 20:14:07 +08:00
|
|
|
matrix:
|
2021-04-07 19:23:48 +08:00
|
|
|
include:
|
2022-06-09 17:03:07 +08:00
|
|
|
- os: ubuntu-22.04
|
|
|
|
compiler: clang
|
|
|
|
compiler-version: 11
|
|
|
|
# Ubuntu 22.04 is in beta
|
|
|
|
ignore-errors: true
|
|
|
|
- os: ubuntu-22.04
|
|
|
|
compiler: gcc
|
|
|
|
compiler-version: 11
|
|
|
|
# Ubuntu 22.04 is in beta
|
|
|
|
ignore-errors: true
|
2021-04-07 19:23:48 +08:00
|
|
|
- os: ubuntu-20.04
|
|
|
|
compiler: clang
|
|
|
|
compiler-version: 11
|
|
|
|
ignore-errors: false
|
|
|
|
- os: ubuntu-20.04
|
|
|
|
compiler: clang
|
|
|
|
compiler-version: 10
|
|
|
|
ignore-errors: false
|
|
|
|
- os: ubuntu-18.04
|
|
|
|
compiler: clang
|
|
|
|
compiler-version: "6.0"
|
|
|
|
# This compiler is supported only on a best-effort basis
|
|
|
|
ignore-errors: true
|
|
|
|
- os: ubuntu-20.04
|
|
|
|
compiler: gcc
|
|
|
|
compiler-version: 10
|
|
|
|
ignore-errors: false
|
|
|
|
- os: ubuntu-20.04
|
|
|
|
compiler: gcc
|
|
|
|
compiler-version: 9
|
|
|
|
ignore-errors: false
|
|
|
|
- os: ubuntu-18.04
|
|
|
|
compiler: gcc
|
|
|
|
compiler-version: 7
|
|
|
|
ignore-errors: false
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
continue-on-error: ${{ matrix.ignore-errors }}
|
2020-12-09 20:14:07 +08:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2022-03-02 19:06:40 +08:00
|
|
|
- name: Cache dependencies
|
2022-04-05 21:11:54 +08:00
|
|
|
uses: actions/cache@v3
|
2022-03-02 19:06:40 +08:00
|
|
|
with:
|
|
|
|
key: ${{matrix.os}}-${{matrix.compiler}}${{matrix.compiler-version}}
|
|
|
|
path: |
|
2022-04-05 21:11:54 +08:00
|
|
|
${{github.workspace}}/build/_deps
|
2022-03-02 19:06:40 +08:00
|
|
|
|
2020-12-09 20:14:07 +08:00
|
|
|
- name: Install ninja-build tool
|
|
|
|
uses: seanmiddleditch/gha-setup-ninja@v3
|
|
|
|
|
2021-04-07 19:23:48 +08:00
|
|
|
- name: Install/configure Clang compiler toolchain
|
|
|
|
if: matrix.compiler == 'clang'
|
|
|
|
run: |
|
|
|
|
sudo apt-get install -qy clang-${{matrix.compiler-version}}
|
|
|
|
echo "CXX=clang++-${{matrix.compiler-version}}" >> $GITHUB_ENV
|
|
|
|
echo "CC=clang-${{matrix.compiler-version}}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install/configure GCC compiler toolchain
|
|
|
|
if: matrix.compiler == 'gcc'
|
|
|
|
run: |
|
|
|
|
sudo apt-get install -qy g++-${{matrix.compiler-version}}
|
|
|
|
echo "CXX=g++-${{matrix.compiler-version}}" >> $GITHUB_ENV
|
|
|
|
echo "CC=gcc-${{matrix.compiler-version}}" >> $GITHUB_ENV
|
|
|
|
|
2020-12-09 20:14:07 +08:00
|
|
|
- name: Create Build Environment
|
|
|
|
run: |
|
2020-12-16 16:08:56 +08:00
|
|
|
pip3 install absl-py clang
|
2022-02-14 21:56:49 +08:00
|
|
|
cmake -E make_directory $GITHUB_WORKSPACE/build
|
2020-12-09 20:14:07 +08:00
|
|
|
|
|
|
|
- name: Configure CMake
|
2022-02-14 21:56:49 +08:00
|
|
|
run: |
|
2022-04-05 21:11:54 +08:00
|
|
|
cmake \
|
|
|
|
-S $GITHUB_WORKSPACE \
|
|
|
|
-B $GITHUB_WORKSPACE/build \
|
|
|
|
-G Ninja \
|
|
|
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
2020-12-09 20:14:07 +08:00
|
|
|
|
|
|
|
- name: Build
|
2022-02-14 21:56:49 +08:00
|
|
|
run: |
|
2022-04-05 21:11:54 +08:00
|
|
|
cmake \
|
|
|
|
--build $GITHUB_WORKSPACE/build \
|
|
|
|
--config $BUILD_TYPE
|
2020-12-09 20:14:07 +08:00
|
|
|
|
2022-02-14 21:56:49 +08:00
|
|
|
- name: Test
|
|
|
|
run: |
|
2022-04-05 21:11:54 +08:00
|
|
|
ctest \
|
|
|
|
--test-dir $GITHUB_WORKSPACE/build \
|
|
|
|
-C $BUILD_TYPE \
|
|
|
|
--output-on-failure \
|
2022-02-14 21:56:49 +08:00
|
|
|
-R SapiTest
|