ci_oss.sh 1.1 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. set -ex
  3. PROJECT_NAME=libsndfile
  4. # Clone the oss-fuzz repository
  5. git clone https://github.com/google/oss-fuzz.git /tmp/ossfuzz
  6. if [[ ! -d /tmp/ossfuzz/projects/${PROJECT_NAME} ]]
  7. then
  8. echo "Could not find the ${PROJECT_NAME} project in ossfuzz"
  9. # Exit with a success code while the libsndfile project is not expected to exist
  10. # on oss-fuzz.
  11. exit 0
  12. fi
  13. # Work out which branch to clone from, inside Docker
  14. BRANCH=${GITHUB_REF}
  15. # Modify the oss-fuzz Dockerfile so that we're checking out the current reference on CI.
  16. sed -i "s@RUN.*@RUN git config --global remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*' \&\& git clone https://github.com/libsndfile/libsndfile.git /src/libsndfile \&\& cd /src/libsndfile \&\& git checkout -b ${BRANCH}@" /tmp/ossfuzz/projects/${PROJECT_NAME}/Dockerfile
  17. # Try and build the fuzzers
  18. pushd /tmp/ossfuzz
  19. python3 infra/helper.py build_image --pull ${PROJECT_NAME}
  20. python3 infra/helper.py build_fuzzers ${PROJECT_NAME}
  21. python3 infra/helper.py check_build ${PROJECT_NAME} --engine libfuzzer --sanitizer address --architecture x86_64
  22. popd