Configure Gitea Actions CI/CD pipeline and workspace guidelines

This commit is contained in:
Marek Novák
2026-07-01 02:04:53 +02:00
parent 161eb7d387
commit 01308e2b5e
2 changed files with 87 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
# Nix WSL Wrapper Custom Workspace Rules & CI/CD Guidelines
These guidelines define coding rules, visual presentation checks, and CI/CD validation instructions for this repository.
---
## 1. Clean Code, SOLID & DDD Guidelines
All future modifications to the `NixWslWrapper` solution must adhere to the following standards:
* **Domain-Driven Design (DDD)**:
* Encapsulate domain invariants inside value objects. Value objects must validate input parameters upon construction (e.g. `WslTarget` validates that paths and names are non-empty).
* Domain logic must remain framework-agnostic. Do not reference infrastructure concepts (such as process handles or stream copiers) inside the `.Core` project.
* **SOLID Principles**:
* *Single Responsibility (SRP)*: Keep execution strategies, builders, stream copiers, and CLI formatting separated.
* *Open/Closed (OCP)*: If we need execution methods other than WSL (e.g. SSH, Local), implement a new strategy implementing `ICommandExecutor` rather than modifying `WslCommandExecutor`.
* *Dependency Inversion (DIP)*: Inject interfaces (`ICommandExecutor`, `IStreamCopier`) and stream abstractions (`Stream`) to facilitate seamless unit testing and mock assertions.
* **Visual UI/UX Check**:
* For CLI diagnostics, use `Spectre.Console` markup (`[color]...[/]`) to color-code output. Always escape literal brackets by doubling them (`[[literal-text]]`) to prevent parser errors.
* Render a rich dashboard with `FigletText` and `Table` grids when administrative diagnostics are run (e.g. `--wsl-status`).
---
## 2. Local Verification Commands
To compile, verify, and test the project locally, run:
```powershell
# Restore dependencies
dotnet restore
# Run the unit tests (xUnit)
dotnet test
# Build and package as a single-file executable
dotnet publish src/NixWslWrapper.Cli/NixWslWrapper.Cli.csproj -c Release -r win-x64 --self-contained -p:PublishSingleFile=true -o ./dist
```
---
## 3. Gitea CI/CD Pipeline Setup & Verification
Follow these steps to push code and verify all tests via Gitea Actions:
### Step 3.1: Gitea Repository Registration
1. Access your Gitea dashboard at [https://gitea.marek-novak.cz/](https://gitea.marek-novak.cz/).
2. Click the `+` sign in the top-right and select **New Repository**.
3. Set the repository name to `NixOS_WindowsWrapper` and create it.
### Step 3.2: Push Local Git Code
Initialize the remote link and push your repository:
```powershell
git remote add origin https://gitea.marek-novak.cz/<your-gitea-username>/NixOS_WindowsWrapper.git
git branch -M master
git push -u origin master
```
### Step 3.3: Verify CI/CD Trigger
1. Once pushed, navigate to the repository homepage in Gitea.
2. Click the **Actions** tab on the top navigation bar.
3. You should see a running workflow named **Build and Test** corresponding to the commit.
4. Click on the workflow run to verify that the steps `Restore dependencies`, `Build solution`, and `Run unit tests` complete successfully.
+25
View File
@@ -0,0 +1,25 @@
name: Build and Test
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
jobs:
build:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:8.0
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Restore dependencies
run: dotnet restore NixWslWrapper.sln
- name: Build solution
run: dotnet build NixWslWrapper.sln --configuration Release --no-restore
- name: Run unit tests
run: dotnet test NixWslWrapper.sln --configuration Release --no-build --verbosity normal