-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (85 loc) · 3.03 KB
/
build.yml
File metadata and controls
96 lines (85 loc) · 3.03 KB
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
name: Build Matrix
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
build:
name: Build on ${{ matrix.os }} with ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [gcc, clang]
build_type: [Release, Debug]
exclude:
# Skip some combinations to save CI time
- os: macos-latest
build_type: Debug
# macOS "gcc" is clang and cannot compile the legacy-style C++ test
- os: macos-latest
compiler: gcc
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential clang
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install cmake
- name: Configure build
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }}
run: |
mkdir -p build
cd build
EXTRA_FLAGS=""
if [ "${{ matrix.compiler }}" = "clang" ]; then
EXTRA_FLAGS="-DCMAKE_CXX_FLAGS=-fpermissive -Wno-writable-strings -Wno-pointer-arith"
fi
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} $EXTRA_FLAGS ..
- name: Build
run: |
cd build
if [ "${{ matrix.compiler }}" = "clang" ]; then
cmake --build . --target libcsv --parallel --config ${{ matrix.build_type }}
cmake --build . --target csvcpp --parallel --config ${{ matrix.build_type }}
cmake --build . --target csvtest --parallel --config ${{ matrix.build_type }}
cmake --build . --target csvinfo --parallel --config ${{ matrix.build_type }}
cmake --build . --target csvfix --parallel --config ${{ matrix.build_type }}
cmake --build . --target csvvalid --parallel --config ${{ matrix.build_type }}
else
cmake --build . --parallel --config ${{ matrix.build_type }}
fi
- name: Run tests
if: ${{ matrix.compiler != 'clang' }}
run: |
cd build
cmake --build . --target test_parity --parallel
./tests/test_parity
- name: Build examples
run: |
cd build
cmake --build . --target csvtest --parallel
cmake --build . --target csvinfo --parallel
cmake --build . --target csvfix --parallel
cmake --build . --target csvvalid --parallel
summary:
name: Build Summary
runs-on: ubuntu-latest
needs: build
if: always()
steps:
- name: ✅ Build Matrix Successful
if: ${{ needs.build.result == 'success' }}
run: echo "All builds passed on all platforms!"
- name: ❌ Build Matrix Failed
if: ${{ needs.build.result == 'failure' }}
run: exit 1