2018-08-12 17:06:38 +02:00
# ASF is a C# project with a solution file named ArchiSteamFarm.sln
2016-03-23 13:09:17 +01:00
language : csharp
solution : ArchiSteamFarm.sln
2016-03-23 13:26:03 +01:00
2018-08-12 17:06:38 +02:00
# We can save bandwidth by limiting git clone to only last 10 commits
2016-03-23 13:26:03 +01:00
git :
depth : 10
2018-08-12 17:06:38 +02:00
# ASF is based on .NET Core platform, we're not building with Mono
2020-11-10 23:22:57 +01:00
dotnet : 5.0
2017-06-27 18:13:53 +02:00
mono : none
2017-06-27 18:36:40 +02:00
env :
global :
2017-08-18 19:41:17 +02:00
- CONFIGURATION : Release
2017-06-27 18:36:40 +02:00
- DOTNET_CLI_TELEMETRY_OPTOUT : 1
2020-09-28 21:46:17 +02:00
- DOTNET_NOLOGO : 1
2020-11-10 23:22:57 +01:00
- NET_CORE_VERSION : net5.0
2020-06-13 14:45:41 +02:00
- STEAM_TOKEN_DUMPER_NAME : ArchiSteamFarm.OfficialPlugins.SteamTokenDumper
2020-04-08 19:32:53 +02:00
- VARIANTS="generic linux-arm linux-arm64 linux-x64 osx-x64 win-x64" # NOTE: When modifying variants, don't forget to update ASF_VARIANT definitions in SharedInfo.cs!
2020-05-14 21:25:53 +02:00
addons :
homebrew :
packages : p7zip
2017-09-26 08:54:07 +02:00
before_script :
- |
2019-11-07 22:17:22 +01:00
set -eu
2017-10-23 22:45:32 +02:00
2018-03-17 17:11:41 +01:00
dotnet --info
2018-07-23 05:20:04 +02:00
set +u # This is needed to continue Travis build
2017-06-27 18:36:40 +02:00
script :
2017-07-14 16:55:34 +02:00
- |
2019-11-07 22:17:22 +01:00
set -eu
2017-07-14 16:55:34 +02:00
2019-12-05 19:25:42 +01:00
nvm install lts/*
npm ci --no-progress --prefix ASF-ui
npm run-script deploy --no-progress --prefix ASF-ui
2018-09-23 01:52:19 +02:00
2020-06-13 14:45:41 +02:00
dotnet build ArchiSteamFarm -c "$CONFIGURATION" -p:UseAppHost=false --nologo
dotnet build ArchiSteamFarm.CustomPlugins.ExamplePlugin -c "$CONFIGURATION" -p:UseAppHost=false --nologo
dotnet build ArchiSteamFarm.CustomPlugins.PeriodicGC -c "$CONFIGURATION" -p:UseAppHost=false --nologo
2020-06-15 13:45:17 +02:00
dotnet build "$STEAM_TOKEN_DUMPER_NAME" -c "$CONFIGURATION" -p:UseAppHost=false --nologo
2020-06-13 14:45:41 +02:00
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -p:UseAppHost=false --nologo
2020-05-10 01:04:25 +02:00
2020-06-15 13:45:17 +02:00
if [ -n "${STEAM_TOKEN_DUMPER_TOKEN-}" ] && [ -f "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs" ]; then
sed "s/STEAM_TOKEN_DUMPER_TOKEN/${STEAM_TOKEN_DUMPER_TOKEN}/g" "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs" > "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs.new";
mv "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs.new" "${STEAM_TOKEN_DUMPER_NAME}/SharedInfo.cs"
2020-06-13 16:14:37 +02:00
fi
2020-06-13 14:45:41 +02:00
dotnet publish "$STEAM_TOKEN_DUMPER_NAME" -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}" -p:UseAppHost=false --nologo
dotnet clean ArchiSteamFarm -c "$CONFIGURATION" -p:UseAppHost=false --nologo
2020-05-10 01:04:25 +02:00
dotnet restore ArchiSteamFarm
2017-07-14 16:55:34 +02:00
2017-08-18 19:41:17 +02:00
publish() {
if [ "$1" = 'generic' ]; then
2020-04-22 22:27:59 +02:00
local variantArgs="-p:UseAppHost=false"
2017-07-14 16:55:34 +02:00
else
2020-05-15 17:43:09 +02:00
local variantArgs="-p:PublishSingleFile=true -p:PublishTrimmed=true -r $1"
2017-07-14 16:55:34 +02:00
fi
2020-04-22 22:27:59 +02:00
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${1}" "-p:ASFVariant=$1" --no-restore --nologo $variantArgs
2019-12-07 23:55:44 +01:00
2020-06-13 14:45:41 +02:00
# If we're including any overlay for this variant, copy it to output directory
2019-01-12 02:00:19 +01:00
if [ -d "ArchiSteamFarm/overlay/${1}" ]; then
2019-09-26 20:28:25 +02:00
cp "ArchiSteamFarm/overlay/${1}/"* "out/${1}"
2017-09-23 04:43:27 +02:00
fi
2020-05-14 21:25:53 +02:00
2020-06-13 14:45:41 +02:00
# If we're including SteamTokenDumper plugin for this framework, copy it to output directory
if [ -f "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}/${STEAM_TOKEN_DUMPER_NAME}.dll" ]; then
mkdir -p "out/${1}/plugins/${STEAM_TOKEN_DUMPER_NAME}"
cp "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}/${STEAM_TOKEN_DUMPER_NAME}.dll" "out/${1}/plugins/${STEAM_TOKEN_DUMPER_NAME}"
fi
2020-05-14 21:25:53 +02:00
# Include .ico file for all platforms, since only Windows script can bundle it inside the exe
cp "resources/ASF.ico" "out/${1}/ArchiSteamFarm.ico"
if command -v 7z >/dev/null; then
7z a -bd -slp -tzip -mm=Deflate -mx=1 "out/ASF-${1}.zip" "${TRAVIS_BUILD_DIR}/out/${1}/*"
elif command -v zip >/dev/null; then
(
cd "${TRAVIS_BUILD_DIR}/out/${1}"
zip -1 -q -r "../ASF-${1}.zip" .
)
else
echo "ERROR: No supported zip tool!"
return 1
fi
2017-08-18 19:41:17 +02:00
}
2019-12-05 19:25:42 +01:00
jobs=""
2017-11-29 01:22:40 +01:00
for variant in $VARIANTS; do
publish "$variant" &
2019-12-05 19:25:42 +01:00
jobs="$jobs $!"
done
for job in $jobs; do
wait "$job"
2017-07-14 16:55:34 +02:00
done
2018-06-04 00:17:13 +02:00
2018-07-23 05:20:04 +02:00
set +u # This is needed to continue Travis build
2017-01-17 00:29:47 +01:00
matrix :
2020-11-10 23:22:57 +01:00
allow_failures :
- os : osx
2017-07-10 09:02:57 +02:00
# We can use fast finish, as we don't need to wait for allow_failures builds to mark build as success
2017-01-17 00:29:47 +01:00
fast_finish : true
2017-03-13 02:29:02 +01:00
include :
2017-07-10 09:02:57 +02:00
# We're building ASF with dotnet on latest versions of Linux and OS X
2018-08-12 17:06:38 +02:00
# Sadly, travis is still missing support for selecting latest images: https://github.com/travis-ci/travis-ci/issues/8922
2017-03-13 02:29:02 +01:00
- os : linux
2019-11-07 21:01:14 +01:00
# Ref: https://docs.travis-ci.com/user/reference/linux
2019-09-26 20:28:25 +02:00
dist : bionic
2017-06-30 08:24:20 +02:00
- os : osx
2018-08-12 17:06:38 +02:00
# Ref: https://docs.travis-ci.com/user/reference/osx
2020-11-10 23:22:57 +01:00
dotnet : 5.0 .100 # For OSX, we need absolute dotnet version until https://github.com/dotnet/core-setup/issues/4187 is resolved
2020-05-10 01:04:25 +02:00
osx_image : xcode11.4