Skip to content

Commit 7bf71c6

Browse files
authored
Enhance tests (#226)
1 parent 6ccf8ab commit 7bf71c6

20 files changed

+113
-291
lines changed

.github/workflows/code-checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
check-includes-are-relative:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
9+
- uses: actions/checkout@v4
1010
- shell : bash
1111
run: |
1212
cd include

.github/workflows/jekyll-gh-pages.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ concurrency:
2424
jobs:
2525
# Build job
2626
build:
27+
if: github.repository == 'getml/reflect-cpp'
2728
runs-on: ubuntu-latest
2829
steps:
2930
- name: Checkout
@@ -40,6 +41,7 @@ jobs:
4041

4142
# Deployment job
4243
deploy:
44+
if: github.repository == 'getml/reflect-cpp'
4345
environment:
4446
name: github-pages
4547
url: ${{ steps.deployment.outputs.page_url }}

.github/workflows/linux-clang-14.yaml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/linux-clang-16.yaml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/linux-gcc.yaml renamed to .github/workflows/linux.yaml

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
1-
name: linux-gcc
1+
name: linux
22

3-
on: [ pull_request ]
3+
on: [ pull_request, workflow_dispatch ]
44

55
env:
66
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
77

88
jobs:
9-
linux-gcc:
10-
runs-on: ubuntu-latest
9+
linux:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
include:
14+
- compiler: llvm
15+
compiler-version: 16
16+
- compiler: llvm
17+
compiler-version: 18
18+
- compiler: gcc
19+
compiler-version: 11
20+
additional-dep: "g++-11"
21+
- compiler: gcc
22+
compiler-version: 12
23+
- compiler: gcc
24+
compiler-version: 14
25+
name: "${{ github.job }} (${{ matrix.compiler }}-${{ matrix.compiler-version }})"
26+
runs-on: ubuntu-24.04
1127
steps:
1228
- name: Checkout
13-
uses: actions/checkout@v3
29+
uses: actions/checkout@v4
1430
with:
1531
submodules: recursive
1632
fetch-depth: 0
@@ -20,29 +36,34 @@ jobs:
2036
script: |
2137
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
2238
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
39+
- name: Setup ccache
40+
uses: hendrikmuhs/ccache-action@v1
41+
with:
42+
key: "${{ github.job }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}"
43+
max-size: "2G"
2344
- name: Run vcpkg
2445
uses: lukka/run-vcpkg@v11
25-
- name: install dependencies
46+
- name: Install dependencies
2647
run: |
2748
sudo apt update
28-
sudo apt install -y g++
29-
- name: Compile
49+
sudo apt install -y ninja-build ${{ matrix.additional-dep }}
50+
- name: Compile
3051
run: |
31-
g++ --version
32-
cmake -S . -B build -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release
33-
cmake --build build -j 4
34-
- name: Run tests
52+
if [[ "${{ matrix.compiler }}" == "llvm" ]]; then
53+
export CC=clang-${{ matrix.compiler-version }}
54+
export CXX=clang++-${{ matrix.compiler-version }}
55+
elif [[ "${{ matrix.compiler }}" == "gcc" ]]; then
56+
export CC=gcc-${{ matrix.compiler-version }}
57+
export CXX=g++-${{ matrix.compiler-version }}
58+
fi
59+
sudo ln -s $(which ccache) /usr/local/bin/$CC
60+
sudo ln -s $(which ccache) /usr/local/bin/$CXX
61+
$CXX --version
62+
cmake -S . -B build -G Ninja -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release
63+
cmake --build build
64+
- name: Run tests
3565
run: |
36-
./build/tests/bson/reflect-cpp-bson-tests
37-
./build/tests/cbor/reflect-cpp-cbor-tests
38-
./build/tests/flexbuffers/reflect-cpp-flexbuffers-tests
39-
./build/tests/generic/reflect-cpp-generic-tests
40-
./build/tests/json/reflect-cpp-json-tests
41-
./build/tests/json_c_arrays_and_inheritance/reflect-cpp-json-c-arrays-and-inheritance-tests
42-
./build/tests/msgpack/reflect-cpp-msgpack-tests
43-
./build/tests/toml/reflect-cpp-toml-tests
44-
./build/tests/xml/reflect-cpp-xml-tests
45-
./build/tests/yaml/reflect-cpp-yaml-tests
66+
ctest --test-dir build --output-on-failure
4667
- name: Run benchmarks
4768
run: |
4869
echo '# Benchmarks' >> $GITHUB_STEP_SUMMARY
@@ -61,5 +82,3 @@ jobs:
6182
./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=canada >> $GITHUB_STEP_SUMMARY
6283
./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=licenses >> $GITHUB_STEP_SUMMARY
6384
echo '```' >> $GITHUB_STEP_SUMMARY
64-
65-

.github/workflows/macos-clang-arm.yaml

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)