From 67eb09a20bac154d658a9aae91f7539202606941 Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Thu, 6 Oct 2022 21:50:16 -0700 Subject: Add continuous integration workflows. [nmoinvaz] These workflows will be run to verify that project generation, source file compilation, and test cases run successfully. --- .github/workflows/cmake.yml | 62 +++++++++++++++++++++++++++++++++++++++++ .github/workflows/configure.yml | 46 ++++++++++++++++++++++++++++++ .github/workflows/fuzz.yml | 25 +++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 .github/workflows/cmake.yml create mode 100644 .github/workflows/configure.yml create mode 100644 .github/workflows/fuzz.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 0000000..ed3a79b --- /dev/null +++ b/.github/workflows/cmake.yml @@ -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' }} diff --git a/.github/workflows/configure.yml b/.github/workflows/configure.yml new file mode 100644 index 0000000..2c19e60 --- /dev/null +++ b/.github/workflows/configure.yml @@ -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 }} diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml new file mode 100644 index 0000000..48cd2b9 --- /dev/null +++ b/.github/workflows/fuzz.yml @@ -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 -- cgit v1.2.1