Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# CI/CD Documentation

## Overview

This repository uses GitHub Actions for continuous integration with a two-job structure:

1. **package** - Quality checks and NuGet package creation
2. **samples** - Cross-platform testing and AOT sample binaries

## Jobs

### package (Linux only)

Runs on Ubuntu and produces the main NuGet package artifact.

| Step | Description |
|------|-------------|
| format | Code style validation (`dotnet format --verify-no-changes`) |
| inspect | Static analysis (JetBrains InspectCode) |
| build | Compile solution |
| test | Run unit tests |
| pack | Create NuGet package |

**Artifact:** `Wiry.Tui.{version}.nupkg`

### samples (matrix: 1-4 OS)

Runs after `package` job. Verifies tests on multiple platforms and builds AOT sample binaries.

| Context | Platforms |
|---------|-----------|
| Feature branches | Linux only |
| main / PR to main / tags | Linux, Windows, macOS x64, macOS ARM64 |

| Step | Description |
|------|-------------|
| build | Compile solution |
| test | Run unit tests (cross-platform verification) |
| publish | AOT publish sample applications |

**Artifacts:** `samples-{rid}.zip` for each platform

## Scripts

All scripts are in the `scripts/` directory:

| Script | Purpose | Used in CI |
|--------|---------|------------|
| `build.sh` | Restore and build solution | Yes |
| `test.sh` | Run tests | Yes |
| `pack.sh` | Create NuGet package | Yes |
| `format.sh` | Check code formatting | Yes |
| `inspect.sh` | Run JetBrains InspectCode | Local only* |
| `publish-samples.sh` | AOT publish samples for RID | Yes |

*CI uses the JetBrains GitHub Action instead of the script.

## Local Development

Run the same checks locally:

```bash
# Format check
./scripts/format.sh

# Build and test
./scripts/build.sh
./scripts/test.sh

# Create package
./scripts/pack.sh

# Static analysis (requires JetBrains tools)
dotnet tool install -g JetBrains.ReSharper.GlobalTools
./scripts/inspect.sh

# Publish samples for current platform
./scripts/publish-samples.sh
```

## Artifacts

| Artifact | Source | When |
|----------|--------|------|
| `nuget-package` | package job | Always |
| `samples-linux-x64` | samples job | Always |
| `samples-win-x64` | samples job | main/PR/tags |
| `samples-osx-x64` | samples job | main/PR/tags |
| `samples-osx-arm64` | samples job | main/PR/tags |
113 changes: 113 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: CI

