summaryrefslogtreecommitdiff
path: root/.github/workflows/neozip-cmake.yml
blob: aff7d7fffe3698b5594f943faf06b5a7a38eeacd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: "neozip: CMake"

on:
  workflow_call:
  workflow_dispatch:

env:
  TERM: xterm-256color
  GTEST_COLOR: 1

jobs:
  cmake:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    timeout-minutes: 80
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: Ubuntu GCC ASAN
            os: ubuntu-latest
            compiler: gcc
            cxx-compiler: g++
            cflags: ""
            cxxflags: -Wno-maybe-uninitialized
            ldflags: ""
            cmake-args: -DWITH_SANITIZER=Address -DWITH_BENCHMARKS=ON

          - name: Ubuntu GCC Native Instructions
            os: ubuntu-latest
            compiler: gcc
            cxx-compiler: g++
            cmake-args: -DWITH_NATIVE_INSTRUCTIONS=ON

          - name: Ubuntu Clang
            os: ubuntu-latest
            compiler: clang
            cxx-compiler: clang++
            packages: llvm-15 llvm-15-tools

          - name: Ubuntu Clang No Optim
            os: ubuntu-latest
            compiler: clang
            cxx-compiler: clang++
            cmake-args: -DWITH_OPTIM=OFF

          - name: Ubuntu Clang Compat
            os: ubuntu-latest
            compiler: clang
            cxx-compiler: clang++
            cmake-args: -DZLIB_COMPAT=ON

          - name: macOS Clang
            os: macos-latest
            compiler: clang
            cxx-compiler: clang++

          - name: macOS Clang Compat
            os: macos-latest
            compiler: clang
            cxx-compiler: clang++
            cmake-args: -DZLIB_COMPAT=ON

          - name: Windows MSVC Win64
            os: windows-latest
            compiler: cl
            cmake-args: -A x64

          - name: Windows MSVC Win64 Compat
            os: windows-latest
            compiler: cl
            cmake-args: -A x64 -DZLIB_COMPAT=ON

    steps:
      - name: Checkout repository
        uses: actions/checkout@v6
        with:
          show-progress: 'false'

      - name: Install packages (Ubuntu)
        if: runner.os == 'Linux' && matrix.packages
        run: |
          sudo apt-get update
          sudo apt-get install -y ${{ matrix.packages }}

      - name: Generate project files
        shell: bash
        run: |
          cmake -S neozip -B build \
            ${{ matrix.cmake-args }} \
            -DCMAKE_BUILD_TYPE=Release \
            -DWITH_MAINTAINER_WARNINGS=ON
        env:
          CC: ${{ matrix.compiler }}
          CXX: ${{ matrix.cxx-compiler }}
          CFLAGS: ${{ matrix.cflags }}
          CXXFLAGS: ${{ matrix.cxxflags }}
          LDFLAGS: ${{ matrix.ldflags }}
          CI: true

      - name: Compile source code
        run: cmake --build build -j5 --config Release

      - name: Run test cases
        run: ctest --verbose -C Release --output-on-failure --max-width 120 -j 5
        working-directory: build

      - name: Upload build errors
        uses: actions/upload-artifact@v7
        if: failure()
        with:
          name: ${{ matrix.name }} (cmake)
          path: |
            **/CMakeFiles/CMakeOutput.log
            **/CMakeFiles/CMakeError.log
            **/Testing/Temporary/*
          retention-days: 30