diff --git a/.qlty/hooks/pre-commit.sh b/.qlty/hooks/pre-commit.sh new file mode 100755 index 000000000..d2489ddbc --- /dev/null +++ b/.qlty/hooks/pre-commit.sh @@ -0,0 +1,2 @@ +#\!/bin/sh +qlty fmt --trigger pre-commit --index-file="$GIT_INDEX_FILE" diff --git a/.qlty/hooks/pre-push.sh b/.qlty/hooks/pre-push.sh new file mode 100755 index 000000000..b1b3184c8 --- /dev/null +++ b/.qlty/hooks/pre-push.sh @@ -0,0 +1,6 @@ +#\!/bin/sh +qlty check \ + --trigger pre-push \ + --upstream-from-pre-push \ + --no-formatters \ + --skip-errored-plugins diff --git a/.qlty/qlty.toml b/.qlty/qlty.toml new file mode 100644 index 000000000..ca9fde907 --- /dev/null +++ b/.qlty/qlty.toml @@ -0,0 +1,39 @@ +config_version = "0" + +exclude_patterns = [ + "build/**", + "target/**", + "src/libshared/**", + "src/taskchampion-cpp/corrosion/**", +] + +test_patterns = [ + "test/**", +] + +[smells] +mode = "comment" + +[[source]] +name = "default" +default = true + +# Rust linting via clippy +[[plugin]] +name = "clippy" +mode = "block" + +# Rust formatting via rustfmt +[[plugin]] +name = "rustfmt" +mode = "block" + +# Secret scanning — catches leaked API keys, credentials +[[plugin]] +name = "trufflehog" +mode = "block" + +# Dependency vulnerability scanning (scans Cargo.lock) +[[plugin]] +name = "osv-scanner" +mode = "block" diff --git a/.woodpecker/ci.yaml b/.woodpecker/ci.yaml new file mode 100644 index 000000000..ddbb4f8f5 --- /dev/null +++ b/.woodpecker/ci.yaml @@ -0,0 +1,36 @@ +clone: + git: + image: woodpeckerci/plugin-git + settings: + recursive: true + +when: + - event: pull_request + - event: push + branch: develop + +steps: + - name: rust-fmt + image: rust:1.88 + commands: + - rustup component add rustfmt + - cargo fmt --all -- --check + + - name: clippy + image: rust:1.88 + commands: + - rustup component add clippy + - cargo clippy --all-features -- -D warnings + + - name: cargo-test + image: rust:1.88 + commands: + - cargo test + + - name: cmake-build-test + image: rust:1.88 + commands: + - apt-get update && apt-get install -y --no-install-recommends + build-essential cmake git uuid-dev faketime locales + python3 ninja-build ca-certificates make + - make test diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..7ab31973e --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +BUILD_DIR := build +BUILD_DIR_TEST := build-test +BUILD_TYPE ?= Release +NPROC := $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4) + +.PHONY: build install test clean + +build: + cmake -S . -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) + cmake --build $(BUILD_DIR) -j$(NPROC) + +# Installs task binary, man pages, and docs per CMakeLists.txt install() rules. +# Use CMAKE_INSTALL_PREFIX to control destination (default: /usr/local). +install: build + cmake --install $(BUILD_DIR) + +# Uses a separate build-test dir (Debug) so it never clobbers the release build. +test: + cmake -S . -B $(BUILD_DIR_TEST) -DCMAKE_BUILD_TYPE=Debug + cmake --build $(BUILD_DIR_TEST) --target test_runner --target task_executable -j$(NPROC) + ctest --test-dir $(BUILD_DIR_TEST) -j$(NPROC) --output-on-failure + +clean: + rm -rf $(BUILD_DIR) $(BUILD_DIR_TEST) diff --git a/README.md b/README.md index 548b89af0..b78dd6fb8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@

+[![CI](https://ci.guion.io/api/badges/GuionAI/taskwarrior/status.svg)](https://ci.guion.io/GuionAI/taskwarrior) [![GitHub Actions build status](https://github.com/GothenburgBitFactory/taskwarrior/workflows/tests/badge.svg?branch=develop)](https://github.com/GothenburgBitFactory/taskwarrior/actions) [![Coverage Status](https://coveralls.io/repos/github/GothenburgBitFactory/taskwarrior/badge.svg?branch=develop)](https://coveralls.io/github/GothenburgBitFactory/taskwarrior?branch=develop) [![Release](https://img.shields.io/github/v/release/GothenburgBitFactory/taskwarrior)](https://github.com/GothenburgBitFactory/taskwarrior/releases/latest)