mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 16:46:08 +02:00
99 lines
3.1 KiB
YAML
99 lines
3.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master, dev]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
lint-markdown:
|
|
name: Markdown Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Run markdownlint
|
|
run: bash scripts/lint-markdown.sh
|
|
|
|
format-check:
|
|
name: Format Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
# TEMPORARY: Terminal.Gui submodule's nuget.config breaks restore — remove until PR #4234 is merged
|
|
- name: Remove submodule NuGet config
|
|
run: rm -f src/Terminal.Gui/nuget.config
|
|
|
|
- name: Setup .NET 10
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '10.0.x'
|
|
|
|
- name: Check formatting
|
|
run: dotnet format src/EchoHub.slnx --verify-no-changes --verbosity diagnostic --exclude src/Terminal.Gui/
|
|
|
|
build-and-test:
|
|
name: Build & Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
# TEMPORARY: Terminal.Gui submodule's nuget.config breaks restore — remove until PR #4234 is merged
|
|
- name: Remove submodule NuGet config
|
|
run: rm -f src/Terminal.Gui/nuget.config
|
|
|
|
- name: Check for src/ changes
|
|
id: changes
|
|
env:
|
|
EVENT: ${{ github.event_name }}
|
|
BEFORE: ${{ github.event.before }}
|
|
BASE_REF: ${{ github.base_ref }}
|
|
run: |
|
|
if [ "$EVENT" = "pull_request" ]; then
|
|
git fetch origin "$BASE_REF" --depth=1
|
|
CHANGED=$(git diff --name-only "origin/$BASE_REF"...HEAD -- 'src/' | wc -l)
|
|
elif [ -z "$BEFORE" ] || [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then
|
|
CHANGED=1
|
|
else
|
|
CHANGED=$(git diff --name-only "$BEFORE" HEAD -- 'src/' | wc -l)
|
|
fi
|
|
[ "$CHANGED" -gt 0 ] && echo "src_changed=true" >> "$GITHUB_OUTPUT" || echo "src_changed=false" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Setup .NET 10
|
|
if: steps.changes.outputs.src_changed == 'true'
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '10.0.x'
|
|
|
|
- name: Cache NuGet packages
|
|
if: steps.changes.outputs.src_changed == 'true'
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.nuget/packages
|
|
key: nuget-${{ runner.os }}-${{ hashFiles('src/**/*.csproj') }}
|
|
restore-keys: nuget-${{ runner.os }}-
|
|
|
|
- name: Restore dependencies
|
|
if: steps.changes.outputs.src_changed == 'true'
|
|
run: dotnet restore src/EchoHub.slnx
|
|
|
|
- name: Build
|
|
if: steps.changes.outputs.src_changed == 'true'
|
|
run: dotnet build src/EchoHub.slnx --no-restore --configuration Release
|
|
|
|
- name: Test
|
|
if: steps.changes.outputs.src_changed == 'true'
|
|
run: dotnet test src/EchoHub.slnx --no-build --configuration Release --verbosity normal
|
|
|
|
- name: Skip notice
|
|
if: steps.changes.outputs.src_changed == 'false'
|
|
run: echo "No changes in src/ — skipping build and test"
|