diff options
| author | pmqs <pmqs@cpan.org> | 2024-02-05 15:28:50 +0000 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2024-02-10 10:33:23 -0800 |
| commit | 0e958393245ecd1e5639fbe4376c1bf1467ad616 (patch) | |
| tree | af43aadc3c17896f4a38e1c5546a30eec8179aee /.github/workflows | |
| parent | d9243a0f066fd0ad6e7597be620ab8d8bfe5ae72 (diff) | |
| download | zlib-0e958393245ecd1e5639fbe4376c1bf1467ad616.tar.gz zlib-0e958393245ecd1e5639fbe4376c1bf1467ad616.tar.bz2 zlib-0e958393245ecd1e5639fbe4376c1bf1467ad616.zip | |
Add github workflow to build with all available C standards.
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/c-std.yml | 208 |
1 files changed, 208 insertions, 0 deletions
diff --git a/.github/workflows/c-std.yml b/.github/workflows/c-std.yml new file mode 100644 index 0000000..44417bf --- /dev/null +++ b/.github/workflows/c-std.yml | |||
| @@ -0,0 +1,208 @@ | |||
| 1 | name: C Standard | ||
| 2 | |||
| 3 | # Compile with as many C standards as possible. | ||
| 4 | # The worflow is setup to fail on any compilation warnings. | ||
| 5 | |||
| 6 | on: | ||
| 7 | workflow_dispatch: | ||
| 8 | push: | ||
| 9 | pull_request: | ||
| 10 | |||
| 11 | jobs: | ||
| 12 | |||
| 13 | main: | ||
| 14 | name: ${{ matrix.os.name }} ${{ matrix.compiler }} ${{ matrix.arch.name }} ${{ matrix.std.name }} ${{ matrix.builder }} | ||
| 15 | runs-on: ${{ matrix.os.value }} | ||
| 16 | strategy: | ||
| 17 | fail-fast: false | ||
| 18 | matrix: | ||
| 19 | os: | ||
| 20 | - name: Linux | ||
| 21 | value: ubuntu-latest | ||
| 22 | |||
| 23 | - name: MacOS | ||
| 24 | value: macos-latest | ||
| 25 | |||
| 26 | - name: Windows | ||
| 27 | value: windows-latest | ||
| 28 | cmake-opt: -G Ninja | ||
| 29 | |||
| 30 | compiler: | ||
| 31 | - gcc | ||
| 32 | - clang | ||
| 33 | |||
| 34 | arch: | ||
| 35 | - name: 64-bit | ||
| 36 | tag: amd64 | ||
| 37 | compiler-opt: -m64 | ||
| 38 | cmake-opt: -A x64 | ||
| 39 | |||
| 40 | - name: 32-bit | ||
| 41 | tag: i386 | ||
| 42 | compiler-opt: -m32 | ||
| 43 | cmake-opt: -A Win32 | ||
| 44 | |||
| 45 | |||
| 46 | builder: | ||
| 47 | - configure | ||
| 48 | - cmake | ||
| 49 | |||
| 50 | std: | ||
| 51 | - name: c89 | ||
| 52 | value: c89 | ||
| 53 | |||
| 54 | - name: gnu89 | ||
| 55 | value: gnu89 | ||
| 56 | |||
| 57 | - name: c94 | ||
| 58 | value: iso9899:199409 | ||
| 59 | |||
| 60 | - name: c99 | ||
| 61 | value: c99 | ||
| 62 | |||
| 63 | - name: gnu99 | ||
| 64 | value: gnu99 | ||
| 65 | |||
| 66 | - name: c11 | ||
| 67 | value: c11 | ||
| 68 | |||
| 69 | - name: gnu11 | ||
| 70 | value: gnu11 | ||
| 71 | |||
| 72 | - name: c17 | ||
| 73 | value: c17 | ||
| 74 | |||
| 75 | - name: gnu17 | ||
| 76 | value: gnu17 | ||
| 77 | |||
| 78 | - name: c2x | ||
| 79 | value: c2x | ||
| 80 | |||
| 81 | - name: gnu2x | ||
| 82 | value: gnu2x | ||
| 83 | |||
| 84 | exclude: | ||
| 85 | # Don't run 32-bit on MacOS | ||
| 86 | - { os: { name: MacOS }, | ||
| 87 | arch: { tag: i386 } } | ||
| 88 | |||
| 89 | # Don't run configure on Windows | ||
| 90 | - { os: { name: Windows }, | ||
| 91 | builder: configure } | ||
| 92 | |||
| 93 | # Don't run gcc 32-bit on Windows | ||
| 94 | - { os: { name: Windows }, | ||
| 95 | arch: { tag: i386 } } | ||
| 96 | |||
| 97 | steps: | ||
| 98 | |||
| 99 | - name: Checkout repository | ||
| 100 | uses: actions/checkout@v4 | ||
| 101 | with: | ||
| 102 | show-progress: 'false' | ||
| 103 | |||
| 104 | - name: Install packages (Linux) | ||
| 105 | if: runner.os == 'Linux' && matrix.arch.tag == 'i386' | ||
| 106 | run: | | ||
| 107 | sudo apt-get update | ||
| 108 | sudo apt install gcc-multilib libc6-dev-i386-cross | ||
| 109 | |||
| 110 | - name: Install packages (Windows) | ||
| 111 | if: runner.os == 'Windows' | ||
| 112 | run: | | ||
| 113 | choco install --no-progress ninja | ||
| 114 | |||
| 115 | - name: Generate project files (configure) | ||
| 116 | if: matrix.builder == 'configure' | ||
| 117 | run: | | ||
| 118 | ./configure | ||
| 119 | env: | ||
| 120 | CC: ${{ matrix.compiler }} | ||
| 121 | CFLAGS: -std=${{ matrix.std.value }} ${{ matrix.arch.compiler-opt }} -Werror -Wall -Wextra | ||
| 122 | |||
| 123 | - name: Compile source code (configure) | ||
| 124 | if: matrix.builder == 'configure' | ||
| 125 | run: make -j2 | ||
| 126 | |||
| 127 | - name: Run test cases (configure) | ||
| 128 | if: matrix.builder == 'configure' | ||
| 129 | run: | | ||
| 130 | make test | ||
| 131 | make cover | ||
| 132 | |||
| 133 | - name: Generate project files (cmake) | ||
| 134 | if: matrix.builder == 'cmake' | ||
| 135 | run: | | ||
| 136 | cmake -S . -B . -D CMAKE_BUILD_TYPE=Release -D ZLIB_BUILD_EXAMPLES=OFF ${{ matrix.os.cmake-opt }} | ||
| 137 | env: | ||
| 138 | CC: ${{ matrix.compiler }} | ||
| 139 | CFLAGS: -std=${{ matrix.std.value }} ${{ matrix.arch.compiler-opt }} -Werror -Wall -Wextra | ||
| 140 | |||
| 141 | - name: Compile source code (cmake) | ||
| 142 | if: matrix.builder == 'cmake' | ||
| 143 | run: cmake --build . --config Release | ||
| 144 | |||
| 145 | - name: Run test cases (cmake) | ||
| 146 | if: matrix.builder == 'cmake' | ||
| 147 | run: ctest -C Release --output-on-failure --max-width 120 | ||
| 148 | |||
| 149 | |||
| 150 | msvc: | ||
| 151 | name: ${{ matrix.os.name }} ${{ matrix.compiler }} ${{ matrix.arch.name }} ${{ matrix.std.name }} ${{ matrix.builder }} | ||
| 152 | runs-on: ${{ matrix.os.value }} | ||
| 153 | strategy: | ||
| 154 | fail-fast: false | ||
| 155 | matrix: | ||
| 156 | os: | ||
| 157 | - name: Windows | ||
| 158 | value: windows-latest | ||
| 159 | |||
| 160 | compiler: | ||
| 161 | - cl | ||
| 162 | |||
| 163 | arch: | ||
| 164 | - name: 32-bit | ||
| 165 | value: -A Win32 | ||
| 166 | |||
| 167 | - name: 64-bit | ||
| 168 | value: -A x64 | ||
| 169 | |||
| 170 | builder: | ||
| 171 | - cmake | ||
| 172 | |||
| 173 | std: | ||
| 174 | - name: default | ||
| 175 | value: "" | ||
| 176 | |||
| 177 | - name: C11 | ||
| 178 | value: /std:c11 | ||
| 179 | |||
| 180 | - name: C17 | ||
| 181 | value: /std:c17 | ||
| 182 | |||
| 183 | # not available on the runner yet | ||
| 184 | # - name: C20 | ||
| 185 | # value: /std:c20 | ||
| 186 | |||
| 187 | - name: latest | ||
| 188 | value: /std:clatest | ||
| 189 | |||
| 190 | steps: | ||
| 191 | |||
| 192 | - name: Checkout repository | ||
| 193 | uses: actions/checkout@v4 | ||
| 194 | with: | ||
| 195 | show-progress: 'false' | ||
| 196 | |||
| 197 | - name: Generate project files (cmake) | ||
| 198 | run: | | ||
| 199 | cmake -S . -B . ${{ matrix.arch.value }} -D CMAKE_BUILD_TYPE=Release | ||
| 200 | env: | ||
| 201 | CC: ${{ matrix.compiler }} | ||
| 202 | CFLAGS: /WX ${{ matrix.std.value }} | ||
| 203 | |||
| 204 | - name: Compile source code (cmake) | ||
| 205 | run: cmake --build . --config Release -v | ||
| 206 | |||
| 207 | - name: Run test cases (cmake) | ||
| 208 | run: ctest -C Release --output-on-failure --max-width 120 \ No newline at end of file | ||
