feat: CI/CD, Bash-Completion und README-Verbesserungen

- GitHub Actions CI Pipeline (Tests, Clippy, Format-Checks)
- GitHub Actions Release Pipeline (Multi-Platform Builds)
- Bash-Completion Script für Shell-Autovervollständigung
- Zsh-Completion Script (_ntu)
- README Badges (CI, Release, Version, License)
- Installationsanleitung für Pre-built Binaries
- Alte build.yaml entfernt (ersetzt durch moderne ci.yml)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-02-10 10:39:44 +01:00
commit 53c10f1913
6 changed files with 266 additions and 64 deletions

View file

@ -1,62 +0,0 @@
name: Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: [stable]
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Clippy check
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose

107
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,107 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
run: cargo test --verbose
- name: Run tests (release mode)
run: cargo test --release --verbose
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ntu-${{ matrix.target }}
path: target/${{ matrix.target }}/release/ntu

66
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,66 @@
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
name: Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: ntu
asset_name: ntu-linux-x86_64
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: ntu
asset_name: ntu-linux-x86_64-musl
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: ntu
asset_name: ntu-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: ntu
asset_name: ntu-macos-arm64
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Install musl-tools (Linux musl only)
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Strip binary (Linux only)
if: startsWith(matrix.os, 'ubuntu')
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
- name: Compress binary
run: |
cd target/${{ matrix.target }}/release
tar czf ${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }}
mv ${{ matrix.asset_name }}.tar.gz ../../..
- name: Upload binary to release
uses: softprops/action-gh-release@v2
with:
files: ${{ matrix.asset_name }}.tar.gz
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,5 +1,11 @@
# Filename Repair Tool for Linux # NameToUnix
# "NameToUnix"
[![CI](https://github.com/jamulix/NameToUnix/workflows/CI/badge.svg)](https://github.com/jamulix/NameToUnix/actions)
[![Release](https://github.com/jamulix/NameToUnix/workflows/Release/badge.svg)](https://github.com/jamulix/NameToUnix/releases)
[![Version](https://img.shields.io/github/v/release/jamulix/NameToUnix)](https://github.com/jamulix/NameToUnix/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
**Filename Repair Tool for Linux** · Binary: `ntu`
(german and english) (german and english)
@ -41,6 +47,29 @@ Dies ist mein erstes Programm in Rust. (Bitte seid gnädig.)
## Installation ## Installation
### Option 1: Pre-built Binary (Recommended)
Download the latest release for your platform from [GitHub Releases](https://github.com/jamulix/NameToUnix/releases):
```bash
# Linux x86_64
wget https://github.com/jamulix/NameToUnix/releases/latest/download/ntu-linux-x86_64.tar.gz
tar xzf ntu-linux-x86_64.tar.gz
sudo mv ntu /usr/local/bin/
# macOS Intel
wget https://github.com/jamulix/NameToUnix/releases/latest/download/ntu-macos-x86_64.tar.gz
tar xzf ntu-macos-x86_64.tar.gz
sudo mv ntu /usr/local/bin/
# macOS Apple Silicon (M1/M2)
wget https://github.com/jamulix/NameToUnix/releases/latest/download/ntu-macos-arm64.tar.gz
tar xzf ntu-macos-arm64.tar.gz
sudo mv ntu /usr/local/bin/
```
### Option 2: Build from Source
Die ausführbare Datei wird unter `target/release/ntu` erstellt. Du solltest sie mit 'sudo cp target/release/ntu /usr/local/bin/' kopieren. Sie ist dann für alle User verfügbar. Denke daran, die Konfiguationsdatei (s. u.) ebenfalls zu kopieren. Sie kann für jeden User individuell angepasst werden, wenn sie im home-Verzeichnis des Users liegt. Die ausführbare Datei wird unter `target/release/ntu` erstellt. Du solltest sie mit 'sudo cp target/release/ntu /usr/local/bin/' kopieren. Sie ist dann für alle User verfügbar. Denke daran, die Konfiguationsdatei (s. u.) ebenfalls zu kopieren. Sie kann für jeden User individuell angepasst werden, wenn sie im home-Verzeichnis des Users liegt.
The executable file is created under `target/release/ntu`. You should copy it with 'sudo cp target/release/ntu /usr/local/bin/'. It is then available for all users. Remember to copy the configuration file (see below) as well. It can be customized for each user individually if it is located in the user's home directory. The executable file is created under `target/release/ntu`. You should copy it with 'sudo cp target/release/ntu /usr/local/bin/'. It is then available for all users. Remember to copy the configuration file (see below) as well. It can be customized for each user individually if it is located in the user's home directory.
@ -58,6 +87,11 @@ sudo cp .NameToUnix.conf /etc/NameToUnix/config.toml # Copy config file to
# Lokale Einstellungen / Local settings # Lokale Einstellungen / Local settings
mkdir -p ~/.config/NameToUnix/ # Create a personal config directory for NameToUnix mkdir -p ~/.config/NameToUnix/ # Create a personal config directory for NameToUnix
cp .NameToUnix.conf ~/.config/NameToUnix/config.toml # Copy config file to this personal directory cp .NameToUnix.conf ~/.config/NameToUnix/config.toml # Copy config file to this personal directory
# Bash-Completion (optional)
sudo cp completions/ntu.bash /etc/bash_completion.d/ntu # Bash completion
# Oder für Zsh:
sudo cp completions/_ntu /usr/share/zsh/site-functions/_ntu # Zsh completion
``` ```
## Usage ## Usage

22
completions/_ntu Normal file
View file

@ -0,0 +1,22 @@
#compdef ntu
# Zsh completion for ntu (NameToUnix)
_ntu() {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
'(-n --dry-run --no-changes)'{-n,--dry-run,--no-changes}'[Only preview changes without renaming]' \
'(-q --quiet)'{-q,--quiet}'[Suppress output]' \
'(-f --force)'{-f,--force}'[Overwrite existing files]' \
'*'{-e,--exclude}'[Exclude pattern]:pattern:' \
'(-v --verbose)'{-v,--verbose}'[Verbose debug output]' \
'--modify-root[Also rename root directory]' \
'--special[Process symlinks and special files]' \
'(-h --help)'{-h,--help}'[Print help]' \
'(-V --version)'{-V,--version}'[Print version]' \
'*:path:_files'
}
_ntu "$@"

35
completions/ntu.bash Normal file
View file

@ -0,0 +1,35 @@
# Bash completion for ntu (NameToUnix)
_ntu_completion() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# All available options
opts="--dry-run --no-changes --quiet --force --exclude --verbose --modify-root --special --help --version -n -q -f -e -v -h -V"
# Handle options that require arguments
case "${prev}" in
-e|--exclude)
# Suggest glob patterns
COMPREPLY=( $(compgen -W '"*.tmp" "*.log" "*.bak" "*.swp" "*~"' -- ${cur}) )
return 0
;;
*)
;;
esac
# If current word starts with -, complete with options
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
# Otherwise complete with directories and files
COMPREPLY=( $(compgen -f -- ${cur}) )
return 0
}
# Register completion function
complete -F _ntu_completion ntu