summaryrefslogtreecommitdiff
path: root/.github/workflows/json4cpp-ci.yml
blob: 21b1e7bfcaa22e253e5b2138f1ed3d69b889daa4 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: "json4cpp: CI"

on:
  workflow_dispatch:
  workflow_call:

permissions:
  contents: read

concurrency:
  group: json4cpp-${{ github.workflow }}-${{ github.ref || github.run_id }}
  cancel-in-progress: true

jobs:
  ci_test_gcc:
    runs-on: ubuntu-latest
    container: gcc:latest
    steps:
      - uses: actions/checkout@v6
      - name: Get latest CMake and ninja
        uses: lukka/get-cmake@v4
      - name: Run CMake
        run: cmake -S json4cpp -B build -DJSON_CI=On
      - name: Build
        run: cmake --build build --target ci_test_gcc

  ci_static_analysis:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        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]
    steps:
      - uses: actions/checkout@v6
      - name: Install Valgrind
        run: sudo apt-get update ; sudo apt-get install -y valgrind
      - name: Get latest CMake and ninja
        uses: lukka/get-cmake@v4
      - name: Run CMake
        run: cmake -S json4cpp -B build -DJSON_CI=On
      - name: Build
        run: cmake --build build --target ${{ matrix.target }}

  ci_static_analysis_clang:
    runs-on: ubuntu-latest
    container: silkeh/clang:dev
    strategy:
      fail-fast: false
      matrix:
        target: [ci_test_clang, ci_clang_tidy, ci_test_clang_sanitizer, ci_clang_analyze, ci_single_binaries]
    steps:
      - name: Install dependencies
        run: apt-get update ; apt-get install -y git clang-tools iwyu unzip
      - uses: actions/checkout@v6
      - name: Get latest CMake and ninja
        uses: lukka/get-cmake@v4
      - name: Run CMake
        run: cmake -S json4cpp -B build -DJSON_CI=On
      - name: Build
        run: cmake --build build --target ${{ matrix.target }}

  ci_test_compilers_gcc:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        compiler: ['7', '8', '9', '10', '11', '12', '13', '14', '15', 'latest']
    container: gcc:${{ matrix.compiler }}
    steps:
      - uses: actions/checkout@v6
      - name: Get latest CMake and ninja
        uses: lukka/get-cmake@v4
      - name: Run CMake
        run: cmake -S json4cpp -B build -DJSON_CI=On
      - name: Build
        run: cmake --build build --target ci_test_compiler_default

  ci_test_compilers_clang:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        compiler: ['11', '12', '13', '14', '15-bullseye', '16', '17', '18', '19', '20', 'latest']
    container: silkeh/clang:${{ matrix.compiler }}
    steps:
      - uses: actions/checkout@v6
      - name: Get latest CMake and ninja
        uses: lukka/get-cmake@v4
      - name: Run CMake
        run: cmake -S json4cpp -B build -DJSON_CI=On
      - name: Build
        run: cmake --build build --target ci_test_compiler_default

  ci_test_coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y build-essential cmake lcov ninja-build locales gcc-multilib g++-multilib
          sudo locale-gen de_DE
          sudo update-locale
      - name: Run CMake
        run: cmake -S json4cpp -B build -DJSON_CI=On
      - name: Build
        run: cmake --build build --target ci_test_coverage
      - name: Upload coverage report
        uses: actions/upload-artifact@v7
        with:
          name: code-coverage-report
          path: build/html

  macos:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [macos-13, macos-14, macos-15]
    steps:
      - uses: actions/checkout@v6
      - name: Run CMake
        run: cmake -S json4cpp -B build -DJSON_CI=On
      - name: Build
        run: cmake --build build --target ci_test_clang

  windows:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [windows-2022, windows-2025]
    steps:
      - uses: actions/checkout@v6
      - name: Run CMake
        run: cmake -S json4cpp -B build -DJSON_CI=On -G "Visual Studio 17 2022"
      - name: Build
        run: cmake --build build --config Release --target ci_test_msvc

  codeql:
    runs-on: ubuntu-latest
    permissions:
      security-events: write
    steps:
      - uses: actions/checkout@v6
      - name: Initialize CodeQL
        uses: github/codeql-action/init@v4
        with:
          languages: cpp
      - name: Build
        run: |
          cmake -S json4cpp -B build
          cmake --build build
      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v4