Add continuous integration workflows. [nmoinvaz]

These workflows will be run to verify that project generation,
source file compilation, and test cases run successfully.
This commit is contained in:
Mark Adler 2022-10-06 21:50:16 -07:00
parent 352cb28d12
commit 67eb09a20b
3 changed files with 133 additions and 0 deletions

62
.github/workflows/cmake.yml vendored Normal file
View File

@ -0,0 +1,62 @@
name: CMake
on: [push, pull_request]
jobs:
ci-cmake:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu GCC
os: ubuntu-latest
compiler: gcc
- name: Ubuntu GCC ISB
os: ubuntu-latest
compiler: gcc
build-dir: "."
src-dir: "."
- name: Ubuntu Clang
os: ubuntu-latest
compiler: clang
- name: Ubuntu Clang Debug
os: ubuntu-latest
compiler: clang
build-config: Debug
- name: Windows MSVC Win32
os: windows-latest
compiler: cl
cmake-args: -A Win32
- name: Windows MSVC Win64
os: windows-latest
compiler: cl
cmake-args: -A x64
- name: macOS Clang
os: macos-latest
compiler: clang
- name: macOS GCC
os: macos-latest
compiler: gcc-9
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate project files
run: cmake -S ${{ matrix.src-dir || '../zlib' }} -B ${{ matrix.build-dir || '../build' }} ${{ matrix.cmake-args }} -D CMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }}
env:
CC: ${{ matrix.compiler }}
- name: Compile source code
run: cmake --build ${{ matrix.build-dir || '../build' }} --config ${{ matrix.build-config || 'Release' }}
- name: Run test cases
run: ctest -C Release --output-on-failure --max-width 120
working-directory: ${{ matrix.build-dir || '../build' }}

46
.github/workflows/configure.yml vendored Normal file
View File

@ -0,0 +1,46 @@
name: Configure
on: [push, pull_request]
jobs:
ci-configure:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu GCC
os: ubuntu-latest
compiler: gcc
configure-args: --warn
- name: Ubuntu GCC ISB
os: ubuntu-latest
compiler: gcc
configure-args: --warn
build-dir: "."
src-dir: "."
- name: macOS GCC
os: macos-latest
compiler: gcc-9
configure-args: --warn
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate project files
run: |
[ -d ${{ matrix.build-dir || '../build' }} ] || mkdir ${{ matrix.build-dir || '../build' }}
cd ${{ matrix.build-dir || '../build' }}
${{ matrix.src-dir || '../zlib' }}/configure ${{ matrix.configure-args }}
env:
CC: ${{ matrix.compiler }}
- name: Compile source code
run: make -j2
working-directory: ${{ matrix.build-dir }}
- name: Run test cases
run: make test
working-directory: ${{ matrix.build-dir }}

25
.github/workflows/fuzz.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: OSS-Fuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'zlib'
dry-run: false
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'zlib'
fuzz-seconds: 300
dry-run: false
- name: Upload Crash
uses: actions/upload-artifact@v3
if: failure()
with:
name: artifacts
path: ./out/artifacts