Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
38 changes: 34 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,33 @@ jobs:
with:
dotnet-version: "10.0.x"

- name: Detect backend tests
id: detect-backend-tests
shell: pwsh
run: |
$hasTests = (Get-ChildItem -Path backend -Recurse -Include *.Tests.csproj,*.UnitTests.csproj,*.IntegrationTests.csproj -ErrorAction SilentlyContinue | Select-Object -First 1) -ne $null
if (-not $hasTests) {
$hasTests = (Get-ChildItem -Path backend -Recurse -Filter *Test*.cs -ErrorAction SilentlyContinue | Select-Object -First 1) -ne $null
}
"has_tests=$($hasTests.ToString().ToLower())" >> $env:GITHUB_OUTPUT

- name: Run Backend Tests
if: steps.detect-backend-tests.outputs.has_tests == 'true'
run: task test:backend

- name: Skip backend tests (none found)
if: steps.detect-backend-tests.outputs.has_tests == 'false'
run: echo "No backend tests found. Skipping backend test steps."

- name: Upload backend test results
if: always()
if: always() && steps.detect-backend-tests.outputs.has_tests == 'true'
uses: actions/upload-artifact@v4
with:
name: backend-test-results
path: backend/TestResults/*.trx

- name: Publish backend test report
if: always()
if: always() && steps.detect-backend-tests.outputs.has_tests == 'true'
uses: dorny/test-reporter@v1
with:
name: Backend Tests
Expand Down Expand Up @@ -71,18 +86,33 @@ jobs:
cache: npm
cache-dependency-path: frontend/package-lock.json

- name: Detect frontend tests
id: detect-frontend-tests
shell: bash
run: |
if find frontend -type f \( -name "*.test.*" -o -name "*.spec.*" \) | grep -q .; then
echo "has_tests=true" >> "$GITHUB_OUTPUT"
else
echo "has_tests=false" >> "$GITHUB_OUTPUT"
fi

- name: Run Frontend Tests
if: steps.detect-frontend-tests.outputs.has_tests == 'true'
run: task test:frontend

- name: Skip frontend tests (none found)
if: steps.detect-frontend-tests.outputs.has_tests == 'false'
run: echo "No frontend tests found. Skipping frontend test steps."

- name: Upload frontend test results
if: always()
if: always() && steps.detect-frontend-tests.outputs.has_tests == 'true'
uses: actions/upload-artifact@v4
with:
name: frontend-test-results
path: frontend/test-results/junit.xml

- name: Publish frontend test report
if: always()
if: always() && steps.detect-frontend-tests.outputs.has_tests == 'true'
uses: dorny/test-reporter@v1
with:
name: Frontend Tests
Expand Down
62 changes: 44 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,29 @@ permissions:

jobs:
build:
name: Build (${{ matrix.os }})
name: Build (${{ matrix.platform }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- windows-latest
- ubuntu-latest
include:
- os: windows-latest
platform: windows-x64
rid: win-x64
target: x86_64-pc-windows-msvc
- os: ubuntu-latest
platform: linux-x64
rid: linux-x64
target: x86_64-unknown-linux-gnu
- os: macos-latest
platform: macos-aarch64
rid: osx-arm64
target: aarch64-apple-darwin
- os: macos-latest
platform: macos-x64
rid: osx-x64
target: x86_64-apple-darwin

steps:
- uses: actions/checkout@v4
Expand All @@ -40,29 +54,41 @@ jobs:
cache: npm
cache-dependency-path: frontend/package-lock.json

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf

- name: Publish backend
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
RID=win-x64
elif [[ "$RUNNER_OS" == "macOS" ]]; then
RID=osx-x64
else
RID=linux-x64
fi

dotnet publish backend/src/SlideGenerator.Presentation/SlideGenerator.Presentation.csproj \
dotnet publish backend/SlideGenerator.Ipc/SlideGenerator.Ipc.csproj \
-c Release \
-r $RID \
-r ${{ matrix.rid }} \
--self-contained false \
-o frontend/backend
-o frontend/src-tauri/resources/backend

- name: Install frontend deps
working-directory: frontend
run: npm ci

- name: Build & Publish Electron
working-directory: frontend
- name: Build & Publish Tauri
uses: tauri-apps/tauri-action@v0
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: ./frontend
tagName: v__VERSION__
releaseName: SlideGenerator v__VERSION__
releaseBody: See the assets to download and install this version.
releaseDraft: false
prerelease: false
includeUpdaterJson: false
args: --target ${{ matrix.target }}
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "backend/src/SlideGenerator.Framework"]
path = backend/src/SlideGenerator.Framework
[submodule "backend/SlideGenerator.Framework"]
path = backend/SlideGenerator.Framework
url = https://github.com/thnhmai06/SlideGenerator.Framework
28 changes: 4 additions & 24 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,9 @@
// Frontend
{
"name": "[Frontend] Main Process",
"type": "node",
"type": "node-terminal",
"request": "launch",
"cwd": "${workspaceFolder}/frontend",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"dev"
],
"windows": {
"runtimeExecutable": "npm.cmd"
},
"console": "integratedTerminal",
"command": "task dev:frontend",
"presentation": {
"hidden": true
}
Expand All @@ -33,20 +24,9 @@
// Backend
{
"name": "[Backend]",
"type": "coreclr",
"type": "node-terminal",
"request": "launch",
"program": "dotnet",
"args": [
"run",
"--project",
"${workspaceFolder}/backend/src/SlideGenerator.Presentation/SlideGenerator.Presentation.csproj"
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"stopAtEntry": false,
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
"command": "task dev:backend"
}
],
"compounds": [
Expand Down
28 changes: 28 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "task: dev",
"type": "shell",
"command": "task dev",
"isBackground": true,
"problemMatcher": []
},
{
"label": "task: dev:backend",
"type": "shell",
"command": "task dev:backend",
"isBackground": true,
"problemMatcher": []
},
{
"label": "task: dev:frontend",
"type": "shell",
"command": "task dev:frontend",
"isBackground": true,
"problemMatcher": []
},
{
"label": "task: dev:web",
"type": "shell",
"command": "task dev:web",
"isBackground": true,
"problemMatcher": []
},
{
"label": "task: test:backend",
"type": "shell",
Expand Down
11 changes: 9 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ git pull

1. **Via Visual Studio:**
- Open `SlideGenerator.sln`.
- Set `SlideGenerator.Presentation` as the startup project.
- Set `SlideGenerator.Ipc` as the startup project.
- Start Debugging (F5).

2. **Via VS Code:**
Expand All @@ -98,7 +98,7 @@ git pull
3. **Via CLI:**
```bash
cd backend
dotnet run --project src/SlideGenerator.Presentation
dotnet run --project SlideGenerator.Ipc
```

#### Frontend
Expand Down Expand Up @@ -162,6 +162,13 @@ task format

This will run `dotnet format` for the backend and `npm run format` for the frontend.

Backend coding convention (including `backend/src` and `backend/tests`):

- Prefer **one standalone top-level type per file** (`class`, `interface`, `record`, `enum`, `struct`).
- Nested composite types inside their parent type are allowed in the same file.
- Avoid adding 2+ standalone top-level types in the same `.cs` file unless there is a strong reason.
- The backend includes analyzer rule `SA1402` as a suggestion to remind this convention during development.

## Documentation

**Backend:**
Expand Down
41 changes: 32 additions & 9 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3'
vars:
RUNTIME: '{{default "win-x64" .RUNTIME}}'
BACKEND_BUILD_DIR: 'frontend/backend'
BACKEND_PROJECT: 'backend/src/SlideGenerator.Presentation/SlideGenerator.Presentation.csproj'
BACKEND_PROJECT: 'backend/SlideGenerator.Ipc/SlideGenerator.Ipc.csproj'
BACKEND_SOLUTION: 'backend/SlideGenerator.slnx'

tasks:
Expand Down Expand Up @@ -33,8 +33,33 @@ tasks:
- echo "Building Frontend..."
- npm install
- npm run build
env:
ELECTRON_BUILDER_PUBLISH: never

# ============================================================================
# RUN TASKS
# ============================================================================

dev:frontend:
desc: Run Frontend desktop app (Tauri + Vite)
dir: frontend
cmds:
- npm run dev

dev:web:
desc: Run Frontend web-only development server (Vite)
dir: frontend
cmds:
- npm run dev:web

dev:backend:
desc: Run Backend development server
cmds:
- dotnet run --project {{.BACKEND_PROJECT}}

dev:
desc: Run Backend + Frontend development servers
deps:
- dev:backend
- dev:frontend

# ============================================================================
# TEST TASKS
Expand All @@ -46,11 +71,9 @@ tasks:
- task: test:frontend

test:backend:
desc: Run Backend unit tests
desc: Backend tests removed
cmds:
- echo "Running Backend Tests..."
- dotnet restore {{.BACKEND_SOLUTION}}
- dotnet test {{.BACKEND_SOLUTION}} --no-restore --logger "trx;LogFileName=backend-tests.trx" --results-directory backend/TestResults
- echo "Backend tests removed"

test:frontend:
desc: Run Frontend unit tests
Expand Down Expand Up @@ -83,7 +106,7 @@ tasks:
clean:
desc: Clean build artifacts
cmds:
- cmd: rm -rf frontend/backend frontend/dist frontend/release backend/TestResults
- cmd: rm -rf frontend/backend frontend/dist frontend/release frontend/src-tauri/target backend/TestResults
platforms: [linux, darwin]
- cmd: Remove-Item -Recurse -Force -ErrorAction SilentlyContinue frontend/backend, frontend/dist, frontend/release, backend/TestResults
- cmd: Remove-Item -Recurse -Force -ErrorAction SilentlyContinue frontend/backend, frontend/dist, frontend/release, frontend/src-tauri/target, backend/TestResults
platforms: [windows]
18 changes: 18 additions & 0 deletions backend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*.cs]
# Prefer one standalone top-level type per file on backend.
# Nested composite types inside their parent are allowed.
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.LayoutRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.MaintainabilityRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.NamingRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.OrderingRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.ReadabilityRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.SpacingRules.severity = none
dotnet_diagnostic.SA0001.severity = none
dotnet_diagnostic.SA1402.severity = suggestion

[tests/**/*.cs]
# Apply the same standalone-type convention for backend test code.
dotnet_diagnostic.SA1402.severity = suggestion
Loading
Loading