| 1 |
name: Ubuntu |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- develop |
| 7 |
- master |
| 8 |
- release/* |
| 9 |
pull_request: |
| 10 |
workflow_dispatch: |
| 11 |
|
| 12 |
permissions: |
| 13 |
contents: read |
| 14 |
|
| 15 |
concurrency: |
| 16 |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} |
| 17 |
cancel-in-progress: true |
| 18 |
|
| 19 |
jobs: |
| 20 |
ci_test_gcc: |
| 21 |
runs-on: ubuntu-latest |
| 22 |
container: gcc:latest |
| 23 |
steps: |
| 24 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 25 |
- name: Get latest CMake and ninja |
| 26 |
uses: lukka/get-cmake@28983e0d3955dba2bb0a6810caae0c6cf268ec0c # v4.0.0 |
| 27 |
- name: Run CMake |
| 28 |
run: cmake -S . -B build -DJSON_CI=On |
| 29 |
- name: Build |
| 30 |
run: cmake --build build --target ci_test_gcc |
| 31 |
|
| 32 |
ci_infer: |
| 33 |
runs-on: ubuntu-latest |
| 34 |
container: ghcr.io/nlohmann/json-ci:v2.4.0 |
| 35 |
steps: |
| 36 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 37 |
- name: Run CMake |
| 38 |
run: cmake -S . -B build -DJSON_CI=On |
| 39 |
- name: Build |
| 40 |
run: cmake --build build --target ci_infer |
| 41 |
|
| 42 |
ci_static_analysis_ubuntu: |
| 43 |
runs-on: ubuntu-latest |
| 44 |
strategy: |
| 45 |
matrix: |
| 46 |
target: [ci_test_amalgamation, ci_test_single_header, ci_cppcheck, ci_cpplint, ci_reproducible_tests, ci_non_git_tests, ci_offline_testdata, ci_reuse_compliance, ci_test_valgrind] |
| 47 |
steps: |
| 48 |
- name: Harden Runner |
| 49 |
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 |
| 50 |
with: |
| 51 |
egress-policy: audit |
| 52 |
|
| 53 |
- name: Install Valgrind |
| 54 |
run: sudo apt-get update ; sudo apt-get install -y valgrind |
| 55 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 56 |
- name: Get latest CMake and ninja |
| 57 |
uses: lukka/get-cmake@28983e0d3955dba2bb0a6810caae0c6cf268ec0c # v4.0.0 |
| 58 |
- name: Run CMake |
| 59 |
run: cmake -S . -B build -DJSON_CI=On |
| 60 |
- name: Build |
| 61 |
run: cmake --build build --target ${{ matrix.target }} |
| 62 |
|
| 63 |
ci_static_analysis_clang: |
| 64 |
runs-on: ubuntu-latest |
| 65 |
container: silkeh/clang:dev |
| 66 |
strategy: |
| 67 |
matrix: |
| 68 |
target: [ci_test_clang, ci_clang_tidy, ci_test_clang_sanitizer, ci_clang_analyze, ci_single_binaries] |
| 69 |
steps: |
| 70 |
- name: Install git, clang-tools, iwyu (ci_single_binaries), and unzip |
| 71 |
run: apt-get update ; apt-get install -y git clang-tools iwyu unzip |
| 72 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 73 |
- name: Get latest CMake and ninja |
| 74 |
uses: lukka/get-cmake@28983e0d3955dba2bb0a6810caae0c6cf268ec0c # v4.0.0 |
| 75 |
- name: Run CMake |
| 76 |
run: cmake -S . -B build -DJSON_CI=On |
| 77 |
- name: Build |
| 78 |
run: cmake --build build --target ${{ matrix.target }} |
| 79 |
|
| 80 |
ci_cmake_options: |
| 81 |
runs-on: ubuntu-latest |
| 82 |
container: ubuntu:focal |
| 83 |
strategy: |
| 84 |
matrix: |
| 85 |
target: [ci_cmake_flags, ci_test_diagnostics, ci_test_diagnostic_positions, ci_test_noexceptions, ci_test_noimplicitconversions, ci_test_legacycomparison, ci_test_noglobaludls] |
| 86 |
steps: |
| 87 |
- name: Install build-essential |
| 88 |
run: apt-get update ; apt-get install -y build-essential unzip wget git libssl-dev |
| 89 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 90 |
- name: Get latest CMake and ninja |
| 91 |
uses: lukka/get-cmake@28983e0d3955dba2bb0a6810caae0c6cf268ec0c # v4.0.0 |
| 92 |
- name: Run CMake |
| 93 |
run: cmake -S . -B build -DJSON_CI=On |
| 94 |
- name: Build |
| 95 |
run: cmake --build build --target ${{ matrix.target }} |
| 96 |
|
| 97 |
ci_test_coverage: |
| 98 |
runs-on: ubuntu-latest |
| 99 |
steps: |
| 100 |
- name: Harden Runner |
| 101 |
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 |
| 102 |
with: |
| 103 |
egress-policy: audit |
| 104 |
|
| 105 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 106 |
- name: Install dependencies and de_DE locale |
| 107 |
run: | |
| 108 |
sudo apt-get clean |
| 109 |
sudo apt-get update |
| 110 |
sudo apt-get install -y build-essential cmake lcov ninja-build make locales gcc-multilib g++-multilib |
| 111 |
sudo locale-gen de_DE |
| 112 |
sudo update-locale |
| 113 |
- name: Run CMake |
| 114 |
run: cmake -S . -B build -DJSON_CI=On |
| 115 |
- name: Build |
| 116 |
run: cmake --build build --target ci_test_coverage |
| 117 |
- name: Archive coverage report |
| 118 |
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 119 |
with: |
| 120 |
name: code-coverage-report |
| 121 |
path: ${{ github.workspace }}/build/html |
| 122 |
- name: Publish report to Coveralls |
| 123 |
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6 |
| 124 |
with: |
| 125 |
github-token: ${{ secrets.GITHUB_TOKEN }} |
| 126 |
path-to-lcov: ${{ github.workspace }}/build/json.info.filtered.noexcept |
| 127 |
|
| 128 |
ci_test_compilers_gcc_old: |
| 129 |
runs-on: ubuntu-latest |
| 130 |
strategy: |
| 131 |
matrix: |
| 132 |
compiler: ['4.8', '4.9', '5', '6'] |
| 133 |
container: ghcr.io/nlohmann/json-ci:v2.4.0 |
| 134 |
steps: |
| 135 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 136 |
- name: Run CMake |
| 137 |
run: CXX=g++-${{ matrix.compiler }} cmake -S . -B build -DJSON_CI=On |
| 138 |
- name: Build |
| 139 |
run: cmake --build build --target ci_test_compiler_g++-${{ matrix.compiler }} |
| 140 |
|
| 141 |
ci_test_compilers_gcc: |
| 142 |
runs-on: ubuntu-latest |
| 143 |
strategy: |
| 144 |
matrix: |
| 145 |
# older GCC docker images (4, 5, 6) fail to check out code |
| 146 |
compiler: ['7', '8', '9', '10', '11', '12', '13', '14', 'latest'] |
| 147 |
container: gcc:${{ matrix.compiler }} |
| 148 |
steps: |
| 149 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 150 |
- name: Get latest CMake and ninja |
| 151 |
uses: lukka/get-cmake@28983e0d3955dba2bb0a6810caae0c6cf268ec0c # v4.0.0 |
| 152 |
- name: Run CMake |
| 153 |
run: cmake -S . -B build -DJSON_CI=On |
| 154 |
- name: Build |
| 155 |
run: cmake --build build --target ci_test_compiler_default |
| 156 |
|
| 157 |
ci_test_compilers_clang: |
| 158 |
runs-on: ubuntu-latest |
| 159 |
strategy: |
| 160 |
matrix: |
| 161 |
compiler: ['3.4', '3.5', '3.6', '3.7', '3.8', '3.9', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15-bullseye', '16', '17', '18', '19', '20', 'latest'] |
| 162 |
container: silkeh/clang:${{ matrix.compiler }} |
| 163 |
steps: |
| 164 |
- name: Install unzip and git |
| 165 |
run: apt-get update ; apt-get install -y unzip git |
| 166 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 167 |
- name: Get latest CMake and ninja |
| 168 |
uses: lukka/get-cmake@28983e0d3955dba2bb0a6810caae0c6cf268ec0c # v4.0.0 |
| 169 |
- name: Set env FORCE_STDCPPFS_FLAG for clang 7 / 8 / 9 / 10 |
| 170 |
run: echo "JSON_FORCED_GLOBAL_COMPILE_OPTIONS=-DJSON_HAS_FILESYSTEM=0;-DJSON_HAS_EXPERIMENTAL_FILESYSTEM=0" >> "$GITHUB_ENV" |
| 171 |
if: ${{ matrix.compiler == '7' || matrix.compiler == '8' || matrix.compiler == '9' || matrix.compiler == '10' }} |
| 172 |
- name: Run CMake |
| 173 |
run: cmake -S . -B build -DJSON_CI=On |
| 174 |
- name: Build |
| 175 |
run: cmake --build build --target ci_test_compiler_default |
| 176 |
|
| 177 |
ci_test_standards_gcc: |
| 178 |
runs-on: ubuntu-latest |
| 179 |
container: gcc:latest |
| 180 |
strategy: |
| 181 |
matrix: |
| 182 |
standard: [11, 14, 17, 20, 23, 26] |
| 183 |
steps: |
| 184 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 185 |
- name: Get latest CMake and ninja |
| 186 |
uses: lukka/get-cmake@28983e0d3955dba2bb0a6810caae0c6cf268ec0c # v4.0.0 |
| 187 |
- name: Run CMake |
| 188 |
run: cmake -S . -B build -DJSON_CI=On |
| 189 |
- name: Build |
| 190 |
run: cmake --build build --target ci_test_gcc_cxx${{ matrix.standard }} |
| 191 |
|
| 192 |
ci_test_standards_clang: |
| 193 |
runs-on: ubuntu-latest |
| 194 |
container: silkeh/clang:latest |
| 195 |
strategy: |
| 196 |
matrix: |
| 197 |
standard: [11, 14, 17, 20, 23, 26] |
| 198 |
stdlib: [libcxx, libstdcxx] |
| 199 |
steps: |
| 200 |
- name: Install git and unzip |
| 201 |
run: apt-get update ; apt-get install -y git unzip |
| 202 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 203 |
- name: Get latest CMake and ninja |
| 204 |
uses: lukka/get-cmake@28983e0d3955dba2bb0a6810caae0c6cf268ec0c # v4.0.0 |
| 205 |
- name: Run CMake |
| 206 |
run: cmake -S . -B build -DJSON_CI=On |
| 207 |
- name: Build with libc++ |
| 208 |
run: cmake --build build --target ci_test_clang_libcxx_cxx${{ matrix.standard }} |
| 209 |
if: ${{ matrix.stdlib == 'libcxx' }} |
| 210 |
- name: Build with libstdc++ |
| 211 |
run: cmake --build build --target ci_test_clang_cxx${{ matrix.standard }} |
| 212 |
if: ${{ matrix.stdlib == 'libstdcxx' }} |
| 213 |
|
| 214 |
ci_cuda_example: |
| 215 |
runs-on: ubuntu-latest |
| 216 |
container: ghcr.io/nlohmann/json-ci:v2.4.0 |
| 217 |
steps: |
| 218 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 219 |
- name: Run CMake |
| 220 |
run: cmake -S . -B build -DJSON_CI=On |
| 221 |
- name: Build |
| 222 |
run: cmake --build build --target ci_cuda_example |
| 223 |
|
| 224 |
ci_icpc: |
| 225 |
runs-on: ubuntu-latest |
| 226 |
container: ghcr.io/nlohmann/json-ci:v2.2.0 |
| 227 |
steps: |
| 228 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 229 |
- name: Run CMake |
| 230 |
run: cmake -S . -B build -DJSON_CI=On |
| 231 |
- name: Build |
| 232 |
run: | |
| 233 |
. /opt/intel/oneapi/setvars.sh |
| 234 |
cmake --build build --target ci_icpc |
| 235 |
|
| 236 |
ci_test_documentation: |
| 237 |
runs-on: ubuntu-latest |
| 238 |
strategy: |
| 239 |
matrix: |
| 240 |
target: [ci_test_examples, ci_test_build_documentation] |
| 241 |
steps: |
| 242 |
- name: Harden Runner |
| 243 |
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 |
| 244 |
with: |
| 245 |
egress-policy: audit |
| 246 |
|
| 247 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 248 |
- name: Run CMake |
| 249 |
run: cmake -S . -B build -DJSON_CI=On |
| 250 |
- name: Build |
| 251 |
run: cmake --build build --target ${{ matrix.target }} |