Skip to content

Commit

Permalink
Build full OS matrix, fix publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed Jun 14, 2024
1 parent 0e8f9f1 commit 2091175
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 23 deletions.
64 changes: 46 additions & 18 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 in all three supported OSes
# Pushes CI feed if secrets.SLEET_CONNECTION is provided

name: build
Expand All @@ -19,24 +19,53 @@ env:
DOTNET_NOLOGO: true
VersionPrefix: 42.42.${{ github.run_number }}
VersionLabel: ${{ github.ref }}
PackOnBuild: true
GeneratePackageOnBuild: true
GH_TOKEN: ${{ secrets.GH_TOKEN }}

defaults:
run:
shell: bash

jobs:
build:
os-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.lookup.outputs.matrix }}
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: 🔎 lookup
id: lookup
shell: pwsh
run: |
$path = './.github/workflows/os-matrix.json'
$os = if (test-path $path) { cat $path } else { '["ubuntu-latest"]' }
echo "matrix=$os" >> $env:GITHUB_OUTPUT
build:
needs: os-matrix
name: build-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ${{ fromJSON(needs.os-matrix.outputs.matrix) }}
steps:
- name: 🤘 checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
dotnet-quality: 'preview'

- name: 🙏 build
run: dotnet build -m:1
run: dotnet build -m:1 -bl:build.binlog

- name: ⚙ GNU grep
if: matrix.os == 'macOS-latest'
run: |
brew install grep
echo 'export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"' >> .bash_profile
- name: ⚙ azurite
run: |
Expand All @@ -46,8 +75,12 @@ jobs:
- name: 🧪 test
uses: ./.github/workflows/test

- name: 📦 pack
run: dotnet pack -m:1
- name: 🐛 logs
uses: actions/upload-artifact@v3
if: runner.debug && always()
with:
name: logs
path: '*.binlog'

# Only push CI package to sleet feed if building on ubuntu (fastest)
- name: 🚀 sleet
Expand All @@ -62,17 +95,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
dotnet-quality: 'preview'

- name: ✓ ensure format
run: |
dotnet format whitespace --verify-no-changes -v:diag --exclude ~/.nuget
dotnet format style --verify-no-changes -v:diag --exclude ~/.nuget
dotnet format style --verify-no-changes -v:diag --exclude ~/.nuget
1 change: 1 addition & 0 deletions .github/workflows/os-matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["ubuntu-latest", "windows-latest", "macOS-latest"]
9 changes: 7 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Builds a final release version and pushes to nuget.org
# Builds a final release version and pushes to nuget.org
# whenever a release is published.
# Requires: secrets.NUGET_API_KEY

Expand Down Expand Up @@ -27,6 +27,11 @@ jobs:
- name: 🙏 build
run: dotnet build -m:1 -p:version=${GITHUB_REF#refs/*/v} -bl:build.binlog

- name: ⚙ azurite
run: |
npm install [email protected]
npx azurite &
- name: 🧪 test
uses: ./.github/workflows/test

Expand All @@ -38,4 +43,4 @@ jobs:
path: '*.binlog'

- name: 🚀 nuget
run: dotnet nuget push ./bin/**/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate
run: dotnet nuget push ./bin/**/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate
4 changes: 1 addition & 3 deletions .netconfig
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@
weak
[file ".github/workflows/publish.yml"]
url = https://github.com/devlooped/oss/blob/main/.github/workflows/publish.yml
sha = 5fb172362c767bef7c36478f1a6bdc264723f8f9
etag = 9ea4083894308a610742488923d2a44778ebba6ca73fb13424647d9a82c918b4
weak
skip
[file ".github/workflows/sponsor.yml"]
url = https://github.com/devlooped/oss/blob/main/.github/workflows/sponsor.yml
sha = 5fb172362c767bef7c36478f1a6bdc264723f8f9
Expand Down

0 comments on commit 2091175

Please sign in to comment.