-
Notifications
You must be signed in to change notification settings - Fork 7
143 lines (118 loc) · 4.15 KB
/
tests.yml
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
name: Tests
on:
- push
- pull_request
jobs:
test:
name: Unit and integration tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qq lcov linux-libc-dev libuv1-dev btrfs-progs xfsprogs zfsutils-linux
- name: Amalgamation
run: |
git clone --depth 1 https://github.com/edlund/amalgamate.git
export PATH=$PATH:$PWD/amalgamate
amalgamate.py --config=amalgamation.json --source=$(pwd)
gcc raft.c -c -D_GNU_SOURCE -DHAVE_LINUX_AIO_ABI_H -Wall -Wextra -Wpedantic -fpic
- name: Configure
run: |
autoreconf -i
./configure --enable-example \
--enable-debug \
--enable-code-coverage \
--enable-sanitize \
--enable-benchmark
- name: Build
run: |
make -j$(nproc --all)
- name: Test
run: |
export LIBRAFT_TRACE=1
./test/lib/fs.sh setup
make check $(./test/lib/fs.sh detect) || (cat ./test-suite.log && false)
./test/lib/fs.sh teardown
- name: Coverage
run: |
make code-coverage-capture
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
verbose: true
linting:
name: Linting
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: DoozyX/clang-format-lint-action@v0.14
with:
source: 'src test example'
exclude: 'test/lib/munit.*'
extensions: 'c,h'
clangFormatVersion: 14
style: file
configure:
name: Configuration flags
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Check that no optional dependency is installed
run: |
# Remove liblz4-dev which is installed by default on the runner
sudo apt-get remove liblz4-dev
# Check that there are no dependencies installed
! pkg-config --exists libuv
! pkg-config --exists liblz4
- name: Run autoreconf
run: |
autoreconf -i
- name: With no deps ./configure
run: |
# Succeed, since we are not explicitly requiring libuv.
./configure
- name: With no deps ./configure --enable-uv
run: |
# Fail, since libuv is not installed.
! ./configure --enable-uv 2>errors
tail -1 errors | grep -q "libuv required but not found" || (cat errors && false)
- name: With no deps ./configure --with-lz4
run: |
# Fail, since using lz4 makes sense only if libuv is used too.
! ./configure --with-lz4 2>errors
tail -1 errors | grep -q "liblz4 can be used only if libuv is used too" || (cat errors && false)
- name: Install libuv
run: |
sudo apt-get install -qq linux-libc-dev libuv1-dev
- name: With libuv only ./configure
run: |
# Succeed, since libuv is installed and automatically used.
./configure
- name: With libuv only ./configure --disable-uv
run: |
# Succeed, since libuv support can be disabled
./configure --disable-uv
- name: With libuv only ./configure --with-lz4
run: |
# Fail, since liblz4 is not installed.
! ./configure --with-lz4 2>errors
tail -1 errors | grep -q "liblz4 required but not found" || (cat errors && false)
- name: With libuv only ./configure --disable-uv --with-lz4
run: |
# Fail, since using lz4 makes sense only if libuv is used too.
! ./configure --disable-uv --with-lz4 2>errors
tail -1 errors | grep -q "liblz4 can be used only if libuv is used too" || (cat errors && false)
- name: Install liblz4
run: |
sudo apt-get install -qq liblz4-dev
- name: With libuv and liblz4 ./configure
run: |
# Succeed, since all optional dependencies are found and used.
./configure
- name: With libuv and liblz4 ./configure --without-lz4
run: |
# Succeed, since we support building without lz4 even if both libuv and
# liblz4 are found.
./configure --without-lz4