-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (100 loc) · 3.19 KB
/
Copy pathci.yml
File metadata and controls
119 lines (100 loc) · 3.19 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: CI/CD Pipeline
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
build-type: [Release, Debug]
include:
- os: ubuntu-latest
compiler: gcc
cxx_compiler: g++
- os: ubuntu-latest
compiler: clang
cxx_compiler: clang++
- os: macos-latest
compiler: clang
cxx_compiler: clang++
cxx_flags: "-stdlib=libc++"
- os: windows-latest
compiler: msvc
cxx_compiler: cl
generator: "Visual Studio 17 2022"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
- name: Configure CMake (Linux)
if: runner.os == 'Linux'
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_C_COMPILER=${{ matrix.compiler }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }}
- name: Configure CMake (macOS)
if: runner.os == 'macOS'
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}"
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
run: |
cmake -B build -G "${{ matrix.generator }}"
- name: Build (Linux)
if: runner.os == 'Linux'
run: cmake --build build -j$(nproc)
- name: Build (macOS)
if: runner.os == 'macOS'
run: cmake --build build -j$(sysctl -n hw.ncpu)
- name: Build (Windows)
if: runner.os == 'Windows'
run: cmake --build build --config ${{ matrix.build-type }} -j 4
- name: Run Tests (Linux/macOS)
if: runner.os != 'Windows'
run: |
cd build
./hash_table_demo
- name: Run Tests (Windows)
if: runner.os == 'Windows'
run: |
cd build
.\${{ matrix.build-type }}\hash_table_demo.exe
- name: Upload Artifact
uses: actions/upload-artifact@v4
if: matrix.build-type == 'Release'
with:
name: hash_table_demo-${{ runner.os }}-${{ matrix.build-type }}
path: ${{ runner.os == 'Windows' && 'build/Release/hash_table_demo.exe' || 'build/hash_table_demo' }}
retention-days: 7
code-quality:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake clang-format
- name: Check code formatting
run: |
find include src -name "*.h" -o -name "*.cpp" | xargs clang-format --dry-run --Werror || true
- name: Build with sanitizers
run: |
cmake -B build-sanitize \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined"
cmake --build build-sanitize
cd build-sanitize
./hash_table_demo