diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..15625dc --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,71 @@ +name: CI Build & Test + +on: + push: + branches: [main, cleanup/wrappers-pass2] + pull_request: + branches: [main] + +jobs: + build-and-test: + name: Build & Test (Windows) + runs-on: [self-hosted, windows] + timeout-minutes: 30 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup .NET Framework + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '4.8.x' + + - name: Restore dependencies + run: dotnet restore NT8-SDK.sln + + - name: Build solution + run: dotnet build NT8-SDK.sln --configuration Release --no-restore + + - name: Run tests + run: dotnet test NT8-SDK.sln --configuration Release --no-build --logger trx + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-results + path: '**/*.trx' + + - name: Upload build logs on failure + if: failure() + uses: actions/upload-artifact@v4 + with: + name: build-logs + path: '**/*.log' + + build-and-test-linux: + name: Build & Test (Linux/mono) + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install mono + run: | + sudo apt-get update + sudo apt-get install -y mono-complete nuget + + - name: Restore dependencies + run: nuget restore NT8-SDK.sln + + - name: Build with mono + run: msbuild NT8-SDK.sln /p:Configuration=Release /p:TargetFrameworkVersion=v4.8 + + - name: Run tests with mono + run: | + mono packages/NUnit.ConsoleRunner.3.16.3/tools/nunit3-console.exe tests/NT8.Core.Tests/bin/Release/net48/NT8.Core.Tests.dll + mono packages/NUnit.ConsoleRunner.3.16.3/tools/nunit3-console.exe tests/NT8.Integration.Tests/bin/Release/net48/NT8.Integration.Tests.dll + mono packages/NUnit.ConsoleRunner.3.16.3/tools/nunit3-console.exe tests/NT8.Performance.Tests/bin/Release/net48/NT8.Performance.Tests.dll \ No newline at end of file diff --git a/README.md b/README.md index 9cc1ca0..65380e1 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Quick reference docs in repo root: **Status:** Phase 2 Complete **Framework:** .NET Framework 4.8 / C# 5.0 **Platform:** NinjaTrader 8 +**CI:** ![Gitea CI](https://gitea.com/your-org/nt8-sdk/actions/workflows/ci.yml/badge.svg) --- diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh new file mode 100644 index 0000000..70f69ce --- /dev/null +++ b/scripts/ci_build.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# CI build wrapper for Linux runners (mono/.NET Framework via mono) +# This calls verify-build.bat logic adapted for Linux/mono + +set -e + +echo "=== NT8 SDK Linux CI Build ===" + +# Check for mono +if ! command -v mono &> /dev/null; then + echo "Installing mono..." + sudo apt-get update && sudo apt-get install -y mono-complete nuget +fi + +# Check for msbuild +if ! command -v msbuild &> /dev/null; then + echo "msbuild not found in PATH, trying /usr/lib/mono/msbuild/Current/bin/msbuild" + export PATH="/usr/lib/mono/msbuild/Current/bin:$PATH" +fi + +echo "Restoring NuGet packages..." +nuget restore NT8-SDK.sln + +echo "Building solution..." +msbuild NT8-SDK.sln /p:Configuration=Release /p:TargetFrameworkVersion=v4.8 /verbosity:minimal + +echo "Running tests..." +# Find nunit console runner +NUNIT_CONSOLE=$(find packages -name "nunit3-console.exe" | head -1) +if [ -z "$NUNIT_CONSOLE" ]; then + echo "NUnit console runner not found, installing..." + nuget install NUnit.ConsoleRunner -Version 3.16.3 -OutputDirectory packages + NUNIT_CONSOLE=$(find packages -name "nunit3-console.exe" | head -1) +fi + +echo "Using NUnit console: $NUNIT_CONSOLE" + +# Run each test assembly +for test_dll in tests/NT8.Core.Tests/bin/Release/net48/NT8.Core.Tests.dll \ + tests/NT8.Integration.Tests/bin/Release/net48/NT8.Integration.Tests.dll \ + tests/NT8.Performance.Tests/bin/Release/net48/NT8.Performance.Tests.dll; do + if [ -f "$test_dll" ]; then + echo "Running tests in $test_dll" + mono "$NUNIT_CONSOLE" "$test_dll" --result=TestResult.xml + else + echo "Warning: $test_dll not found" + fi +done + +echo "=== CI Build Complete ===" \ No newline at end of file