mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
CI: Run tests in VM based builders
This adds a first basic test to be run using GitHub Actions on push and pull request for the CMake build (internally we run everything on Bazel/Blaze). The Ubuntu runners are implemented as full VMs, so we can run tests directly. In order to run Sandboxed API/Sandbox2 tests inside a container, it must be started as privileged, unconfined and retain its capabilities. Since GitHub does not support modifying the Docker invocation for container based workflows, we need to manually run the `docker` command. Until #118 is fixed, this change makes GitHub ignore the test failure on Fedora. PiperOrigin-RevId: 428485354 Change-Id: I6b55c5441c4c27b018d19498d2296c7d3da65846
This commit is contained in:
parent
d1ed8ac66e
commit
789c436a3e
53
.github/workflows/fedora-cmake.yml
vendored
53
.github/workflows/fedora-cmake.yml
vendored
|
@ -13,36 +13,55 @@ jobs:
|
||||||
include:
|
include:
|
||||||
- container: fedora:35
|
- container: fedora:35
|
||||||
compiler: gcc # GCC 11
|
compiler: gcc # GCC 11
|
||||||
ignore-errors: false
|
ignore-errors: true # Stack trace test fails on Fedora (issue #118)
|
||||||
# TODO(cblichmann): Add clang-13 build to matrix (currently fails)
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
continue-on-error: ${{ matrix.ignore-errors }}
|
continue-on-error: ${{ matrix.ignore-errors }}
|
||||||
|
|
||||||
container:
|
env:
|
||||||
image: ${{ matrix.container }}
|
RUN_CMD: docker exec --tty ${{matrix.compiler}}-build-container
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- 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
|
- name: Install build tools
|
||||||
run: |
|
run: |
|
||||||
dnf update -y
|
$RUN_CMD dnf update -y --quiet
|
||||||
dnf install -y git make automake patch glibc-static libstdc++-static \
|
$RUN_CMD dnf install -y --quiet git make automake patch glibc-static \
|
||||||
cmake ninja-build python3 python3-pip clang-devel libcap-devel
|
libstdc++-static cmake ninja-build python3 python3-pip clang-devel \
|
||||||
|
libcap-devel
|
||||||
- name: Install/configure Clang compiler toolchain
|
|
||||||
if: matrix.compiler == 'clang'
|
|
||||||
run: |
|
|
||||||
echo "CXX=clang++" >> $GITHUB_ENV
|
|
||||||
echo "CC=clang" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Create Build Environment
|
- name: Create Build Environment
|
||||||
run: |
|
run: |
|
||||||
pip3 install absl-py clang
|
$RUN_CMD pip3 install --progress-bar=off absl-py clang
|
||||||
cmake -E make_directory $GITHUB_WORKSPACE/build
|
$RUN_CMD cmake -E make_directory $GITHUB_WORKSPACE/build
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
run: |
|
||||||
|
$RUN_CMD cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build \
|
||||||
|
-G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build $GITHUB_WORKSPACE --config $BUILD_TYPE
|
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
|
||||||
|
|
18
.github/workflows/ubuntu-cmake.yml
vendored
18
.github/workflows/ubuntu-cmake.yml
vendored
|
@ -62,17 +62,17 @@ jobs:
|
||||||
- name: Create Build Environment
|
- name: Create Build Environment
|
||||||
run: |
|
run: |
|
||||||
pip3 install absl-py clang
|
pip3 install absl-py clang
|
||||||
cmake -E make_directory ${{runner.workspace}}/build
|
cmake -E make_directory $GITHUB_WORKSPACE/build
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
working-directory: ${{runner.workspace}}/build
|
run: |
|
||||||
run: cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
working-directory: ${{runner.workspace}}/build
|
run: |
|
||||||
run: cmake --build . --config $BUILD_TYPE
|
cmake --build $GITHUB_WORKSPACE --config $BUILD_TYPE
|
||||||
|
|
||||||
# TODO(cblichmann): Before enabling this, make sure all OSS tests pass
|
- name: Test
|
||||||
#- name: Test
|
run: |
|
||||||
# working-directory: ${{runner.workspace}}/build
|
ctest $GITHUB_WORKSPACE -C $BUILD_TYPE --output-on-failure \
|
||||||
# run: ctest -C $BUILD_TYPE
|
-R SapiTest
|
||||||
|
|
Loading…
Reference in New Issue
Block a user