set dotenv-load := true export DOTNET_CLI_TELEMETRY_OPTOUT := "1" @_default: just --list # Cleans out the packages. clean: dotnet clean -v:m # Builds all of the components of this repository. build: dotnet build # Runs all the known tests in the repository. test: test-tool test-packages test-tool: dotnet build examples/SampleTool/SampleTool.csproj dotnet run --no-build --project examples/SampleTool/SampleTool.csproj -- table dotnet run --no-build --project examples/SampleTool/SampleTool.csproj -- log test-packages: build #!/usr/bin/env bash set -euxo pipefail dotnet test \ --no-build \ --test-adapter-path:. \ --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" \ --collect:"XPlat Code Coverage" \ /p:CollectCoverage=true \ -v:q --nologo dotnet tool run reportgenerator \ -reports:tests/*/TestResults/*/coverage.cobertura.xml \ -targetdir:./coverage \ "-reporttypes:Cobertura;TextSummary" || true if [ -f coverage/Summary.txt ] then grep "Line coverage" coverage/Summary.txt || true fi # Restores all the tools and NuGet packages. restore: restore-tools restore-packages # Restores all the dotnet tools used. restore-tools: dotnet tool restore # Restores all the NuGet packages. restore-packages: dotnet restore # Performs a release on all the packages. release: release-setup release-nuget release-tag # Makes sure all the release environment variables are set up. release-setup: restore-tools restore-packages #!/usr/bin/env bash set -euxo pipefail # Verify that all the variables are set. if [ "x$GITEA_TOKEN" = "x" ]; then echo "the environment variable GITEA_TOKEN is not defined" exit 1 fi # Creates and pushes the NuGet packages. release-nuget: release-setup # Rebuild the package in release mode. dotnet build --configuration Release dotnet pack \ -p:IncludeSymbols=true \ -p:SymbolPackageFormat=snupkg \ --configuration Release fd nupkg # Publish the packages. dotnet nuget remove source publish >&/dev/null || true dotnet nuget add source \ --name publish \ --username dmoonfire \ --password $GITEA_TOKEN \ https://src.mfgames.com/api/packages/mfgames-cil/nuget/index.json \ --store-password-in-clear-text dotnet nuget push --skip-duplicate --source publish src/*/bin/*/*.nupkg dotnet nuget push --skip-duplicate --source publish src/*/bin/*/*.snupkg dotnet nuget remove source publish || true # Tags all the libraries for the release. release-tag: release-setup #!/usr/bin/env bash set -euxo pipefail git remote add publish https://dmoonfire:$GITEA_TOKEN@src.mfgames.com/mfgames-cil/$(basename $(git config --get remote.origin.url)) for i in src/*/GitVersion.yml do # Move into the proper directory. dir=$(dirname $i) pkg=$(basename $dir) pushd $dir # Check the version and see if we've tagged it already. tag="$pkg-$(dotnet gitversion /output json | jq -r .SemVer)" if git tag | grep $tag > /dev/null then echo "already tagged $tag" else echo "tagging $pkg with $tag" git tag $tag git push publish $tag fi # Move back so we can finish. popd done