mfgames-cil/Justfile

87 lines
2.6 KiB
Makefile
Raw Normal View History

2023-07-10 04:11:38 +00:00
set dotenv-load := true
@_default:
2023-07-22 18:36:30 +00:00
just --list
2023-07-10 04:27:05 +00:00
# Cleans out the packages.
clean:
2023-07-13 01:31:25 +00:00
dotnet clean -v:m
2023-07-10 04:27:05 +00:00
# Builds all of the components of this repository.
build:
dotnet build
# Runs all the known tests in the repository.
2023-07-22 20:28:59 +00:00
test: test-tool test-packages
test-tool:
2023-07-22 21:39:24 +00:00
dotnet run --project examples/SampleTool/SampleTool.csproj -- table
dotnet run --no-build --project examples/SampleTool/SampleTool.csproj -- log
2023-07-22 20:28:59 +00:00
test-packages:
2023-07-13 01:31:25 +00:00
#!/usr/bin/env bash
2023-07-22 21:39:24 +00:00
set -euxo pipefail
dotnet test \
2023-07-13 01:31:25 +00:00
--test-adapter-path:. \
--logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" \
--collect:"XPlat Code Coverage" \
-v:q --nologo || exit 1
dotnet tool run reportgenerator \
-reports:tests/*/TestResults/*/coverage.cobertura.xml \
-targetdir:./coverage \
"-reporttypes:Cobertura;TextSummary"
2023-07-22 18:36:30 +00:00
if [ -f coverage/Summary.txt ];then grep "Line coverage" coverage/Summary.txt; 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
2023-07-10 04:27:05 +00:00
# Performs a release on all the packages.
release: clean build
2023-07-13 01:31:25 +00:00
#!/usr/bin/env bash
# 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
# Publish the packages.
dotnet pack -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg || exit 1
dotnet nuget remove source publish >&/dev/null
#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 || exit 1
#dotnet nuget push --skip-duplicate --source publish src/*/bin/Debug/*.nupkg || exit 1
dotnet nuget remove source publish >&/dev/null
# Go through and tag everything.
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)"
echo "tagging $pkg with $tag"
#git tag $tag
#git push publish $tag
# Move back so we can finish.
popd
done
git remote remove publish