Skip to content

Commit bbbb93a

Browse files
authored
Switch CI to GitHub Actions (#55)
* Fix Windows CI build. The Windows SDK versions present on our CI options (GitHub Actions hosted runners, AppVeyor) have headers that cause compilation warnings when included with MSVC operating in modern C modes (C11+). This PR disables the compilation warning caused by the Windows SDK headers, so we can get Windows feedback from CI. The warnings can be re-enabled when the Windows SDK used by our CI is upgraded to a version that doesn't trigger warnings. * Switch CI to GitHub Actions.
1 parent d46cd17 commit bbbb93a

File tree

5 files changed

+109
-116
lines changed

5 files changed

+109
-116
lines changed

.appveyor.yml

-38
This file was deleted.

.github/workflows/build.yml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Copyright 2021 The CRC32C Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file. See the AUTHORS file for names of contributors.
4+
5+
name: ci
6+
on: [push, pull_request]
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build-and-test:
13+
name: >-
14+
CI
15+
${{ matrix.os }}
16+
${{ matrix.compiler }}
17+
${{ matrix.optimized && 'release' || 'debug' }}
18+
${{ matrix.shared_lib && 'shared' || 'static' }}
19+
${{ matrix.use_glog && 'glog' || 'no-glog' }}
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
compiler: [clang, gcc, msvc]
25+
os: [ubuntu-latest, macos-latest, windows-latest]
26+
optimized: [true, false]
27+
shared_lib: [true, false]
28+
use_glog: [true, false]
29+
exclude:
30+
# Our glog config doesn't work with shared libraries.
31+
- use_glog: true
32+
shared_lib: true
33+
# MSVC only works on Windows.
34+
- os: ubuntu-latest
35+
compiler: msvc
36+
- os: macos-latest
37+
compiler: msvc
38+
# Not testing with GCC on macOS.
39+
- os: macos-latest
40+
compiler: gcc
41+
# Only testing with MSVC on Windows.
42+
- os: windows-latest
43+
compiler: clang
44+
- os: windows-latest
45+
compiler: gcc
46+
# Not testing fringe configurations (glog, shared libraries) on Windows.
47+
- os: windows-latest
48+
use_glog: true
49+
- os: windows-latest
50+
shared_lib: true
51+
include:
52+
- compiler: clang
53+
CC: clang
54+
CXX: clang++
55+
- compiler: gcc
56+
CC: gcc
57+
CXX: g++
58+
- compiler: msvc
59+
CC:
60+
CXX:
61+
62+
env:
63+
CMAKE_BUILD_DIR: ${{ github.workspace }}/build
64+
CMAKE_BUILD_TYPE: ${{ matrix.optimized && 'RelWithDebInfo' || 'Debug' }}
65+
CC: ${{ matrix.CC }}
66+
CXX: ${{ matrix.CXX }}
67+
BINARY_SUFFIX: ${{ startsWith(matrix.os, 'windows') && '.exe' || '' }}
68+
BINARY_PATH: >-
69+
${{ format(
70+
startsWith(matrix.os, 'windows') && '{0}\build\{1}\' || '{0}/build/',
71+
github.workspace,
72+
matrix.optimized && 'RelWithDebInfo' || 'Debug') }}
73+
74+
steps:
75+
- uses: actions/checkout@v2
76+
with:
77+
submodules: true
78+
79+
- name: Generate build config
80+
run: >-
81+
cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}"
82+
-DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }}
83+
-DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/install_test/
84+
-DBUILD_SHARED_LIBS=${{ matrix.shared_lib && '1' || '0' }}
85+
-DCRC32C_USE_GLOG=${{ matrix.use_glog && '1' || '0' }}
86+
87+
- name: Build
88+
run: >-
89+
cmake --build "${{ env.CMAKE_BUILD_DIR }}"
90+
--config "${{ env.CMAKE_BUILD_TYPE }}"
91+
92+
- name: Run C++ API Tests
93+
run: ${{ env.BINARY_PATH }}crc32c_tests${{ env.BINARY_SUFFIX }}
94+
95+
- name: Run C API Tests
96+
run: ${{ env.BINARY_PATH }}crc32c_capi_tests${{ env.BINARY_SUFFIX }}
97+
98+
- name: Run Benchmarks
99+
run: ${{ env.BINARY_PATH }}crc32c_bench${{ env.BINARY_SUFFIX }}
100+
101+
- name: Test CMake installation
102+
run: cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target install

.travis.yml

-76
This file was deleted.

CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,12 @@ if(CRC32C_BUILD_TESTS)
362362
# Warnings as errors in Visual Studio for this project's targets.
363363
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
364364
set_property(TARGET crc32c_capi_tests APPEND PROPERTY COMPILE_OPTIONS "/WX")
365+
366+
# The Windows SDK version currently on CI produces warnings when some
367+
# headers are #included using C99 compatibity mode or above. This workaround
368+
# can be removed once the Windows SDK on our CI is upgraded.
369+
set_property(TARGET crc32c_capi_tests
370+
APPEND PROPERTY COMPILE_OPTIONS "/wd5105")
365371
endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
366372

367373
add_test(NAME crc32c_capi_tests COMMAND crc32c_capi_tests)

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# CRC32C
22

3-
[![Build Status](https://travis-ci.org/google/crc32c.svg?branch=master)](https://travis-ci.org/google/crc32c)
4-
[![Build Status](https://ci.appveyor.com/api/projects/status/moiq7331pett4xuj/branch/master?svg=true)](https://ci.appveyor.com/project/pwnall/crc32c)
3+
[![Build Status](https://github.com/google/crc32c/actions/workflows/build.yml/badge.svg)](https://github.com/google/crc32c/actions/workflows/build.yml)
54

65
New file format authors should consider
76
[HighwayHash](https://github.com/google/highwayhash). The initial version of

0 commit comments

Comments
 (0)