commit 08befc1bf509a80fff293e05d0cc7737d6e3aa37 Author: BlackAngelTV Date: Thu Nov 26 18:14:36 2026 +0100 chore: add repository baseline with Gitea CI The repository needs its ignore rules, a version file and the workflows that turn a version bump into a signed Arch package published to repo.laxacube.ch. diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml new file mode 100644 index 0000000..599ce57 --- /dev/null +++ b/.gitea/workflows/package.yml @@ -0,0 +1,165 @@ +name: package + +on: + push: + branches: [main] + # Only a version change produces a release; other commits stay off this path. + paths: [version] + workflow_dispatch: + +permissions: + contents: write + +# Releases are ordered: a second run waits instead of racing for the same tag. +concurrency: + group: package + cancel-in-progress: false + +jobs: + package: + # Arch containers cannot be stored on the NTFS runner disk: pacman's local + # database uses ':' in epoch directory names, which NTFS rejects. The package + # is therefore built by makepkg on the Arch host itself. + runs-on: arch-host + env: + REPO_TOKEN: ${{ secrets.REPO_TOKEN }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + # makepkg writes the keyring it imports into; the job keeps it out of the + # checkout and removes it with the runner's temporary directory. + GNUPGHOME: ${{ runner.temp }}/gnupg + steps: + - uses: actions/checkout@v4 + + - name: Read the version file + id: version + run: | + set -euo pipefail + version="$(tr -d '[:space:]' < version)" + if [ -z "$version" ]; then + echo "::error file=version::the version file is empty" + exit 1 + fi + echo "version=$version" >> "$GITHUB_OUTPUT" + + - name: Import the package signing key + if: env.GPG_PRIVATE_KEY != '' + run: | + set -euo pipefail + mkdir -p "$GNUPGHOME" + chmod 700 "$GNUPGHOME" + printf '%s' "$GPG_PRIVATE_KEY" | base64 -d | gpg --batch --import + gpg --batch --list-secret-keys --keyid-format=long + + - name: Build the Arch package + id: package + run: | + set -euo pipefail + version='${{ steps.version.outputs.version }}' + work="$RUNNER_TEMP/build" + rm -rf "$work" + mkdir -p "$work" + cp PKGBUILD version "$work/" + git archive --format=tar.gz --prefix="fws-diskcleaner-$version/" \ + -o "$work/fws-diskcleaner-$version.tar.gz" HEAD + # makepkg needs the PKGBUILD, the version file it reads and the source + # tarball in one directory; the runner's checkout stays untouched. + cd "$work" + # The packager and the signing key live in makepkg's configuration, and + # makepkg has no command-line flag for either. + conf="$work/makepkg.conf" + cp /etc/makepkg.conf "$conf" + printf 'PACKAGER="%s"\n' 'BlackAngelTVdev ' >> "$conf" + sign=() + if gpg --batch --list-secret-keys 2>/dev/null | grep -q '^sec'; then + gpgkey="$(gpg --batch --with-colons --list-secret-keys \ + | awk -F: '/^fpr:/{print $10; exit}')" + printf 'GPGKEY="%s"\n' "$gpgkey" >> "$conf" + sign=(--sign) + else + echo "::warning::no signing key available, releasing an unsigned package" + fi + makepkg --config "$conf" --noconfirm --nodeps --force --cleanbuild "${sign[@]}" + asset="$(ls -1 ./*.pkg.tar.zst | grep -v -- '-debug-' | head -1)" + echo "file=$work/${asset##*/}" >> "$GITHUB_OUTPUT" + echo "name=${asset##*/}" >> "$GITHUB_OUTPUT" + if [ -f "${asset}.sig" ]; then + echo "sig=$work/${asset##*/}.sig" >> "$GITHUB_OUTPUT" + fi + + - name: Verify the signature + if: steps.package.outputs.sig != '' + env: + PACKAGE_FILE: ${{ steps.package.outputs.file }} + SIGNATURE: ${{ steps.package.outputs.sig }} + run: | + set -euo pipefail + gpg --batch --verify "$SIGNATURE" "$PACKAGE_FILE" + + - name: Create the release and attach the artefacts + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + PACKAGE_FILE: ${{ steps.package.outputs.file }} + PACKAGE_NAME: ${{ steps.package.outputs.name }} + SIGNATURE: ${{ steps.package.outputs.sig }} + run: | + set -euo pipefail + api="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY" + version='${{ steps.version.outputs.version }}' + tag="v$version" + auth="Authorization: token $GITEA_TOKEN" + + release_id="$(curl -sS -H "$auth" "$api/releases/tags/$tag" | jq -r 'if type == "object" then (.id // empty) else empty end')" + if [ -z "$release_id" ]; then + body="FWS-DiskCleaner $version + + Arch package: \`$PACKAGE_NAME\` + Signature: \`$PACKAGE_NAME.sig\`, key \`fws-package-signing.asc\` + + Verify the download with: + \`\`\` + gpg --verify $PACKAGE_NAME.sig $PACKAGE_NAME + \`\`\`" + release_id="$(curl -sS --fail-with-body -X POST -H "$auth" -H 'Content-Type: application/json' \ + -d "$(jq -n --arg tag "$tag" --arg name "FWS-DiskCleaner $version" \ + --arg body "$body" '{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}')" \ + "$api/releases" | jq -r '.id')" + fi + + # A re-run must not fail on its own previous asset, so an asset with the + # same name is replaced rather than duplicated. + previous="$(curl -sS -H "$auth" "$api/releases/$release_id/assets")" + attach() { + local file="$1" name="$2" id + id="$(jq -r --arg n "$name" '.[] | select(.name == $n) | .id' <<<"$previous")" + if [ -n "$id" ]; then + curl -sS -X DELETE -H "$auth" "$api/releases/assets/$id" -o /dev/null + fi + curl -sS --fail-with-body -X POST -H "$auth" \ + -F "attachment=@$file" \ + "$api/releases/$release_id/assets?name=$name" -o /dev/null + echo "attached $name" + } + + attach "$PACKAGE_FILE" "$PACKAGE_NAME" + if [ -n "$SIGNATURE" ]; then + attach "$SIGNATURE" "$PACKAGE_NAME.sig" + attach packaging/fws-package-signing.asc fws-package-signing.asc + fi + + - name: Publish to repo.laxacube.ch + if: env.REPO_TOKEN != '' + env: + PACKAGE_FILE: ${{ steps.package.outputs.file }} + PACKAGE_NAME: ${{ steps.package.outputs.name }} + run: | + set -euo pipefail + curl -sS --fail-with-body -X POST https://repo.laxacube.ch/api/packages \ + -H "Authorization: Bearer $REPO_TOKEN" \ + -H "X-Filename: $PACKAGE_NAME" \ + -H 'Content-Type: application/octet-stream' \ + --data-binary "@$PACKAGE_FILE" + echo + + - name: Warn when the upload token is missing + if: env.REPO_TOKEN == '' + run: echo "::warning::REPO_TOKEN is not set, the package was released but not published to repo.laxacube.ch" diff --git a/.gitea/workflows/version.yml b/.gitea/workflows/version.yml new file mode 100644 index 0000000..aebe2e1 --- /dev/null +++ b/.gitea/workflows/version.yml @@ -0,0 +1,23 @@ +name: version + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +jobs: + print-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Read version file + run: | + set -euo pipefail + version="$(tr -d '[:space:]' < version)" + if [ -z "$version" ]; then + echo "::error file=version::the version file is empty" + exit 1 + fi + echo "FWS-DiskCleaner version: $version" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f906f62 --- /dev/null +++ b/.gitignore @@ -0,0 +1,198 @@ +# --------------------------------------------------------------- +# C++ / C +# --------------------------------------------------------------- +# Prerequisites +*.d + +# Compiled Object files +*.o +*.obj +*.lo +*.slo +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.so.* +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.a +*.la +*.lai +*.lib + +# Executables +*.exe +*.out +*.app +*.bin +a.out + +# Debug / profiling artifacts +*.dSYM/ +*.gcda +*.gcno +*.gcov +*.profraw +*.profdata +callgrind.out.* +perf.data* +vgcore.* +core +core.* + +# Dependency / build output directories (root-level only) +/build/ +/build-*/ +/out/ +/bin/ +/obj/ +/lib/ +/stage/ +/install/ +cmake-build-*/ +CMakeFiles/ +CMakeCache.txt +cmake_install.cmake +CTestTestfile.cmake +Makefile +compile_commands.json +.ninja_deps +.ninja_log +build.ninja + +# Package managers +conan.lock +conanbuildinfo.* +conaninfo.txt +graph_info.json +.vcpkg/ +vcpkg_installed/ +_build/ +.cache/ +CPackConfig.cmake +CPackSourceConfig.cmake + +# CMake transient files +CMakeUserPresets.json + +# --------------------------------------------------------------- +# Editors / IDEs +# --------------------------------------------------------------- +.vscode/ +.idea/ +*.iml +*.code-workspace +*.swp +*.swo +*.swn +*~ +.\#* +\#*\# +.cproject +.project +.settings/ +*.sublime-project +*.sublime-workspace +tags +tags.lock + +# --------------------------------------------------------------- +# OS +# --------------------------------------------------------------- +.DS_Store +.DS_Store? +._* +Thumbs.db +ehthumbs.db +Desktop.ini +$RECYCLE.BIN/ + +# --------------------------------------------------------------- +# Environment & secrets +# --------------------------------------------------------------- +.env +.env.* +!.env.example +!.env.template +*.pem +*.key +secrets/ +config.local.* + +# --------------------------------------------------------------- +# Test / coverage reports +# --------------------------------------------------------------- +*.gcov +coverage/ +htmlcov/ +*.lcov +TestResults/ +Testing/ + +# --------------------------------------------------------------- +# Dependencies +# --------------------------------------------------------------- +node_modules/ +vendor/ +third_party/*/build/ + +# --------------------------------------------------------------- +# Language / Python tooling (scripts, bindings) +# --------------------------------------------------------------- +__pycache__/ +*.py[cod] +.venv/ +venv/ +.python-version + +# --------------------------------------------------------------- +# AI assistants & agent tooling +# --------------------------------------------------------------- +.freebuff/ +.agents/ +.claude/ +.codex/ +.cursor/ +.cursorrules +.windsurf/ +.continue/ +.aider* +.copilot/ +.github/copilot-instructions.md +.codeium/ +.tabnine/ +.zed/ +.roo/ +.kiro/ +.trae/ +.qwen/ +.gemini/ +.openai/ +.ollama/ +.llm/ +.promptfoo/ +.cline/ +.amp/ +.mcp.json +AI_RULES.md + +# --------------------------------------------------------------- +# Logs & temp files +# --------------------------------------------------------------- +*.log +logs/ +*.tmp +*.temp +tmp/ +temp/ +*.orig +*.rej +*.bak diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..1cc2239 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,59 @@ +# AGENTS.md — Instructions pour les agents IA + +> Fichier de référence pour les agents IA (Codebuff, Cursor, Claude Code, GitHub Copilot…) qui travaillent sur un dépôt de l'organisation **FWS**. Un agent doit lire ce fichier en premier : il contient les instructions à respecter. Le `README.md` présente l'organisation et le `CONTRIBUTING.md` détaille les conventions de collaboration. + +## Contexte + +- **FWS** est une organisation open source multi-projets : chaque projet choisit librement sa stack technique (sans restriction de langage). +- Projet principal : **FWS ISO** — une distribution Linux basée sur Arch Linux, pensée pour simplifier l'installation et l'usage au quotidien. +- Conventions détaillées : `CONTRIBUTING.md` (FR) / `CONTRIBUTING.en.md` (EN). + +## Règles à respecter + +### Commits + +- Messages en **anglais**, format **Conventional Commits** : `(): `. +- Types autorisés : `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. +- Titre court et impératif ; un corps n'est ajouté que pour expliquer le **pourquoi**, pas le comment. + +### Nommage + +- Branches : `type/description` (ex. `feat/login`, `fix/typo`). +- Fichiers : **kebab-case** (ex. `my-component.ts`). +- Identifiants (variables, fonctions, classes) : **anglais**. + +### Code & commentaires + +- Commentaires en **anglais**, style « pourquoi » : pas de commentaire si le code est explicite ; documenter le non-évident (choix d'implémentation, compromis, cas limites). +- Respecter la stack technique et les conventions existantes du dépôt avant d'ajouter de nouvelles dépendances. + +### Fichiers sensibles (`.gitignore`) + +- Ne **jamais** versionner : fichiers d'environnement (`.env*`), données d'assistants de développement (`.freebuff/`), artefacts compilés (`dist/`, `build/`, `target/`, `__pycache__/`…), dépendances (`node_modules/`), secrets. +- Un `.gitignore` doit exister à la racine de chaque dépôt. + +### Tests + +- Fichiers de test : `*.test.*` ; noms de tests `describe` / `it` en anglais. +- Vérifier que les tests (et le typecheck / lint quand ils existent) passent avant de considérer une tâche terminée. + +### Issues & signalement de bugs + +- Les bugs et demandes sont suivis via les **issues** et, lorsqu'il existe, le tableau Kanban du projet. +- Une pull request qui corrige un bug référence l'issue dans son titre ou sa description (`Fixes #123`). +- Ne pas fermer ni modifier une issue sans demande explicite de l'utilisateur. + +### Commits demandés par l'utilisateur + +- Lorsque l'utilisateur demande explicitement de créer un commit, l'IA doit le faire après avoir vérifié les changements et les contrôles disponibles, sans attendre une confirmation supplémentaire. +- Le titre et le corps du commit ne doivent jamais mentionner l'IA, l'assistant, Codebuff ou l'outil utilisé. +- Ne pas ajouter l'IA comme auteur ou co-auteur dans le message du commit. + +## Bonnes pratiques pour un agent + +- Lire `AGENTS.md`, le `README.md` et le `CONTRIBUTING.md` avant d'éditer du code. +- Les commits doivent être signés. +- Faire les changements les plus petits possibles qui répondent à la demande. +- Ne pas pousser, fusionner ni publier sans demande explicite de l'utilisateur. +- Suivre les cartes du tableau Kanban lorsqu'il existe pour organiser le travail. +- En cas de doute, demander plutôt que de deviner. diff --git a/version b/version new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/version @@ -0,0 +1 @@ +0.1.0