From fe18b46322727fe4bc6939326ba6bde1e0858b61 Mon Sep 17 00:00:00 2001 From: Victor Costan Date: Wed, 1 Sep 2021 16:21:26 +0000 Subject: Switch CI to GitHub Actions. PiperOrigin-RevId: 394247182 --- .appveyor.yml | 37 ------------ .github/workflows/build.yml | 135 ++++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 109 ----------------------------------- README.md | 3 +- 4 files changed, 136 insertions(+), 148 deletions(-) delete mode 100644 .appveyor.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 7229a25..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,37 +0,0 @@ -# Build matrix / environment variables are explained on: -# https://www.appveyor.com/docs/appveyor-yml/ -# This file can be validated on: https://ci.appveyor.com/tools/validate-yaml - -version: "{build}" - -environment: - matrix: - # AppVeyor currently has no custom job name feature. - # http://help.appveyor.com/discussions/questions/1623-can-i-provide-a-friendly-name-for-jobs - - JOB: Visual Studio 2019 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - CMAKE_GENERATOR: Visual Studio 16 2019 - -platform: - - x86 - - x64 - -configuration: - - RelWithDebInfo - - Debug - -build_script: - - git submodule update --init --recursive - - mkdir build - - cd build - - if "%platform%"=="x86" (set CMAKE_GENERATOR_PLATFORM="Win32") - else (set CMAKE_GENERATOR_PLATFORM="%platform%") - - cmake --version - - cmake .. -G "%CMAKE_GENERATOR%" -A "%CMAKE_GENERATOR_PLATFORM%" - -DCMAKE_CONFIGURATION_TYPES="%CONFIGURATION%" -DSNAPPY_REQUIRE_AVX2=ON - - cmake --build . --config %CONFIGURATION% - - cd .. - -test_script: - - build\%CONFIGURATION%\snappy_unittest - - build\%CONFIGURATION%\snappy_benchmark diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..fc2ad10 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,135 @@ +# Copyright 2021 Google Inc. All Rights Reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +name: ci +on: [push, pull_request] + +permissions: + contents: read + +jobs: + build-and-test: + name: >- + CI + ${{ matrix.os }} + ${{ matrix.cpu_level }} + ${{ matrix.compiler }} + ${{ matrix.optimized && 'release' || 'debug' }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + compiler: [clang, gcc, msvc] + os: [ubuntu-latest, macos-latest, windows-latest] + cpu_level: [baseline, avx, avx2] + optimized: [true, false] + exclude: + # MSVC only works on Windows. + - os: ubuntu-latest + compiler: msvc + - os: macos-latest + compiler: msvc + # GitHub servers seem to run on pre-Haswell CPUs. Attempting to use AVX2 + # results in crashes. + - os: macos-latest + cpu_level: avx2 + # Not testing with GCC on macOS. + - os: macos-latest + compiler: gcc + # Only testing with MSVC on Windows. + - os: windows-latest + compiler: clang + - os: windows-latest + compiler: gcc + include: + - compiler: clang + CC: clang + CXX: clang++ + - compiler: gcc + CC: gcc + CXX: g++ + - compiler: msvc + CC: + CXX: + + env: + CMAKE_BUILD_DIR: ${{ github.workspace }}/build + CMAKE_BUILD_TYPE: ${{ matrix.optimized && 'RelWithDebInfo' || 'Debug' }} + CC: ${{ matrix.CC }} + CXX: ${{ matrix.CXX }} + SNAPPY_REQUIRE_AVX: ${{ matrix.cpu_level == 'baseline' && '0' || '1' }} + SNAPPY_REQUIRE_AVX2: ${{ matrix.cpu_level == 'avx2' && '1' || '0' }} + SNAPPY_FUZZING_BUILD: >- + ${{ (startsWith(matrix.os, 'ubuntu') && matrix.compiler == 'clang' && + !matrix.optimized) && '1' || '0' }} + BINARY_SUFFIX: ${{ startsWith(matrix.os, 'windows') && '.exe' || '' }} + BINARY_PATH: >- + ${{ format( + startsWith(matrix.os, 'windows') && '{0}\build\{1}\' || '{0}/build/', + github.workspace, + matrix.optimized && 'RelWithDebInfo' || 'Debug') }} + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Generate build config + run: >- + cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" + -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} + -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/install_test/ + -DSNAPPY_FUZZING_BUILD=${{ env.SNAPPY_FUZZING_BUILD }} + -DSNAPPY_REQUIRE_AVX=${{ env.SNAPPY_REQUIRE_AVX }} + -DSNAPPY_REQUIRE_AVX2=${{ env.SNAPPY_REQUIRE_AVX2 }} + + - name: Build + run: >- + cmake --build "${{ env.CMAKE_BUILD_DIR }}" + --config "${{ env.CMAKE_BUILD_TYPE }}" + + - name: Run C++ API Tests + run: ${{ env.BINARY_PATH }}snappy_unittest${{ env.BINARY_SUFFIX }} + + - name: Run Compression Fuzzer + if: ${{ env.SNAPPY_FUZZING_BUILD == '1' }} + run: >- + ${{ env.BINARY_PATH }}snappy_compress_fuzzer${{ env.BINARY_SUFFIX }} + -runs=1000 -close_fd_mask=3 + + - name: Run Decompression Fuzzer + if: ${{ env.SNAPPY_FUZZING_BUILD == '1' }} + run: >- + ${{ env.BINARY_PATH }}snappy_uncompress_fuzzer${{ env.BINARY_SUFFIX }} + -runs=1000 -close_fd_mask=3 + + - name: Run Benchmarks + run: ${{ env.BINARY_PATH }}snappy_benchmark${{ env.BINARY_SUFFIX }} + + - name: Test CMake installation + run: cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target install diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 33b9072..0000000 --- a/.travis.yml +++ /dev/null @@ -1,109 +0,0 @@ -# Build matrix / environment variables are explained on: -# http://about.travis-ci.org/docs/user/build-configuration/ -# This file can be validated on: http://lint.travis-ci.org/ - -language: cpp -dist: bionic -osx_image: xcode12.5 - -compiler: -- gcc -- clang -os: -- linux -- osx - -env: - jobs: - - BUILD_TYPE: Debug - CPU_LEVEL: BASELINE - - BUILD_TYPE: Debug - CPU_LEVEL: AVX - - BUILD_TYPE: Debug - CPU_LEVEL: AVX2 - - BUILD_TYPE: RelWithDebInfo - CPU_LEVEL: BASELINE - - BUILD_TYPE: RelWithDebInfo - CPU_LEVEL: AVX - - BUILD_TYPE: RelWithDebInfo - CPU_LEVEL: AVX2 - -jobs: - exclude: - # Travis OSX servers seem to run on pre-Haswell CPUs. Attempting to use AVX2 - # results in crashes. - - env: BUILD_TYPE=Debug CPU_LEVEL=AVX2 - os: osx - - env: BUILD_TYPE=RelWithDebInfo CPU_LEVEL=AVX2 - os: osx - allow_failures: - # Homebrew's GCC is currently broken on XCode 11. - - compiler: gcc - os: osx - -addons: - apt: - sources: - - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main' - key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' - - sourceline: 'ppa:ubuntu-toolchain-r/test' - packages: - - clang-12 - - cmake - - gcc-11 - - g++-11 - - ninja-build - homebrew: - packages: - - cmake - - gcc@11 - - llvm@12 - - ninja - update: true - -install: -# The following Homebrew packages aren't linked by default, and need to be -# prepended to the path explicitly. -- if [ "$TRAVIS_OS_NAME" = "osx" ]; then - export PATH="$(brew --prefix llvm)/bin:$PATH"; - fi -# Fuzzing is only supported on Clang. Perform fuzzing on Debug builds. -# LibFuzzer doesn't ship with CommandLineTools on osx. -- if [ "$CXX" = "clang++" ] && [ "$BUILD_TYPE" = "Debug" ] && [ "$TRAVIS_OS_NAME" != "osx" ]; then - export FUZZING=1; - else - export FUZZING=0; - fi -# /usr/bin/gcc points to an older compiler on both Linux and macOS. -- if [ "$CXX" = "g++" ]; then export CXX="g++-11" CC="gcc-11"; fi -# /usr/bin/clang points to an older compiler on both Linux and macOS. -# -# Homebrew's llvm package doesn't ship a versioned clang++ binary, so the values -# below don't work on macOS. Fortunately, the path change above makes the -# default values (clang and clang++) resolve to the correct compiler on macOS. -- if [ "$TRAVIS_OS_NAME" = "linux" ]; then - if [ "$CXX" = "clang++" ]; then export CXX="clang++-12" CC="clang-12"; fi; - fi -- echo ${CC} -- echo ${CXX} -- ${CXX} --version -- cmake --version - -before_script: -- mkdir -p build && cd build -- cmake .. -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE - -DSNAPPY_REQUIRE_${CPU_LEVEL}=ON -DSNAPPY_FUZZING_BUILD=${FUZZING} - -DCMAKE_INSTALL_PREFIX=$HOME/.local -- cmake --build . -- cd .. - -script: -- build/snappy_unittest -- build/snappy_benchmark -- if [ -f build/snappy_compress_fuzzer ]; then - build/snappy_compress_fuzzer -runs=1000 -close_fd_mask=3; - fi -- if [ -f build/snappy_uncompress_fuzzer ]; then - build/snappy_uncompress_fuzzer -runs=1000 -close_fd_mask=3; - fi -- cd build && cmake --build . --target install diff --git a/README.md b/README.md index 7917d1b..c6f7a07 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ Snappy, a fast compressor/decompressor. -[![Build Status](https://travis-ci.org/google/snappy.svg?branch=master)](https://travis-ci.org/google/snappy) -[![Build status](https://ci.appveyor.com/api/projects/status/t9nubcqkwo8rw8yn/branch/master?svg=true)](https://ci.appveyor.com/project/pwnall/leveldb) +[![Build Status](https://github.com/google/snappy/actions/workflows/build.yml/badge.svg)](https://github.com/google/snappy/actions/workflows/build.yml) Introduction ============ -- cgit v1.2.1