diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..c58b8f9 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,64 @@ +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: Build USSR + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + paths-ignore: + - "**/*.md" + - "**/*.gitignore" + workflow_dispatch: + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + dotnet-version: [ '6.0.x', '7.0.x', '8.0.x'] + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET ${{ matrix.dotnet-version }} + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ matrix.dotnet-version }} + - name: .NET version + run: dotnet --version + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: | + ${{ runner.os }}-nuget + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build -c Release + - name: Test + run: dotnet test --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}" + - name: Test Report + uses: actions/upload-artifact@v3 + if: ${{ always() }} + with: + name: test-results-${{ matrix.dotnet-version }} + path: TestResults-${{ matrix.dotnet-version }} + + # uses: dorny/test-reporter@v1 + # if: success() || failure() + # with: + # artifact: test-results-${{ matrix.dotnet-version }} + # name: Test Result ${{ matrix.dotnet-version }} + # path: TestResults-${{ matrix.dotnet-version }} + # reporter: dotnet-trx + - name: Publish + run: dotnet publish -c Release -o ${{ env.DOTNET_ROOT }}/USSR-dotnet${{ matrix.dotnet-version }} + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v3 + with: + name: USSR-dotnet${{ matrix.dotnet-version }} + path: ${{ env.DOTNET_ROOT }}/USSR-dotnet${{ matrix.dotnet-version }}