diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..9e7e70b --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,43 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: Build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + # Restore dependencies for the main project + - name: Restore dependencies for PDNDClientAssertionGenerator + run: dotnet restore src/PDNDClientAssertionGenerator/PDNDClientAssertionGenerator.csproj + + # Restore dependencies for the test project + - name: Restore dependencies for PDNDClientAssertionGenerator.Tests + run: dotnet restore src/PDNDClientAssertionGenerator.Tests/PDNDClientAssertionGenerator.Tests.csproj + + # Build the main project + - name: Build PDNDClientAssertionGenerator + run: dotnet build src/PDNDClientAssertionGenerator/PDNDClientAssertionGenerator.csproj --no-restore --configuration Release + + # Build the test project + - name: Build PDNDClientAssertionGenerator.Tests + run: dotnet build src/PDNDClientAssertionGenerator.Tests/PDNDClientAssertionGenerator.Tests.csproj --no-restore --configuration Release + + # Run the tests + - name: Run tests + run: dotnet test src/PDNDClientAssertionGenerator.Tests/PDNDClientAssertionGenerator.Tests.csproj --no-build --verbosity normal + continue-on-error: true # Optional: allows workflow to continue even if tests fail, but mark the job as failed