Skip to content

Commit

Permalink
github: Add continuous integration workflow
Browse files Browse the repository at this point in the history
Add Github Actions workflow and actions to run the automated
libseccomp tests and gather code coverage metrics.

Signed-off-by: Tom Hromatka <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
drakenclimber authored and pcmoore committed Jul 27, 2021
1 parent 947ecc8 commit fe06841
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# Github Action to setup the libcgroup directory
#
# Copyright (c) 2021 Oracle and/or its affiliates.
# Author: Tom Hromatka <[email protected]>
#

#
# This library is free software; you can redistribute it and/or modify it
# under the terms of version 2.1 of the GNU Lesser General Public License as
# published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
# for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, see <http:https://www.gnu.org/licenses>.
#

name: Setup the libseccomp directory
description: "Install dependencies and configure libseccomp"
runs:
using: "composite"
steps:
- run: sudo apt-get install -y build-essential valgrind clang-tools lcov gperf astyle codespell
shell: bash
- run: |
sudo apt-get install -y python3 python3-distutils python3-setuptools python3-pip
python3 -m pip install --upgrade pip
python3 -m pip install cython
# Add cython to the path
echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
- run: |
./autogen.sh
shell: bash
100 changes: 100 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#
# Continuous Integration Workflow for libseccomp
#
# Copyright (c) 2021 Oracle and/or its affiliates.
# Author: Tom Hromatka <[email protected]>
#

#
# This library is free software; you can redistribute it and/or modify it
# under the terms of version 2.1 of the GNU Lesser General Public License as
# published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
# for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, see <http:https://www.gnu.org/licenses>.
#

name: Continuous Integration
on: ["push", "pull_request"]

jobs:
tests:
name: Tests
runs-on: ubuntu-20.04

steps:
- name: Checkout from github
uses: actions/checkout@v2
- name: Initialize libseccomp
uses: ./.github/actions/setup
- name: Build libseccomp
run: |
./configure --enable-python
make check-build
- name: Run tests
run: LIBSECCOMP_TSTCFG_STRESSCNT=5 make check

livetests:
name: Live Tests
runs-on: ubuntu-20.04

steps:
- name: Checkout from github
uses: actions/checkout@v2
- name: Initialize libseccomp
uses: ./.github/actions/setup
- name: Build libseccomp
run: |
./configure --enable-python
make check-build
- name: Run live tests
run: LIBSECCOMP_TSTCFG_TYPE=live LIBSECCOMP_TSTCFG_MODE_LIST=c make -C tests check

scanbuild:
name: Scan Build
runs-on: ubuntu-20.04

steps:
- name: Checkout from github
uses: actions/checkout@v2
- name: Initialize libseccomp
uses: ./.github/actions/setup
- name: Run scan-build
run: |
./configure
scan-build --status-bugs make
codecoverage:
name: Code Coverage
runs-on: ubuntu-20.04

steps:
- name: Checkout from github
uses: actions/checkout@v2
- name: Initialize libseccomp
uses: ./.github/actions/setup
- name: Configure libseccomp
run: |
./configure --enable-code-coverage
- name: Run tests with code coverage enabled
run: |
make test-code-coverage
- name: Gather code coverage results
run: lcov -c --exclude tests --exclude tools --exclude src/arch-syscall-check.c -d . -o lcov.info
- name: Upload code coverage results
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov.info
flag-name: "amd64"
- name: Archive code coverage results
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: Code Coverage Artifacts
path: lcov.*

0 comments on commit fe06841

Please sign in to comment.