Skip to content

Rely on CLI arguments #1376

Rely on CLI arguments

Rely on CLI arguments #1376

Workflow file for this run

name: .NET Build, Test, and Publish Nuget Package
on:
push:
branches:
- "**"
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches:
- "**"
env:
VERSION: 0.0.0
defaults:
run:
working-directory: ./
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set Version Variable
if: ${{ github.ref_type == 'tag' }}
env:
TAG: ${{ github.ref_name }}
run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore --verbosity normal /p:Version=$VERSION
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal
- name: pack nuget packages
run: dotnet pack --configuration Release --output nupkgs --no-restore --no-build --verbosity normal /p:PackageVersion=$VERSION
- name: upload nuget package
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push nupkgs/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
benchmark:
name: Run Benchmark.Net benchmark example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Run benchmark
run: cd tests/DynamoDBGenerator.SourceGenerator.Benchmarks && dotnet run --configuration 'Release' -- --exporters 'JSON' --filter '*' --memory --job 'Default'
- name: Store benchmark result
uses: rhysd/github-action-benchmark@v1
with:
name: Benchmark.Net Benchmark
tool: 'benchmarkdotnet'
output-file-path: tests/DynamoDBGenerator.SourceGenerator.Benchmarks/BenchmarkDotNet.Artifacts/results/Sample.Benchmarks-report-full-compressed.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '200%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@inputfalken'
# - name: Store benchmark result - separate results repo
# uses: rhysd/github-action-benchmark@v1
# with:
# name: Benchmark.Net Benchmark
# tool: 'benchmarkdotnet'
# output-file-path: tests/DynamoDBGenerator.SourceGenerator.Benchmarks/BenchmarkDotNet.Artifacts/results/Sample.Benchmarks-report-full-compressed.json
# github-token: ${{ secrets.BENCHMARK_ACTION_BOT_TOKEN }}
# auto-push: true
# # Show alert with commit comment on detecting possible performance regression
# alert-threshold: '200%'
# comment-on-alert: true
# fail-on-alert: true
# alert-comment-cc-users: '@inputfalken'
# gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'