ArchiSteamFarm/.travis.yml
2020-11-21 18:14:15 +01:00

116 lines
4.5 KiB
YAML

# ASF is a C# project with a solution file named ArchiSteamFarm.sln
language: csharp
solution: ArchiSteamFarm.sln
# We can save bandwidth by limiting git clone to only last 10 commits
git:
depth: 10
# ASF is based on .NET Core platform, we're not building with Mono
dotnet: 5.0
mono: none
env:
global:
- CONFIGURATION: Release
- DOTNET_CLI_TELEMETRY_OPTOUT: 1
- DOTNET_NOLOGO: 1
- NET_CORE_VERSION: net5.0
- STEAM_TOKEN_DUMPER_NAME: ArchiSteamFarm.OfficialPlugins.SteamTokenDumper
- 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!
addons:
homebrew:
packages: p7zip
before_script:
- |
set -eu
dotnet --info
set +u # This is needed to continue Travis build
script:
- |
set -eu
nvm install lts/*
npm ci --no-progress --prefix ASF-ui
npm run-script deploy --no-progress --prefix ASF-ui
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
dotnet build "$STEAM_TOKEN_DUMPER_NAME" -c "$CONFIGURATION" -p:UseAppHost=false --nologo
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -p:UseAppHost=false --nologo
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"
fi
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
dotnet restore ArchiSteamFarm
publish() {
if [ "$1" = 'generic' ]; then
local variantArgs="-p:UseAppHost=false"
else
local variantArgs="-p:PublishSingleFile=true -p:PublishTrimmed=true -r $1"
fi
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${1}" "-p:ASFVariant=$1" --no-restore --nologo $variantArgs
# If we're including any overlay for this variant, copy it to output directory
if [ -d "ArchiSteamFarm/overlay/${1}" ]; then
cp "ArchiSteamFarm/overlay/${1}/"* "out/${1}"
fi
# If we're including SteamTokenDumper plugin for this framework, copy it to output directory
if [ -d "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}" ]; then
mkdir -p "out/${1}/plugins/${STEAM_TOKEN_DUMPER_NAME}"
cp -pR "out/${STEAM_TOKEN_DUMPER_NAME}/${NET_CORE_VERSION}/"* "out/${1}/plugins/${STEAM_TOKEN_DUMPER_NAME}"
fi
# 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
}
jobs=""
for variant in $VARIANTS; do
publish "$variant" &
jobs="$jobs $!"
done
for job in $jobs; do
wait "$job"
done
set +u # This is needed to continue Travis build
matrix:
allow_failures:
- os: osx
# We can use fast finish, as we don't need to wait for allow_failures builds to mark build as success
fast_finish: true
include:
# We're building ASF with dotnet on latest versions of Linux and OS X
# Sadly, travis is still missing support for selecting latest images: https://github.com/travis-ci/travis-ci/issues/8922
- os: linux
# Ref: https://docs.travis-ci.com/user/reference/linux
dist: bionic
- os: osx
# Ref: https://docs.travis-ci.com/user/reference/osx
dotnet: 5.0.100 # For OSX, we need absolute dotnet version until https://github.com/dotnet/core-setup/issues/4187 is resolved
osx_image: xcode12.2