From a053b92911ff5c36989992eff8561216362d7570 Mon Sep 17 00:00:00 2001 From: Weaselbot Date: Tue, 30 Jun 2026 20:36:37 +0000 Subject: [PATCH] Add basic Gitea Actions CI workflow (#6) Closes #5 Adds a Gitea Actions workflow that runs pre-commit checks and builds/tests the project on clang and gcc for both amd64 and arm64. weaseljson is checked out, built, and installed locally because weaseldb depends on it via `find_package(weaseljson REQUIRED)`. Also switches the llhttp FetchContent declaration from a tarball URL to a git repository pinned to the same release commit. The tarball redirect goes through codeload.github.com, which can be blocked in restricted network environments; using git keeps the fetch on github.com. Reviewed-on: https://git.weaselab.dev/weaselab/weaseldb/pulls/6 Co-authored-by: Weaselbot Co-committed-by: Weaselbot --- .gitea/workflows/ci.yml | 69 ++++++++++++++++++++++++++++++ CMakeLists.txt | 7 ++- src/json_commit_request_parser.hpp | 2 +- 3 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..3a7e02c --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,69 @@ +name: CI + +on: [push, pull_request] + +jobs: + pre-commit: + runs-on: ubuntu-latest-amd64 + steps: + - uses: actions/checkout@v4 + + - name: Install pre-commit + run: pipx install pre-commit + + - name: Run pre-commit + run: ~/.local/bin/pre-commit run --all-files --show-diff-on-failure + + build: + strategy: + fail-fast: false + matrix: + include: + - name: clang-amd64 + runner: ubuntu-latest-amd64 + cmake_args: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + - name: clang-arm64 + runner: ubuntu-latest-arm64 + cmake_args: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + - name: gcc-amd64 + runner: ubuntu-latest-amd64 + cmake_args: -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ + - name: gcc-arm64 + runner: ubuntu-latest-arm64 + cmake_args: -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ + runs-on: ${{ matrix.runner }} + steps: + - uses: actions/checkout@v4 + with: + path: weaseldb + + - name: Checkout weaseljson + uses: actions/checkout@v4 + with: + repository: weaselab/weaseljson + path: weaseljson + + - name: Install deps + run: | + sudo apt-get update + sudo apt-get install -y build-essential clang cmake gperf + + - name: Build and install weaseljson + run: | + cmake -S weaseljson -B weaseljson/build \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="$(pwd)/weaseljson/install" + cmake --build weaseljson/build -j "$(nproc)" + cmake --install weaseljson/build + + - name: Build weaseldb + run: | + cmake -S weaseldb -B weaseldb/build ${{ matrix.cmake_args }} \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DCMAKE_PREFIX_PATH="$(pwd)/weaseljson/install" + cmake --build weaseldb/build -j "$(nproc)" + + - name: Test + run: | + cd weaseldb/build + ctest --output-on-failure -j "$(nproc)" --timeout 90 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5404f5c..d9bf403 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,10 +80,9 @@ FetchContent_MakeAvailable(simdutf) FetchContent_Declare( llhttp - URL "https://github.com/nodejs/llhttp/archive/refs/tags/release/v9.2.1.tar.gz" - URL_HASH - SHA256=3c163891446e529604b590f9ad097b2e98b5ef7e4d3ddcf1cf98b62ca668f23e - DOWNLOAD_EXTRACT_TIMESTAMP ON) + GIT_REPOSITORY https://github.com/nodejs/llhttp.git + GIT_TAG 610a87d755f6bae466cd871c2ba97574ccac5483 # release/v9.2.1 +) set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "") diff --git a/src/json_commit_request_parser.hpp b/src/json_commit_request_parser.hpp index 6d28e45..8ddf6f1 100644 --- a/src/json_commit_request_parser.hpp +++ b/src/json_commit_request_parser.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include "commit_request_parser.hpp" #include "json_token_enum.hpp"