on:
push:
branches: [main, feature/*, fix/*]
tags: ['v*']
pull_request:
branches: [main]

jobs:
# =============================================================================
# Package Job: Quality checks + NuGet package
# Runs on Linux only (IL is platform-independent)
# =============================================================================
package:
name: Package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
10.0.x

- name: Check formatting
shell: bash
run: ./scripts/format.sh

- name: Run InspectCode
uses: JetBrains/ReSharper-InspectCode@v0.11
with:
solution: Wiry.Tui.sln
tool-version: 2025.3.0.3

- name: Build
shell: bash
run: ./scripts/build.sh

- name: Test
shell: bash
run: ./scripts/test.sh

- name: Pack
shell: bash
run: ./scripts/pack.sh

- name: Upload NuGet package
uses: actions/upload-artifact@v4
with:
name: nuget-package
path: ./artifacts/packages/*.nupkg

# =============================================================================
# Samples Job: Cross-platform tests + AOT binaries
# Matrix: 1 OS for feature branches, 4 OS for main/PR/tags
# =============================================================================
prepare-matrix:
name: Prepare matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set.outputs.matrix }}
steps:
- name: Set matrix based on context
id: set
shell: bash
run: |
if [[ "$GITHUB_REF" == "refs/heads/main" ]] || \
[[ "$GITHUB_REF" == refs/tags/* ]] || \
[[ "$GITHUB_EVENT_NAME" == "pull_request" && "$GITHUB_BASE_REF" == "main" ]]; then
echo "[OK] Full matrix: Linux, Windows, macOS x64, macOS ARM64"
echo 'matrix={"include":[{"name":"Linux x64","os":"ubuntu-latest","rid":"linux-x64"},{"name":"Windows x64","os":"windows-latest","rid":"win-x64"},{"name":"macOS x64","os":"macos-13","rid":"osx-x64"},{"name":"macOS ARM64","os":"macos-latest","rid":"osx-arm64"}]}' >> "$GITHUB_OUTPUT"
else
echo "[OK] Linux-only matrix (feature branch)"
echo 'matrix={"include":[{"name":"Linux x64","os":"ubuntu-latest","rid":"linux-x64"}]}' >> "$GITHUB_OUTPUT"
fi

samples:
name: Samples (${{ matrix.name }})
runs-on: ${{ matrix.os }}
needs: [package, prepare-matrix]
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x

- name: Build
shell: bash
run: ./scripts/build.sh

- name: Test
shell: bash
run: ./scripts/test.sh

- name: Publish samples (AOT)
shell: bash
run: ./scripts/publish-samples.sh ${{ matrix.rid }}

- name: Upload samples
uses: actions/upload-artifact@v4
with:
name: samples-${{ matrix.rid }}
path: ./artifacts/samples/${{ matrix.rid }}/*
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Build results
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
artifacts/

# .NET
*.nupkg
*.snupkg
project.lock.json

# Visual Studio
.vs/
*.user
*.suo
*.userosscache
*.sln.docstates

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# JetBrains Rider
.idea/
*.sln.iml

# ReSharper
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JetBrains InspectCode reports
*.sarif.json
inspectcode-report.*

# Test results
[Tt]est[Rr]esult*/
*.trx
coverage*.json
coverage*.xml
coverage*.info
*.coverage
*.coveragexml

# MSBuild
*.binlog

# Mono
mono_crash.*

# macOS
.DS_Store
._*

# Windows
Thumbs.db
[Dd]esktop.ini

# Vim
*.swp

# dotenv
.env
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Dmitry Razumikhin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
73 changes: 73 additions & 0 deletions Wiry.Tui.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wiry.Tui", "src\Wiry.Tui\Wiry.Tui.csproj", "{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0AB3BF05-4346-4AA6-1389-037BE0695223}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wiry.Tui.Tests", "tests\Wiry.Tui.Tests\Wiry.Tui.Tests.csproj", "{D9780FC8-7106-473D-9F4B-67776EF61177}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{5D20AA90-6969-D8BD-9DCD-8634F4692FDA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wiry.Tui.Samples.BasicUsage", "samples\Wiry.Tui.Samples.BasicUsage\Wiry.Tui.Samples.BasicUsage.csproj", "{0654838D-8339-45D1-9EF0-676138ABD4C1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}.Debug|x64.ActiveCfg = Debug|Any CPU
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}.Debug|x64.Build.0 = Debug|Any CPU
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}.Debug|x86.ActiveCfg = Debug|Any CPU
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}.Debug|x86.Build.0 = Debug|Any CPU
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}.Release|Any CPU.Build.0 = Release|Any CPU
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}.Release|x64.ActiveCfg = Release|Any CPU
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}.Release|x64.Build.0 = Release|Any CPU
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}.Release|x86.ActiveCfg = Release|Any CPU
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65}.Release|x86.Build.0 = Release|Any CPU
{D9780FC8-7106-473D-9F4B-67776EF61177}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9780FC8-7106-473D-9F4B-67776EF61177}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9780FC8-7106-473D-9F4B-67776EF61177}.Debug|x64.ActiveCfg = Debug|Any CPU
{D9780FC8-7106-473D-9F4B-67776EF61177}.Debug|x64.Build.0 = Debug|Any CPU
{D9780FC8-7106-473D-9F4B-67776EF61177}.Debug|x86.ActiveCfg = Debug|Any CPU
{D9780FC8-7106-473D-9F4B-67776EF61177}.Debug|x86.Build.0 = Debug|Any CPU
{D9780FC8-7106-473D-9F4B-67776EF61177}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9780FC8-7106-473D-9F4B-67776EF61177}.Release|Any CPU.Build.0 = Release|Any CPU
{D9780FC8-7106-473D-9F4B-67776EF61177}.Release|x64.ActiveCfg = Release|Any CPU
{D9780FC8-7106-473D-9F4B-67776EF61177}.Release|x64.Build.0 = Release|Any CPU
{D9780FC8-7106-473D-9F4B-67776EF61177}.Release|x86.ActiveCfg = Release|Any CPU
{D9780FC8-7106-473D-9F4B-67776EF61177}.Release|x86.Build.0 = Release|Any CPU
{0654838D-8339-45D1-9EF0-676138ABD4C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0654838D-8339-45D1-9EF0-676138ABD4C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0654838D-8339-45D1-9EF0-676138ABD4C1}.Debug|x64.ActiveCfg = Debug|Any CPU
{0654838D-8339-45D1-9EF0-676138ABD4C1}.Debug|x64.Build.0 = Debug|Any CPU
{0654838D-8339-45D1-9EF0-676138ABD4C1}.Debug|x86.ActiveCfg = Debug|Any CPU
{0654838D-8339-45D1-9EF0-676138ABD4C1}.Debug|x86.Build.0 = Debug|Any CPU
{0654838D-8339-45D1-9EF0-676138ABD4C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0654838D-8339-45D1-9EF0-676138ABD4C1}.Release|Any CPU.Build.0 = Release|Any CPU
{0654838D-8339-45D1-9EF0-676138ABD4C1}.Release|x64.ActiveCfg = Release|Any CPU
{0654838D-8339-45D1-9EF0-676138ABD4C1}.Release|x64.Build.0 = Release|Any CPU
{0654838D-8339-45D1-9EF0-676138ABD4C1}.Release|x86.ActiveCfg = Release|Any CPU
{0654838D-8339-45D1-9EF0-676138ABD4C1}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{BC969CC0-822B-430A-9DCC-3E8BCF2AEE65} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{D9780FC8-7106-473D-9F4B-67776EF61177} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{0654838D-8339-45D1-9EF0-676138ABD4C1} = {5D20AA90-6969-D8BD-9DCD-8634F4692FDA}
EndGlobalSection
EndGlobal
3 changes: 3 additions & 0 deletions samples/Wiry.Tui.Samples.BasicUsage/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Basic usage sample for Wiry.Tui

Console.WriteLine("Wiry.Tui BasicUsage Sample");
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<PublishAot>true</PublishAot>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Wiry.Tui\Wiry.Tui.csproj" />
</ItemGroup>

</Project>
10 changes: 10 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

echo "=== Building Wiry.Tui ==="
cd "$(dirname "$0")/.."

dotnet restore
dotnet build --no-restore --configuration Release

echo "[OK] Build completed"
Loading
Loading