Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -38,12 +38,9 @@ jobs:
dotnet format style --verify-no-changes -v:diag --exclude ~/.nuget

build:
name: build-${{ matrix.os }}
name: build-ubuntu-latest
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
Expand All @@ -58,22 +55,22 @@ 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/*/}

- 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"
Expand Down
35 changes: 30 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -37,7 +45,7 @@ jobs:
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: logs
name: logs-${{ matrix.os }}
path: '*.binlog'

- name: ✅ validate
Expand All @@ -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 }}
Expand Down
41 changes: 33 additions & 8 deletions .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/*/}

Expand All @@ -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
Expand Down
Loading