name: CI on: push: branches: - main tags: - "v*" pull_request: branches: - main jobs: build: runs-on: windows steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 1 - name: Setup .NET 8 SDK uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - name: Cache NuGet packages uses: actions/cache@v4 continue-on-error: true with: path: ~/.nuget/packages key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '.config/dotnet-tools.json') }} restore-keys: | nuget-${{ runner.os }}- - name: Restore tools run: dotnet tool restore - name: Restore run: dotnet restore src/RgbLedStripController/RgbLedStripController.csproj --configfile NuGet.Config - name: Build (Release) run: dotnet build src/RgbLedStripController/RgbLedStripController.csproj -c Release --no-restore test: runs-on: windows steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 1 - name: Setup .NET 8 SDK uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - name: Cache NuGet packages uses: actions/cache@v4 continue-on-error: true with: path: ~/.nuget/packages key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '.config/dotnet-tools.json') }} restore-keys: | nuget-${{ runner.os }}- - name: Run tests (if any test projects exist) shell: pwsh run: | $ErrorActionPreference = "Stop" $tests = @(Get-ChildItem -Recurse -Filter "*Tests.csproj" | Where-Object { $_.FullName -notlike "*\obj\*" -and $_.FullName -notlike "*\bin\*" }) if ($tests.Count -eq 0) { Write-Host "No test projects found yet; skipping dotnet test." exit 0 } foreach ($t in $tests) { dotnet test $t.FullName -c Release if ($LASTEXITCODE -ne 0) { throw "dotnet test failed for $($t.FullName)" } } release: needs: - build - test if: startsWith(gitea.ref, 'refs/tags/v') runs-on: windows steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 1 - name: Setup .NET 8 SDK uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - name: Cache NuGet packages uses: actions/cache@v4 continue-on-error: true with: path: ~/.nuget/packages key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '.config/dotnet-tools.json') }} restore-keys: | nuget-${{ runner.os }}- - name: Restore tools run: dotnet tool restore - name: Package (Velopack, unsigned) shell: pwsh run: | powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/release/package-velopack.ps1 -SkipSigning - name: Upload to Gitea Releases shell: pwsh env: VPK_TOKEN: ${{ secrets.VPK_TOKEN }} run: | powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/release/upload-feed.ps1 -ExpectedTag ${{ gitea.ref_name }}