Skip to content

Commit

Permalink
Merge pull request #568 from cole-miller/import-raft
Browse files Browse the repository at this point in the history
Import raft
  • Loading branch information
cole-miller authored Feb 20, 2024
2 parents ea2b044 + f99d254 commit d408763
Show file tree
Hide file tree
Showing 197 changed files with 45,376 additions and 161 deletions.
12 changes: 12 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Checks: '-*,readability-identifier-naming'
HeaderFilterRegex: '.*'
WarningsAsErrors: '*'
CheckOptions:
- key: readability-identifier-naming.StructCase
value: lower_case
- key: readability-identifier-naming.UnionCase
value: lower_case
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.TypedefCase
value: lower_case
26 changes: 8 additions & 18 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,33 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Setup dependencies

- name: Set up dependencies
run: |
sudo apt update
sudo apt install -y lcov libsqlite3-dev liblz4-dev libuv1-dev
- name: Build raft
env:
CC: ${{ matrix.compiler }}
run: |
git clone https://github.com/canonical/raft.git --depth 1
cd raft
autoreconf -i
./configure --enable-debug --enable-sanitize
make -j4
sudo make install
sudo ldconfig
cd ..
- name: Build dqlite
env:
CC: ${{ matrix.compiler }}
run: |
autoreconf -i
./configure --enable-debug --enable-code-coverage --enable-sanitize
make CFLAGS=-O0 -j2
./configure --enable-debug --enable-code-coverage --enable-sanitize --enable-build-raft
make -j4
- name: Test
env:
CC: ${{ matrix.compiler }}
run: |
export ${{ matrix.tracing }}
make CFLAGS=-O0 -j2 check || (cat ./test-suite.log && false)
make -j4 check || (cat ./test-suite.log && false)
- name: Coverage
env:
CC: ${{ matrix.compiler }}
run: if [ "${CC}" = "gcc" ]; then make code-coverage-capture; fi
if: ${{ matrix.compiler == 'gcc' }}
run: |
make code-coverage-capture
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
18 changes: 2 additions & 16 deletions .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,17 @@ jobs:
sudo make -j$(nproc) install
sudo ldconfig
- name: Check out raft
uses: actions/checkout@v4
with:
repository: canonical/raft
path: raft

- name: Install raft
run: |
cd raft
autoreconf -i
./configure --enable-debug --enable-uv --enable-sanitize --enable-backtrace
sudo make -j$(nproc) install
sudo ldconfig
- name: Check out dqlite
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/head
ref: refs/pull/${{ github.event.issue.number }}/merge
path: dqlite

- name: Install dqlite
run: |
cd dqlite
autoreconf -i
./configure --enable-debug --enable-sanitize --enable-backtrace
./configure --enable-debug --enable-sanitize --enable-backtrace --enable-build-raft
sudo make -j$(nproc)
sudo make install
sudo ldconfig
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/external-raft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI Tests (external libraft)

on:
- push
- pull_request

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup dependencies
run: |
sudo apt update
sudo apt install -y libsqlite3-dev liblz4-dev libuv1-dev
- name: Build raft
run: |
git clone https://github.com/canonical/raft --depth 1
cd raft
autoreconf -i
./configure --enable-debug --enable-sanitize
make -j4
sudo make install
sudo ldconfig
- name: Build dqlite
run: |
autoreconf -i
./configure --enable-debug --enable-sanitize
make -j4
- name: Test
run: |
export LIBRAFT_TRACE=1 LIBDQLITE_TRACE=1
make -j4 check || (cat ./test-suite.log && false)
22 changes: 16 additions & 6 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: DoozyX/[email protected]
with:
source: 'src test include'
exclude: 'test/lib/munit.*'
extensions: 'c,h'
clangFormatVersion: 14
style: file
fetch-depth: 2
- name: Install apt dependencies
run: |
sudo apt update
sudo apt install -y libsqlite3-dev liblz4-dev libuv1-dev bear
- uses: KyleMayes/install-llvm-action@master
with:
version: 17
- name: Run clang-format
run: |
find . \( -name '*.c' -or -name '*.h' \) -not -name 'munit.*' -path ./llvm -prune | xargs ./llvm/bin/clang-format --style=file --dry-run -Werror
- name: Run clang-tidy
run: |
shopt -s globstar
bear -- cc -D_GNU_SOURCE -DHAVE_LINUX_AIO_ABI_H -c {src,test}/**/*.c
git show -U0 --first-parent | ./clang-tidy-diff.py -p1 -config-file=.clang-tidy -clang-tidy-binary=./llvm/bin/clang-tidy -use-color
Loading

0 comments on commit d408763

Please sign in to comment.