diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5df8430 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,115 @@ +name: CI +on: [pull_request] +env: + CFLAGS: -Werror + +jobs: + x86_64-build-and-test: + name: Build and test (x86_64, ${{ matrix.os }}, ${{ matrix.compiler }}) + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04] + compiler: [gcc, clang] + exclude: + # clang 3.8.0-2ubuntu4 crashes with: + # "fatal error: error in backend: Cannot select: 0x21025a0: v64i8 = X86ISD::VBROADCAST 0x2101fb0" + - os: ubuntu-16.04 + compiler: clang + runs-on: ${{ matrix.os }} + env: + CC: ${{ matrix.compiler }} + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: sudo apt-get install -y clang llvm libz-dev valgrind + - run: scripts/run_tests.sh + + other-arch-build-and-test: + name: Build and test (${{ matrix.arch }}, Debian Buster, ${{ matrix.compiler }}) + strategy: + matrix: + arch: [armv6, armv7, aarch64, s390x, ppc64le] + compiler: [gcc, clang] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: uraimo/run-on-arch-action@v2.0.5 + with: + arch: ${{ matrix.arch }} + distro: buster + githubToken: ${{ github.token }} + install: | + apt-get update + apt-get install -y build-essential clang llvm libz-dev valgrind + run: | + # Valgrind and ASAN crash on at least s390x, ppc64le, and aarch64 + # here. (It's probably something related to the QEMU user-mode + # emulation that run-on-arch-action uses.) + export SKIP_VALGRIND=1 + export SKIP_ASAN=1 + + case ${{ matrix.arch }} in + s390x) + # On s390x, in freestanding builds the shared library links to an + # external symbol __clzdi2, even when -static-libgcc is used. + export SKIP_FREESTANDING=1 + ;; + aarch64) + # "ldd: exited with unknown exit code (139)" + if [ ${{ matrix.compiler }} = clang ]; then + export SKIP_SHARED_LIB=1 + fi + ;; + esac + + export CC=${{ matrix.compiler }} + scripts/run_tests.sh + + macos-build-and-test: + name: Build and test (macOS) + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - run: make all check + + windows-build-and-test: + name: Build and test (Windows) + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - shell: bash + run: | + PATH="C:\\msys64\\mingw64\\bin:C:\\msys64\\usr\\bin:$PATH" \ + make CC=gcc all check + + run-clang-static-analyzer: + name: Run clang static analyzer + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: sudo apt-get install -y clang-tools + - name: Run clang static analyzer + run: make scan-build + + run-shellcheck: + name: Run shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: sudo apt-get install -y shellcheck + - name: Run shellcheck + run: make shellcheck + + cross-compile-for-windows: + name: Cross compile for Windows + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: sudo apt-get install -y gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 libz-mingw-w64-dev + - name: 32-bit build + run: make CC=i686-w64-mingw32-gcc all test_programs + - name: 64-bit build + run: make CC=x86_64-w64-mingw32-gcc all test_programs diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9d1cb69..0000000 --- a/.travis.yml +++ /dev/null @@ -1,113 +0,0 @@ -language: c -os: linux -dist: focal -compiler: - - gcc - - clang -env: - global: - - CFLAGS=-Werror -arch: - - amd64 - - arm64 - - ppc64le - - s390x -before_install: sudo apt-get install -y libz-dev valgrind -script: scripts/run_tests.sh - -# Additional jobs not generated by the above build matrix: -jobs: - include: - # Jobs to test older Ubuntu distros. Ideally these would be generated by - # the build matrix, but Travis CI doesn't support expanding by 'dist'... - - - dist: precise - compiler: gcc - arch: amd64 - - - dist: precise - compiler: clang - arch: amd64 - - - dist: xenial - compiler: gcc - arch: amd64 - - - dist: xenial - compiler: clang - arch: amd64 - - - dist: xenial - compiler: gcc - arch: arm64 - # Ignore incorrect -Wstrict-aliasing warning in adler32_neon_chunk(), - # not seen with any other compiler versions. - env: CFLAGS="-Wno-strict-aliasing -Werror" - - - dist: xenial - compiler: clang - arch: arm64 - # ASAN fails with internal error - env: DISABLE_ASAN=1 - - - dist: xenial - compiler: gcc - arch: ppc64le - # ASAN fails with internal error - env: DISABLE_ASAN=1 - - - dist: xenial - compiler: clang - arch: ppc64le - # ASAN fails with internal error - env: DISABLE_ASAN=1 - - - dist: xenial - compiler: gcc - arch: s390x - - - dist: xenial - compiler: clang - arch: s390x - - # Other Linux jobs - - - name: clang static analyzer - before_install: sudo apt-get install -y clang - script: make scan-build - - - name: shellcheck - before_install: sudo apt-get install -y shellcheck - script: make shellcheck - - - name: Cross compile for Windows - before_install: - - sudo apt-get install -y gcc-mingw-w64-x86-64 libz-mingw-w64-dev - script: - - make CC=i686-w64-mingw32-gcc all test_programs - - make CC=x86_64-w64-mingw32-gcc all test_programs - - # Non-Linux jobs - - - name: macOS, xcode11 - os: osx - osx_image: xcode11 - before_install: - script: make all check - - - name: macOS, xcode9.4 - os: osx - osx_image: xcode9.4 - before_install: - script: make all check - - - name: macOS, xcode7.3 - os: osx - osx_image: xcode7.3 - before_install: - script: make all check - - - name: Windows, MinGW - os: windows - before_install: - script: mingw32-make all check