GitHub Actions
This commit is contained in:
parent
fd3e9e3051
commit
0bc4325222
92
.github/workflows/tests.yml
vendored
Normal file
92
.github/workflows/tests.yml
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
name: tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: ./scripts/clang-format-check
|
||||
|
||||
autotools:
|
||||
strategy:
|
||||
matrix:
|
||||
os: ["ubuntu-latest", "macos-latest"]
|
||||
cc: ["gcc", "clang"]
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
steps:
|
||||
- if: ${{runner.os == 'macOS'}}
|
||||
run: brew install autoconf automake libtool
|
||||
- uses: actions/checkout@v2
|
||||
- run: autoreconf -fi
|
||||
- env:
|
||||
CC: ${{matrix.cc}}
|
||||
CFLAGS: -Werror
|
||||
run: ./configure
|
||||
- run: make check
|
||||
|
||||
cmake:
|
||||
strategy:
|
||||
matrix:
|
||||
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
|
||||
cc: ["gcc", "clang"]
|
||||
exclude:
|
||||
- os: windows-latest
|
||||
cc: gcc
|
||||
- os: windows-latest
|
||||
cc: clang
|
||||
include:
|
||||
- os: windows-latest
|
||||
cc: 'msvc' # Doesn't really matter, MSVC is always used on Windows
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- env:
|
||||
CC: ${{matrix.cc}}
|
||||
run: cmake .
|
||||
- run: cmake --build .
|
||||
- run: ctest
|
||||
|
||||
valgrind:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: sudo apt update && sudo apt install valgrind
|
||||
- run: cmake -DJANSSON_TEST_WITH_VALGRIND=ON .
|
||||
- run: cmake --build .
|
||||
- run: ctest
|
||||
|
||||
coveralls:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: sudo apt update && sudo apt install curl lcov
|
||||
- run: cmake -DJANSSON_COVERAGE=ON -DJANSSON_COVERALLS=ON -DCMAKE_BUILD_TYPE=Debug
|
||||
- run: cmake --build .
|
||||
- run: cmake --build . --target coveralls
|
||||
|
||||
fuzz:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: |
|
||||
git clone https://github.com/google/oss-fuzz.git /tmp/ossfuzz
|
||||
if [ "$GITHUB_HEAD_REF" ]; then
|
||||
BRANCH=${GITHUB_HEAD_REF##*/}
|
||||
else
|
||||
BRANCH=${GITHUB_REF##*/}
|
||||
fi
|
||||
sed -i "s@https://github.com/akheron/jansson.git@-b $BRANCH https://github.com/${{github.repository}}.git@" /tmp/ossfuzz/projects/jansson/Dockerfile
|
||||
pushd /tmp/ossfuzz
|
||||
python infra/helper.py build_image --pull jansson
|
||||
python infra/helper.py build_fuzzers jansson
|
||||
popd
|
@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
PROJECT_NAME=jansson
|
||||
|
||||
# Clone the oss-fuzz repository
|
||||
git clone https://github.com/google/oss-fuzz.git /tmp/ossfuzz
|
||||
|
||||
if [[ ! -d /tmp/ossfuzz/projects/${PROJECT_NAME} ]]
|
||||
then
|
||||
echo "Could not find the ${PROJECT_NAME} project in ossfuzz"
|
||||
|
||||
# Exit with a success code while the jansson project is not expected to exist
|
||||
# on oss-fuzz.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Work out which repo to clone from, inside Docker
|
||||
if [[ ${TRAVIS_PULL_REQUEST} != "false" ]]
|
||||
then
|
||||
# Pull-request branch
|
||||
REPO=${TRAVIS_PULL_REQUEST_SLUG}
|
||||
BRANCH=${TRAVIS_PULL_REQUEST_BRANCH}
|
||||
else
|
||||
# Push build.
|
||||
REPO=${TRAVIS_REPO_SLUG}
|
||||
BRANCH=${TRAVIS_BRANCH}
|
||||
fi
|
||||
|
||||
# Modify the oss-fuzz Dockerfile so that we're checking out the current branch on travis.
|
||||
sed -i "s@https://github.com/akheron/jansson.git@-b ${BRANCH} https://github.com/${REPO}.git@" /tmp/ossfuzz/projects/${PROJECT_NAME}/Dockerfile
|
||||
|
||||
# Try and build the fuzzers
|
||||
pushd /tmp/ossfuzz
|
||||
python infra/helper.py build_image --pull ${PROJECT_NAME}
|
||||
python infra/helper.py build_fuzzers ${PROJECT_NAME}
|
||||
popd
|
Loading…
Reference in New Issue
Block a user