From 36032719b1e10ad4029d6a183228f1394b79de11 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 12 Oct 2021 21:25:44 -0400 Subject: [PATCH] CI: convert Travis to GH actions With Travis shutdown, convert our flows over to GH actions. Change-Id: Ia4d358dbbf3d8a73c347f4b9e4cd4637ce44e594 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3216116 Reviewed-by: Mark Mentovai --- .github/workflows/build-test-ci.yml | 65 +++++++++++++++++++++++++++ .github/workflows/coverity.yml | 36 +++++++++++++++ .travis.yml | 34 -------------- README.md | 2 +- scripts/travis-build.sh | 70 ----------------------------- scripts/travis-checkout.sh | 24 ---------- 6 files changed, 102 insertions(+), 129 deletions(-) create mode 100644 .github/workflows/build-test-ci.yml create mode 100644 .github/workflows/coverity.yml delete mode 100644 .travis.yml delete mode 100755 scripts/travis-build.sh delete mode 100755 scripts/travis-checkout.sh diff --git a/.github/workflows/build-test-ci.yml b/.github/workflows/build-test-ci.yml new file mode 100644 index 00000000..75f6ca21 --- /dev/null +++ b/.github/workflows/build-test-ci.yml @@ -0,0 +1,65 @@ +# GitHub actions workflow. +# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions + +name: Build+Test CI + +on: + push: + branches: [main] + +jobs: + autotools: + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + cc: gcc + cxx: g++ + - os: ubuntu-latest + cc: clang + cxx: clang++ + - os: macos-latest + cc: clang + cxx: clang++ + runs-on: ${{ matrix.os }} + env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} + + steps: + - name: System settings + run: | + set -x + $CC --version + $CXX --version + getconf _NPROCESSORS_ONLN + getconf _NPROCESSORS_CONF + true + + - name: Checkout depot_tools + run: git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git ../depot_tools + + - name: Checkout breakpad + run: | + set -xe + PATH+=:$PWD/../depot_tools + gclient config --unmanaged --name=src https://github.com/${{ github.repository }} + gclient sync --no-history --nohooks + + # First build & test in-tree. + - run: ./configure --disable-silent-rules + working-directory: src + - run: make -j$(getconf _NPROCESSORS_CONF) + working-directory: src + - run: make -j$(getconf _NPROCESSORS_CONF) check VERBOSE=1 + working-directory: src + - run: make -j$(getconf _NPROCESSORS_CONF) distclean + working-directory: src + + # Then build & test out-of-tree. + - run: mkdir -p src/build/native + - run: ../../configure --disable-silent-rules + working-directory: src/build/native + - run: make -j$(getconf _NPROCESSORS_CONF) distcheck VERBOSE=1 + working-directory: src/build/native diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml new file mode 100644 index 00000000..84e6edaf --- /dev/null +++ b/.github/workflows/coverity.yml @@ -0,0 +1,36 @@ +# GitHub actions workflow. +# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions + +# https://scan.coverity.com/projects/gentoo-pax-utils +name: Coverity Scan + +on: + push: + branches: [main] + +jobs: + coverity: + runs-on: ubuntu-latest + env: + CC: clang + CXX: clang++ + steps: + - name: Checkout depot_tools + run: git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git ../depot_tools + + - name: Checkout breakpad + run: | + set -xe + PATH+=:$PWD/../depot_tools + gclient config --unmanaged --name=src https://github.com/${{ github.repository }} + gclient sync --no-history --nohooks + + - run: ./configure --disable-silent-rules + working-directory: src + + - uses: vapier/coverity-scan-action@v0 + with: + project: google%2Fbreakpad + command: make -C src -O -j$(getconf _NPROCESSORS_CONF) + email: google-breakpad-dev@googlegroups.com + token: ${{ secrets.COVERITY_SCAN_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 628362d2..00000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Travis build integration. -# https://docs.travis-ci.com/ -language: cpp - -sudo: required - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - clang - - gcc-4.8 - - g++-4.8 - -env: - global: - - secure: "FPczJ1u7FWGXOtUVf5AONeexfQDYnKRtuNs3phLwlPPAbgAlIc/WeTRSHC8DAb1T8IyPdN3Zi7cqLz0dvPol0iX1fWSfr8YdtW0ea8nUYH5ldmmp6H75FEUJUcISmYwL4WN7TldC6Hnzrlbw/0xmBH8gtAgddtBXKc9P9SwEZvM4OiFMHbMPwZEhRj+D95rfH12lgh3D16nbXGnx3rSNbHszvIxrU2VvlLo9Aa+hbmVj5CsBiNJjhDS64ie+VMTkuzcWNqLRYaGOCQ8ftKAlj/fjGfoKjPDN9dSJg9gW1FjOMPeQo93qhSc/hCmTq7sWxBJu48telinUgESdE5q/8gRf5J05ImWPntZAkC/wQkA20K7Kp/fH1CRaYXQMWKjts8c6dQZ5R4WxE4WXUo5rz573Ti9uyVTLys9whnzaib3YbqYv04irkhpgzo3rd8PF8SXpgK99ySQCcv/Dh7UQuXPpcaknOk2mBySXjQDgpQHHXDN2uUek1HEo5xit8fQuQw3TdPIZ9ZgzQ/c5/Dx6sLWAGEfVH9MN+hy6AiZnJ1JI+XF82kAf1pnf8WddHtlE7pAdWRFQt0iOj9T9esV1/o0VCJVzJLRdpKecF0sTpJxDuan6cFI0tNCkNjHFA5wJKYAvdOPAmYkqre7aIIqSOKy3Fjh9JP9CBJFy7eals9U=" - -# TODO: Add an OS X config. -matrix: - include: - - os: linux - compiler: gcc - env: USE_CC=gcc-4.8 USE_CXX=g++-4.8 COVERITY_SCAN=true - - os: linux - compiler: clang - -before_install: ./scripts/travis-checkout.sh -script: ./scripts/travis-build.sh - -notifications: - email: - - google-breakpad-dev@googlegroups.com diff --git a/README.md b/README.md index edc28573..a9094a27 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ crash-reporting system. * [Bugs](https://bugs.chromium.org/p/google-breakpad/) * Discussion/Questions: [google-breakpad-discuss@googlegroups.com](https://groups.google.com/d/forum/google-breakpad-discuss) * Developer/Reviews: [google-breakpad-dev@googlegroups.com](https://groups.google.com/d/forum/google-breakpad-dev) -* Tests: [![Build Status](https://travis-ci.org/google/breakpad.svg?branch=main)](https://travis-ci.org/google/breakpad) [![Build status](https://ci.appveyor.com/api/projects/status/eguv4emv2rhq68u2?svg=true)](https://ci.appveyor.com/project/vapier/breakpad) +* Tests: [![Build+Test CI](https://github.com/google/breakpad/actions/workflows/build-test-ci.yml/badge.svg)](https://github.com/google/breakpad/actions/workflows/build-test-ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/eguv4emv2rhq68u2?svg=true)](https://ci.appveyor.com/project/vapier/breakpad) * Coverage [![Coverity Status](https://scan.coverity.com/projects/9215/badge.svg)](https://scan.coverity.com/projects/google-breakpad) ## Getting started (from main) diff --git a/scripts/travis-build.sh b/scripts/travis-build.sh deleted file mode 100755 index 1d1beb3d..00000000 --- a/scripts/travis-build.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -set -ex - -setup_env() { - # Travis sets CC/CXX to the system toolchain, so our .travis.yml - # exports USE_{CC,CXX} for this script to use. - if [ -n "$USE_CC" ]; then - export CC=$USE_CC - fi - if [ -n "$USE_CXX" ]; then - export CXX=$USE_CXX - fi - # Use -jN for faster builds. Travis build machines under Docker - # have a lot of cores, but are memory-limited, so the kernel - # will OOM if we try to use them all, so use at most 4. - # See https://github.com/travis-ci/travis-ci/issues/1972 - export NCPUS=$(getconf _NPROCESSORS_ONLN) - export JOBS=$(( $NCPUS < 4 ? $NCPUS : 4 )) -} - -# We have to do this by hand rather than use the coverity addon because of -# matrix explosion: https://github.com/travis-ci/travis-ci/issues/1975 -# We also do it by hand because when we're throttled, the addon will exit -# the build immediately and skip the main script! -coverity_scan() { - if [ "${COVERITY_SCAN}" != "true" ] || \ - [ -n "${TRAVIS_TAG}" ] || \ - [ "${TRAVIS_PULL_REQUEST}" = "true" ] - then - echo "Skipping coverity scan." - return - fi - - export COVERITY_SCAN_PROJECT_NAME="${TRAVIS_REPO_SLUG}" - export COVERITY_SCAN_NOTIFICATION_EMAIL="google-breakpad-dev@googlegroups.com" - export COVERITY_SCAN_BUILD_COMMAND="make -j${JOBS}" - export COVERITY_SCAN_BUILD_COMMAND_PREPEND="git clean -q -x -d -f; git checkout -f; ./configure" - export COVERITY_SCAN_BRANCH_PATTERN="master" - - curl -s "https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh" | bash || : -} - -# Do an in-tree build and make sure tests pass. -build() { - ./configure --with-tests-as-root - make -j${JOBS} check VERBOSE=1 - make distclean -} - -# Do an out-of-tree build and make sure we can create a release tarball. -build_out_of_tree() { - mkdir -p build/native - pushd build/native >/dev/null - ../../configure --with-tests-as-root - make -j${JOBS} distcheck VERBOSE=1 - popd >/dev/null -} - -main() { - setup_env - build - build_out_of_tree - - # Do scans last as they like to dirty the tree and some tests - # expect a clean tree (like code style checks). - coverity_scan -} - -main "$@" diff --git a/scripts/travis-checkout.sh b/scripts/travis-checkout.sh deleted file mode 100755 index e5b33324..00000000 --- a/scripts/travis-checkout.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -set -ex - -get_depot_tools() { - cd - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git - PATH="$HOME/depot_tools:$PATH" -} - -gclient_sync() { - # Rename the source dir to match what gclient expects. - srcdir=$(basename "$TRAVIS_BUILD_DIR") - cd "${TRAVIS_BUILD_DIR}"/.. - mv "${srcdir}" src - gclient config --unmanaged https://github.com/google/breakpad.git - gclient sync -} - -main() { - get_depot_tools - gclient_sync -} - -main "$@"