152 lines
4 KiB
Makefile
152 lines
4 KiB
Makefile
set dotenv-load := true
|
|
|
|
export DOTNET_CLI_TELEMETRY_OPTOUT := "1"
|
|
|
|
@_default:
|
|
just --list
|
|
|
|
# Cleans out the packages.
|
|
clean:
|
|
dotnet clean -v:m
|
|
|
|
# Formats everything in the package.
|
|
format:
|
|
treefmt
|
|
just --fmt --unstable
|
|
|
|
# Builds all of the components of this repository.
|
|
build: format
|
|
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
|
|
|
|
coverage-packages: test-packages
|
|
#!/usr/bin/env bash
|
|
set -euxo pipefail
|
|
|
|
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$MFGAMES_GITEA_TOKEN" = "x" ]; then
|
|
echo "the environment variable MFGAMES_GITEA_TOKEN is not defined"
|
|
exit 1
|
|
fi
|
|
|
|
# Sets the version for all the packages based on conventional commits
|
|
|
|
# and semantic releases.
|
|
release-version:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cd src
|
|
|
|
for pkg in MfGames*
|
|
do
|
|
ver=$(mfgames-conventional-commit version --package $pkg)
|
|
dotnet setversion $ver $pkg/$pkg.csproj
|
|
done
|
|
|
|
# Creates and pushes the NuGet packages.
|
|
release-pack: release-setup release-version
|
|
# Rebuild the package in release mode.
|
|
dotnet clean --configuration Release
|
|
dotnet build --configuration Release
|
|
dotnet pack \
|
|
-p:IncludeSymbols=true \
|
|
-p:SymbolPackageFormat=snupkg \
|
|
--configuration Release
|
|
|
|
fd nupkg --no-ignore
|
|
|
|
release-nuget: release-pack
|
|
# Publish the packages.
|
|
dotnet nuget remove source publish >&/dev/null || true
|
|
dotnet nuget add source \
|
|
--name publish \
|
|
--username dmoonfire \
|
|
--password $MFGAMES_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/Release/*.nupkg
|
|
dotnet nuget push --skip-duplicate --source publish src/*/bin/Release/*.snupkg
|
|
dotnet nuget remove source publish || true
|
|
|
|
# Tags all the libraries for the release.
|
|
release-tag: release-setup
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
git remote remove publish || true
|
|
git remote add publish https://dmoonfire:$MFGAMES_GITEA_TOKEN@src.mfgames.com/mfgames-cil/$(basename $(git config --get remote.origin.url))
|
|
|
|
cd src
|
|
|
|
for pkg in MfGames*
|
|
do
|
|
# Move into the proper directory.
|
|
dir=$pkg
|
|
pushd $dir
|
|
|
|
# Check the version and see if we have tagged it already.
|
|
ver=$(mfgames-conventional-commit version --package $pkg)
|
|
tag="$pkg-$ver"
|
|
|
|
if git tag | grep $tag > /dev/null
|
|
then
|
|
echo "already tagged $tag"
|
|
else
|
|
echo "tagging $pkg with $tag"
|
|
git tag $tag || true
|
|
git push publish $tag || true
|
|
fi
|
|
|
|
# Move back so we can finish.
|
|
popd
|
|
done
|