-
Notifications
You must be signed in to change notification settings - Fork 12
100 lines (80 loc) · 2.46 KB
/
tests.yaml
File metadata and controls
100 lines (80 loc) · 2.46 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
name: Queue Tests
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
# 🔹 Detect changed files
- name: Detect changes
id: changes
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE="origin/main"
git fetch origin main
else
BASE="${{ github.event.before }}"
fi
echo "Base: $BASE"
echo "Head: ${{ github.sha }}"
CHANGED_FILES=$(git diff --name-only $BASE ${{ github.sha }})
echo "Changed files:"
echo "$CHANGED_FILES"
# SPSC (bounded + unbounded)
if echo "$CHANGED_FILES" | grep -E "lockfree_spsc"; then
echo "run_spsc=true" >> $GITHUB_OUTPUT
fi
# MPSC
if echo "$CHANGED_FILES" | grep -E "lockfree_mpsc"; then
echo "run_mpsc=true" >> $GITHUB_OUTPUT
fi
# MPMC
if echo "$CHANGED_FILES" | grep -E "lockfree_mpmc|blocking_mpmc"; then
echo "run_mpmc=true" >> $GITHUB_OUTPUT
fi
# If tests themselves change → run corresponding
if echo "$CHANGED_FILES" | grep -E "test_spsc.cpp"; then
echo "run_spsc=true" >> $GITHUB_OUTPUT
fi
if echo "$CHANGED_FILES" | grep -E "test_mpsc.cpp"; then
echo "run_mpsc=true" >> $GITHUB_OUTPUT
fi
if echo "$CHANGED_FILES" | grep -E "test_mpmc.cpp"; then
echo "run_mpmc=true" >> $GITHUB_OUTPUT
fi
# 🔹 Install deps
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ libgtest-dev
# 🔹 Build GTest
- name: Build GTest
run: |
cd /usr/src/gtest
sudo cmake .
sudo make
sudo cp lib/*.a /usr/lib
# 🔹 Build project
- name: Build project
run: |
rm -rf build
cmake -B build
cmake --build build
# 🔹 Selective tests
- name: Run SPSC tests
if: steps.changes.outputs.run_spsc == 'true'
run: cd build && ./test_spsc
- name: Run MPSC tests
if: steps.changes.outputs.run_mpsc == 'true'
run: cd build && ./test_mpsc
- name: Run MPMC tests
if: steps.changes.outputs.run_mpmc == 'true'
run: cd build && ./test_mpmc
# 🔹 Safety net (always runs)
- name: Run full test suite (safety)
run: cd build && ctest --output-on-failure