From 742a5d41eee7613f43a0dc5553ebb3f785a6df43 Mon Sep 17 00:00:00 2001 From: Matt Kotsenas Date: Thu, 30 May 2024 11:29:40 -0700 Subject: [PATCH 1/2] Add global.json to enforce minimum SDK version --- global.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 global.json diff --git a/global.json b/global.json new file mode 100644 index 00000000..33a07316 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "8.0.101", + "rollForward": "latestFeature" + } +} \ No newline at end of file From 1b70eb542bfa8a7d4d5e7519cd38dd7ed6f2ba28 Mon Sep 17 00:00:00 2001 From: Matt Kotsenas Date: Thu, 30 May 2024 11:29:59 -0700 Subject: [PATCH 2/2] Add basic GitHub Actions pipelines for build / test --- .github/workflows/main.yml | 66 +++++++++++++++++++++++++++++++++++ .github/workflows/pr.yml | 14 ++++++++ .github/workflows/release.yml | 35 +++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..080834f4 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,66 @@ +name: Main build + +on: + workflow_dispatch: # Allow running the workflow manually from the GitHub UI + push: + branches: + - main + workflow_call: # Allow to be called from the release workflow + +permissions: + contents: read + actions: read + checks: write + +jobs: + build: + strategy: + matrix: + os: [windows-2022, ubuntu-22.04] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # avoid shallow clone so nbgv can do its work + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + global-json-file: ./global.json + + - name: NuGet Restore + run: dotnet restore + + - name: Build + run: dotnet build --no-restore --configuration Release /bl:./artifacts/logs/release/build.release.binlog + + - name: Test + run: dotnet test --no-build --configuration Release + + - name: Publish Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: .NET Test Report (${{ matrix.os }}) + path: "artifacts/TestResults/**/*.trx" + reporter: dotnet-trx + fail-on-error: true + fail-on-empty: true + + - name: Upload binlogs + uses: actions/upload-artifact@v4 + with: + name: binlogs-${{ matrix.os }} + path: ./artifacts/logs + if-no-files-found: error + + # TODO: Wire up building packages. Tracked by #13. + # - name: Upload packages + # uses: actions/upload-artifact@v4 + # with: + # name: packages-${{ matrix.os }} + # path: | + # ./artifacts/package + # if-no-files-found: error \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..dac01674 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,14 @@ +name: PR build + +on: + pull_request: + branches: [ "main" ] + +permissions: + contents: read + actions: read + checks: write + +jobs: + build: + uses: ./.github/workflows/main.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..139ae75f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release publish + +on: + workflow_dispatch: # Allow running the workflow manually from the GitHub UI + release: + types: + - published # Run the workflow when a new GitHub release is published + +permissions: + contents: read + actions: read + checks: write + +jobs: + build: + uses: ./.github/workflows/main.yml + + publish: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download packages + uses: actions/download-artifact@v4 + with: + path: packages + pattern: packages-windows-* + merge-multiple: true + - name: Publish NuGet package + shell: pwsh + run: | + foreach ($file in (Get-ChildItem ./packages/release -Recurse -Include *.nupkg)) { + echo "NuGet publish for file: '$file'" + # TODO: Wire to publishing packages + # dotnet nuget push $file --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate + }