From b1c8625df1a90864b18a882bca0cf77a70a30cc1 Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Sat, 3 Oct 2026 16:39:24 -0300 Subject: [PATCH 1/2] Run the OS build matrix only for publish and release --- .github/workflows/build.yml | 17 +++++----- .github/workflows/publish.yml | 35 ++++++++++++++++++--- .github/workflows/release-artifacts.yml | 41 ++++++++++++++++++++----- 3 files changed, 70 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac2d3add..6fd68906 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -๏ปฟ# Builds and runs tests in all three supported OSes +๏ปฟ# Builds and runs tests on Ubuntu. The full OS matrix runs in publish and release. # Pushes CI feed if secrets.SLEET_CONNECTION is provided name: build @@ -38,12 +38,9 @@ jobs: dotnet format style --verify-no-changes -v:diag --exclude ~/.nuget build: - name: build-${{ matrix.os }} + name: build needs: dotnet-format - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] + runs-on: ubuntu-latest steps: - name: ๐Ÿค˜ checkout uses: actions/checkout@v4 @@ -58,7 +55,7 @@ jobs: run: dotnet build -m:1 -bl:build.binlog -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER" -p:RepositoryBranch=${GITHUB_REF#refs/*/} - name: ๐Ÿงช test - run: dotnet test --no-build -m:1 --blame-hang --blame-hang-timeout 5m -d $GITHUB_WORKSPACE/logs/${{ matrix.os }}.txt --results-directory $GITHUB_WORKSPACE/logs + run: dotnet test --no-build -m:1 --blame-hang --blame-hang-timeout 5m -d $GITHUB_WORKSPACE/logs/ubuntu-latest.txt --results-directory $GITHUB_WORKSPACE/logs - name: ๐Ÿ“ฆ pack run: dotnet pack -m:1 -bl:pack.binlog -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER" -p:RepositoryBranch=${GITHUB_REF#refs/*/} @@ -66,14 +63,14 @@ jobs: - name: ๐Ÿ”ผ packages uses: actions/upload-artifact@v4 with: - name: bin-${{ matrix.os }} + name: bin-ubuntu-latest path: bin/*.nupkg - # Only push CI package to sleet feed if building on ubuntu (fastest) + # Push the CI package to the sleet feed when a connection is configured - name: ๐Ÿš€ sleet env: SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }} - if: matrix.os == 'ubuntu-latest' && env.SLEET_CONNECTION != '' + if: env.SLEET_CONNECTION != '' run: | dotnet tool update sleet -g --allow-downgrade --version $(curl -s --compressed ${{ vars.SLEET_FEED_URL }} | jq '.["sleet:version"]' -r) sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure" || echo "No packages found" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 76a34a10..4411d13c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,5 +1,5 @@ -๏ปฟ# Builds a final release version and pushes to nuget.org -# whenever a release is published. +๏ปฟ# Builds a final release version on every supported OS and pushes to nuget.org +# whenever a release is published. Packages are pushed only after the whole matrix passes. # Requires: secrets.NUGET_API_KEY name: publish @@ -11,9 +11,17 @@ env: DOTNET_NOLOGO: true Configuration: Release +defaults: + run: + shell: bash + jobs: - publish: - runs-on: ubuntu-latest + build: + name: build-${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] steps: - name: ๐Ÿค˜ checkout uses: actions/checkout@v4 @@ -37,7 +45,7 @@ jobs: if: ${{ always() }} uses: actions/upload-artifact@v4 with: - name: logs + name: logs-${{ matrix.os }} path: '*.binlog' - name: โœ… validate @@ -50,6 +58,23 @@ jobs: exit 1 } + - name: ๐Ÿ”ผ packages + if: matrix.os == 'ubuntu-latest' + uses: actions/upload-artifact@v4 + with: + name: bin-ubuntu-latest + path: bin/*.nupkg + + publish: + needs: build + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ”ฝ packages + uses: actions/download-artifact@v4 + with: + name: bin-ubuntu-latest + path: bin + - name: ๐Ÿš€ nuget env: NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} diff --git a/.github/workflows/release-artifacts.yml b/.github/workflows/release-artifacts.yml index c7adff29..e06cd516 100644 --- a/.github/workflows/release-artifacts.yml +++ b/.github/workflows/release-artifacts.yml @@ -1,14 +1,22 @@ -# Builds a release version of the project and uploads -# as artifacts of the release for verification/history +# Builds a release version on every supported OS and uploads the packages +# as artifacts of the release for verification/history. Upload waits for the whole matrix. name: release-artifacts on: release: types: [published] +defaults: + run: + shell: bash + jobs: - release-artifacts: - runs-on: ubuntu-latest + build: + name: build-${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] steps: - name: ๐Ÿค˜ checkout uses: actions/checkout@v4 @@ -19,9 +27,6 @@ jobs: - name: โš™ dotnet uses: devlooped/actions-dotnet-env@v1 - - name: ๐Ÿท current - run: echo "CURRENT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: ๐Ÿ™ build run: dotnet build -m:1 -bl:build.binlog -p:version=${GITHUB_REF#refs/*/v} -p:RepositoryBranch=${GITHUB_REF#refs/*/} @@ -35,9 +40,29 @@ jobs: if: ${{ always() }} uses: actions/upload-artifact@v4 with: - name: logs + name: logs-${{ matrix.os }} path: '**/*.binlog' + - name: ๐Ÿ”ผ packages + if: matrix.os == 'ubuntu-latest' + uses: actions/upload-artifact@v4 + with: + name: bin-ubuntu-latest + path: bin/*.nupkg + + release-artifacts: + needs: build + runs-on: ubuntu-latest + steps: + - name: ๐Ÿท current + run: echo "CURRENT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: ๐Ÿ”ฝ packages + uses: actions/download-artifact@v4 + with: + name: bin-ubuntu-latest + path: bin + - name: ๐Ÿ”ฝ gh run: | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 From cd9507432ba91b5a940928a09431006efedca253 Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Sat, 3 Oct 2026 16:52:27 -0300 Subject: [PATCH 2/2] fix: keep the required build-ubuntu-latest check name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6fd68906..81339123 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: dotnet format style --verify-no-changes -v:diag --exclude ~/.nuget build: - name: build + name: build-ubuntu-latest needs: dotnet-format runs-on: ubuntu-latest steps: