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
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ updates:
Spectre:
patterns:
- "Spectre.Console*"
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
85 changes: 60 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Builds and runs tests on Ubuntu. The full OS matrix runs in publish and release.
# 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
on:
on:
workflow_dispatch:
push:
branches: [ main, dev, 'feature/*', 'rel/*' ]
Expand All @@ -12,6 +12,9 @@ on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read

env:
DOTNET_NOLOGO: true

Expand All @@ -24,13 +27,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v4
with:
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
submodules: recursive
fetch-depth: 0

- name: ⚙ dotnet
uses: devlooped/actions-dotnet-env@v1
uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1

- name: ✓ ensure format
run: |
Expand All @@ -43,13 +46,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v4
with:
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
submodules: recursive
fetch-depth: 0

- name: ⚙ dotnet
uses: devlooped/actions-dotnet-env@v1
uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1

- name: 🙏 build
run: dotnet build -m:1 -bl:build.binlog -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER" -p:RepositoryBranch=${GITHUB_REF#refs/*/}
Expand All @@ -61,57 +64,68 @@ jobs:
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
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: bin-ubuntu-latest
path: bin/*.nupkg

# Push the CI package to the sleet feed when a connection is configured
- name: 🚀 sleet
env:
SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }}
SLEET_FEED_URL: ${{ vars.SLEET_FEED_URL }}
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"
dotnet tool update sleet -g --allow-downgrade --version $(curl -s --compressed "$SLEET_FEED_URL" | jq '.["sleet:version"]' -r)
sleet push bin --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=$SLEET_CONNECTION" -p "SLEET_FEED_TYPE=azure" || echo "No packages found"

native-aot:
name: native-aot-${{ matrix.framework }}
runs-on: ubuntu-latest
name: ${{ matrix.prefix }}-${{ matrix.framework }}
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
framework: [net8.0, net10.0]
include:
- os: ubuntu-latest
prefix: native-aot
rid: linux-x64
exe: CompiledAot
- os: windows-latest
prefix: native-aot-windows
rid: win-x64
exe: CompiledAot.exe
steps:
- name: checkout
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
submodules: recursive
- name: dotnet
uses: devlooped/actions-dotnet-env@v1
uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1
- name: packages
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: bin-ubuntu-latest
path: bin
- name: publish and execute
run: |
dotnet publish src/Acceptance/CompiledAot/CompiledAot.csproj -c Release -f ${{ matrix.framework }} -r linux-x64 -p:UseSharedCompilation=false -warnaserror -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
src/Acceptance/CompiledAot/bin/Release/${{ matrix.framework }}/linux-x64/publish/CompiledAot
dotnet publish src/Acceptance/CompiledAot/CompiledAot.csproj -c Release -f ${{ matrix.framework }} -r ${{ matrix.rid }} -p:UseSharedCompilation=false -warnaserror -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
src/Acceptance/CompiledAot/bin/Release/${{ matrix.framework }}/${{ matrix.rid }}/publish/${{ matrix.exe }}

acceptance:
name: acceptance
runs-on: ubuntu-latest
needs: build
steps:
- name: 🤘 checkout
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: ⚙ dotnet
uses: devlooped/actions-dotnet-env@v1
uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1

- name: 🔽 packages
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: bin-ubuntu-latest
path: bin
Expand All @@ -124,6 +138,27 @@ jobs:
run: dotnet test Acceptance.slnx -f net10.0 -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
working-directory: src/Acceptance

samples:
name: samples
runs-on: ubuntu-latest
needs: build
steps:
- name: 🤘 checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: ⚙ dotnet
uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1

- name: 🔽 packages
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: bin-ubuntu-latest
path: bin

- name: 🧪 test
run: dotnet test Samples.slnx -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
working-directory: samples

# The compilers that run on .NET Framework load analyzers from the analyzer references alone.
# They come with Visual Studio, which the Windows image has.
framework-compiler:
Expand All @@ -132,13 +167,13 @@ jobs:
needs: build
steps:
- name: 🤘 checkout
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: ⚙ dotnet
uses: devlooped/actions-dotnet-env@v1
uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1

- name: 🔽 packages
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: bin-ubuntu-latest
path: bin
Expand Down
85 changes: 74 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# 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.
# 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,
# native-aot, and acceptance checks pass.
# Requires: vars.NUGET_OIDC (or secrets.NUGET_OIDC) and a nuget.org trusted publishing policy

name: publish
on:
release:
types: [prereleased, released]

permissions:
contents: read

env:
DOTNET_NOLOGO: true
Configuration: Release
Expand All @@ -24,13 +28,13 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: 🤘 checkout
uses: actions/checkout@v4
with:
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
submodules: recursive
fetch-depth: 0

- name: ⚙ dotnet
uses: devlooped/actions-dotnet-env@v1
uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1

- name: 🙏 build
run: dotnet build -m:1 -bl:build.binlog -p:version=${GITHUB_REF#refs/*/v} -p:RepositoryBranch=${GITHUB_REF#refs/*/}
Expand All @@ -43,7 +47,7 @@ jobs:

- name: 🔼 logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: logs-${{ matrix.os }}
path: '*.binlog'
Expand All @@ -60,11 +64,68 @@ jobs:

- name: 🔼 packages
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: bin-ubuntu-latest
path: bin/*.nupkg

native-aot:
name: native-aot-${{ matrix.os }}-${{ matrix.framework }}
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
framework: [net8.0, net10.0]
include:
- os: ubuntu-latest
rid: linux-x64
exe: CompiledAot
- os: windows-latest
rid: win-x64
exe: CompiledAot.exe
steps:
- name: checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
submodules: recursive
- name: dotnet
uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1
- name: packages
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: bin-ubuntu-latest
path: bin
- name: publish and execute
run: |
dotnet publish src/Acceptance/CompiledAot/CompiledAot.csproj -c Release -f ${{ matrix.framework }} -r ${{ matrix.rid }} -p:UseSharedCompilation=false -warnaserror -p:version=${GITHUB_REF#refs/*/v}
src/Acceptance/CompiledAot/bin/Release/${{ matrix.framework }}/${{ matrix.rid }}/publish/${{ matrix.exe }}

