Skip to content

minor linting

minor linting #40

name: "01 - Build, Test, Publish"
on:
push:
# run on all commits
pull_request:
# run on all pull requests
workflow_dispatch:
# allows you to run this workflow manually from the Actions tab
jobs:
build_test_publish:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
BUILD_PATH: ./src
CONFIG_NAME: Release
# relative to BUILD_PATH
PUBLISH_PATH: ../.build/app
steps:
- uses: actions/checkout@v4
with:
# needed for gitversion to work
fetch-depth: 0
- name: gitversion
run: |
# calling "dotnet tool install" when already installed will give an error
# see https://github.com/dotnet/sdk/issues/9500
if ( ! dotnet tool list --global | grep -q "gitversion.tool" )
then
dotnet tool install --global GitVersion.Tool --version 5.8.2
fi
dotnet-gitversion
dotnet-gitversion /showvariable "FullSemVer"
BUILD_NUMBER=$(
# convert to a docker-friendly version number
dotnet-gitversion /showvariable "FullSemVer" \
| sed "s/+/-/g"
)
echo "build number = $BUILD_NUMBER"
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: dotnet info
working-directory: ${{ env.BUILD_PATH }}
run: dotnet --info
- name: dotnet restore
working-directory: ${{ env.BUILD_PATH }}
run: dotnet restore
- name: dotnet build
working-directory: ${{ env.BUILD_PATH }}
run: dotnet build --configuration "$CONFIG_NAME" --no-restore
- name: dotnet test
working-directory: ${{ env.BUILD_PATH }}
run: dotnet test --configuration "$CONFIG_NAME" --no-build --filter "TestCategory!=Performance"
- name: dotnet publish
working-directory: ${{ env.BUILD_PATH }}
run: dotnet publish "./Kingsland.MofParser/Kingsland.MofParser.csproj" --configuration "$CONFIG_NAME" --no-build --output "$PUBLISH_PATH"
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: app
path: .build/app
- name: dotnet tool jb inspectcode
working-directory: ${{ env.BUILD_PATH }}
run: |
dotnet new tool-manifest
dotnet tool install JetBrains.ReSharper.GlobalTools
dotnet tool run jb inspectcode "./Kingsland.MofParser.sln" -output="../.build/out/jb-inspectcode.xml" --no-build
- name: upload jb-inspectcode.xml
uses: actions/upload-artifact@v3
with:
name: jb-inspectcode.xml
path: .build/out/jb-inspectcode.xml
- name: nuget pack
run: nuget pack src/Kingsland.MofParser.nuspec
- name: upload nuget package
uses: actions/upload-artifact@v4
with:
name: nupkg
path: ./*.nupkg