feat: add CI/CD workflows, release automation, and CLI version flag
CI / build (push) Failing after 2m41s
CI / build (pull_request) Failing after 6s

Adds Gitea Actions for continuous integration and tagged releases, including static musl binary compilation and artifact upload. Introduces a Makefile target to automate semantic version bumping and publishing. Bumps the package version to 0.1.1 and enables automatic `--version` output via Clap.
This commit is contained in:
Eric Coissac
2026-06-22 10:33:16 +02:00
parent c1d6f277ce
commit a522c0907e
6 changed files with 107 additions and 3 deletions
+32
View File
@@ -0,0 +1,32 @@
name: CI
on:
push:
branches: ['**']
pull_request:
jobs:
build:
runs-on: ubuntu-latest
container: rust:latest
defaults:
run:
working-directory: src
steps:
- uses: actions/checkout@v4
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
src/target
key: ${{ runner.os }}-cargo-${{ hashFiles('src/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Build
run: cargo build --release
- name: Test
run: cargo test --release
+47
View File
@@ -0,0 +1,47 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
build-linux-static:
runs-on: ubuntu-latest
container: rust:latest
defaults:
run:
working-directory: src
steps:
- uses: actions/checkout@v4
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
src/target
key: linux-musl-cargo-${{ hashFiles('src/Cargo.lock') }}
restore-keys: linux-musl-cargo-
- name: Install musl toolchain
run: |
apt-get update -qq && apt-get install -y -qq musl-tools
rustup target add x86_64-unknown-linux-musl
- name: Build static binary
run: cargo build --release --target x86_64-unknown-linux-musl
- name: Prepare artifact
run: |
mkdir -p /tmp/dist
cp target/x86_64-unknown-linux-musl/release/obikmer /tmp/dist/obikmer-linux-x86_64
strip /tmp/dist/obikmer-linux-x86_64
- name: Upload release asset
uses: actions/upload-artifact@v4
with:
name: obikmer-linux-x86_64
path: /tmp/dist/obikmer-linux-x86_64
if-no-files-found: error
+25
View File
@@ -63,3 +63,28 @@ clean-doc:
.PHONY: clean
clean: clean-doc
rm -rf $(VENV)
# ── release ───────────────────────────────────────────────────────────────────
CARGO_TOML := $(CARGO_DIR)/obikmer/Cargo.toml
.PHONY: bump-version
bump-version:
@current=$$(grep '^version = ' $(CARGO_TOML) | head -n 1 | sed 's/version = "\(.*\)"/\1/'); \
if [ -n "$(RELEASE)" ]; then \
new_version="$(RELEASE)"; \
else \
major=$$(echo $$current | cut -d. -f1); \
minor=$$(echo $$current | cut -d. -f2); \
patch=$$(echo $$current | cut -d. -f3); \
new_patch=$$((patch + 1)); \
new_version="$$major.$$minor.$$new_patch"; \
fi; \
echo "Version: $$current -> $$new_version"; \
sed -i.bak "s/^version = \"$$current\"/version = \"$$new_version\"/" $(CARGO_TOML) && \
rm $(CARGO_TOML).bak
.PHONY: release
release: bump-version
@jj auto-describe
@jj git push --change @
+1 -1
View File
@@ -1704,7 +1704,7 @@ dependencies = [
[[package]]
name = "obikmer"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"clap",
"csv",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "obikmer"
version = "0.1.0"
version = "0.1.1"
edition = "2024"
[[bin]]
+1 -1
View File
@@ -6,7 +6,7 @@ use clap::{Parser, Subcommand};
use tracing_subscriber::{EnvFilter, fmt};
#[derive(Parser)]
#[command(name = "obikmer", about = "DNA k-mer tools")]
#[command(name = "obikmer", about = "DNA k-mer tools", version)]
struct Cli {
#[command(subcommand)]
command: Commands,