acceptance:
name: acceptance
runs-on: ubuntu-latest
needs: build
steps:
- name: 🤘 checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: ⚙ dotnet
uses: devlooped/actions-dotnet-env@4c319f75df2949bfe5906e7b080941fe61756cf0 # v1

- name: 🔽 packages
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: bin-ubuntu-latest
path: bin

- name: 🏗 generate comparison stunts
run: dotnet run --file GenerateReferenceStunts.cs
working-directory: src/Acceptance

- name: 🧪 test
run: dotnet test Acceptance.slnx -f net10.0 -p:version=${GITHUB_REF#refs/*/v}
working-directory: src/Acceptance

# Pushes with nuget.org Trusted Publishing (GitHub Actions OIDC), no long-lived API key.
# Only this job may request an OIDC token. The nuget.org policy, created by the
# NuGet/login user (vars.NUGET_OIDC, or secrets.NUGET_OIDC when the variable is empty),
Expand All @@ -80,7 +141,7 @@ jobs:
# https://learn.microsoft.com/nuget/nuget-org/trusted-publishing
# https://github.com/NuGet/login
publish:
needs: build
needs: [build, native-aot, acceptance]
if: github.event.action != 'prereleased'
runs-on: ubuntu-latest
environment: nuget
Expand All @@ -89,16 +150,18 @@ jobs:
id-token: write
steps:
- name: 🔽 packages
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: bin-ubuntu-latest
path: bin

- name: 🔑 nuget login
id: login
uses: NuGet/login@v1
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1
with:
user: ${{ vars.NUGET_OIDC || secrets.NUGET_OIDC }}

- name: 🚀 nuget
run: dotnet nuget push ./bin/**/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ steps.login.outputs.NUGET_API_KEY }} --skip-duplicate
env:
NUGET_API_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
run: dotnet nuget push ./bin/**/*.nupkg -s https://api.nuget.org/v3/index.json -k "$NUGET_API_KEY" --skip-duplicate
23 changes: 17 additions & 6 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Builds the website (docs/, a Lunet site) and deploys it to GitHub Pages.
# Pull requests run the Lunet build as a dry run without deploying.
# Requires: Settings > Pages > Build and deployment > Source set to "GitHub Actions".

name: site
Expand All @@ -13,23 +14,28 @@ on:
- src/Stunts.Extensions/**
- src/Directory.*
- .github/workflows/site.yml
pull_request:
paths:
- docs/**
- src/Stunts/**
- src/Stunts.Extensions/**
- src/Directory.*
- .github/workflows/site.yml

permissions:
contents: read
pages: write
id-token: write

# One deployment at a time; a newer one waits for the running one to end.
# One deployment at a time on main; PR builds do not block deployments.
concurrency:
group: pages
group: pages-${{ github.ref }}
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🛠️ build
uses: lunet-io/actions/lunet-build@v1
uses: lunet-io/actions/lunet-build@2ea1efa0c38b53c50c3f7dd54aaf25ae4dfee6c7 # v1
with:
site_path: docs
build_command: pwsh ./build.ps1
Expand All @@ -38,11 +44,16 @@ jobs:

deploy:
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: 🚀 deploy
id: deploy
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
Loading
Loading