mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
6de30ea27f
This will speed up our builds a bit and prevent unnecessary network traffic. Setup according to the documentation for the `actions/cache@v2` action: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows Currently caching the `${{github.workspace}}/_deps` directory, as used by CMake. Cache keys look like this: `ubuntu-20.04-clang11` (`${{matrix.os}-${{matrix.compiler}}${matrix.compiler-version}}`) PiperOrigin-RevId: 431895214 Change-Id: I4ecac7c00eec8516f85f45aa2220303b811b2389
76 lines
2.2 KiB
YAML
76 lines
2.2 KiB
YAML
name: CMake Fedora
|
|
|
|
on: [push, pull_request]
|
|
|
|
env:
|
|
BUILD_TYPE: Release
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- container: fedora:35
|
|
compiler: gcc
|
|
compiler-version: 11 # Only used in cache action so far
|
|
ignore-errors: true # Stack trace test fails on Fedora (issue #118)
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: ${{ matrix.ignore-errors }}
|
|
|
|
env:
|
|
RUN_CMD: docker exec --tty ${{matrix.compiler}}-build-container
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
key: ${{matrix.container}}-${{matrix.compiler}}${{matrix.compiler-version}}
|
|
path: |
|
|
${{github.workspace}}/_deps
|
|
|
|
- name: Prepare container
|
|
# Note: For the sandbox tests to work, we need a privileged, unconfined
|
|
# container that retains its capabilities.
|
|
run: |
|
|
docker run --name ${{matrix.compiler}}-build-container \
|
|
--tty \
|
|
--privileged \
|
|
--cap-add ALL \
|
|
--security-opt apparmor:unconfined \
|
|
-v $GITHUB_WORKSPACE:$GITHUB_WORKSPACE \
|
|
-e TERM=dumb \
|
|
-e BUILD_TYPE \
|
|
-e GITHUB_WORKSPACE \
|
|
-d ${{matrix.container}} \
|
|
sleep infinity
|
|
|
|
- name: Install build tools
|
|
run: |
|
|
$RUN_CMD dnf update -y --quiet
|
|
$RUN_CMD dnf install -y --quiet git make automake patch glibc-static \
|
|
libstdc++-static cmake ninja-build python3 python3-pip clang-devel \
|
|
libcap-devel
|
|
|
|
- name: Create Build Environment
|
|
run: |
|
|
$RUN_CMD pip3 install --progress-bar=off absl-py clang
|
|
$RUN_CMD cmake -E make_directory $GITHUB_WORKSPACE/build
|
|
|
|
- name: Configure CMake
|
|
run: |
|
|
$RUN_CMD cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build \
|
|
-G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
|
|
|
- name: Build
|
|
run: |
|
|
$RUN_CMD cmake --build $GITHUB_WORKSPACE/build --config $BUILD_TYPE
|
|
|
|
- name: Test
|
|
run: |
|
|
$RUN_CMD ctest --test-dir $GITHUB_WORKSPACE/build -C $BUILD_TYPE \
|
|
--output-on-failure \
|
|
-R SapiTest
|