version: '{build}-{branch}' pull_requests: do_not_increment_build_number: true skip_branch_with_pr: true image: Visual Studio 2019 configuration: Release clone_depth: 10 environment: DOTNET_CHANNEL: 5.0 DOTNET_CLI_TELEMETRY_OPTOUT: true DOTNET_INSTALL_DIR: C:\Program Files\dotnet DOTNET_NOLOGO: true # DOTNET_SDK: 5.0.103 NET_CORE_VERSION: net5.0 NET_FRAMEWORK_VERSION: net48 NODE_JS_VERSION: lts STEAM_TOKEN_DUMPER_NAME: ArchiSteamFarm.OfficialPlugins.SteamTokenDumper STEAM_TOKEN_DUMPER_TOKEN: secure: uttQUE9ZK7BIa9SIbDkpUTMx7Slnl3zAPkRNzE465YgwxLdLEwv6yYR5QXCSZolb5Qq23Z/LmZNGd3M6B0+hbx3waWOeW2AiWvfCcnUmuT+3wfLJsgLbf1g4agFS7zsDgeRPfnNMzOxD8etelnA5YOOUMNB3RLw3fIdznNd+Fs6R0Ou3/1UavDuHKkbh1+A5 VARIANTS: generic generic-netf 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! matrix: allow_failures: - image: Visual Studio 2019 Preview fast_finish: true install: - pwsh: >- Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' git submodule sync --recursive if ($LastExitCode -ne 0) { throw "Last command failed." } git submodule update --init --recursive if ($LastExitCode -ne 0) { throw "Last command failed." } if ($env:DOTNET_CHANNEL) { dotnet --info try { &([scriptblock]::Create((Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1'))) -Channel "$env:DOTNET_CHANNEL" -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath } catch [System.Net.WebException],[System.IO.IOException] { # Not fatal for the remaining part of the script Write-Host $_ } } if ($env:DOTNET_SDK) { dotnet --info try { &([scriptblock]::Create((Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1'))) -Channel 'Current' -Version "$env:DOTNET_SDK" -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath } catch [System.Net.WebException],[System.IO.IOException] { # Not fatal for the remaining part of the script Write-Host $_ } } - ps: Install-Product node "$env:NODE_JS_VERSION" before_build: - pwsh: >- Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' dotnet --info if ($LastExitCode -ne 0) { throw "Last command failed." } node -v if ($LastExitCode -ne 0) { throw "Last command failed." } npm -v if ($LastExitCode -ne 0) { throw "Last command failed." } build_script: - pwsh: >- Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' npm ci --no-progress --prefix ASF-ui if ($LastExitCode -ne 0) { throw "Last command failed." } npm run-script deploy --no-progress --prefix ASF-ui if ($LastExitCode -ne 0) { throw "Last command failed." } dotnet build -c "$env:CONFIGURATION" -p:ContinuousIntegrationBuild=true -p:UseAppHost=false --nologo if ($LastExitCode -ne 0) { throw "Last command failed." } test_script: - pwsh: >- Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' dotnet test ArchiSteamFarm.Tests -c "$env:CONFIGURATION" -p:ContinuousIntegrationBuild=true -p:UseAppHost=false --nologo if ($LastExitCode -ne 0) { throw "Last command failed." } after_test: - pwsh: >- Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' if ((Test-Path env:STEAM_TOKEN_DUMPER_TOKEN) -and (Test-Path "$env:STEAM_TOKEN_DUMPER_NAME\SharedInfo.cs" -PathType Leaf)) { (Get-Content "$env:STEAM_TOKEN_DUMPER_NAME\SharedInfo.cs").Replace('STEAM_TOKEN_DUMPER_TOKEN', "$env:STEAM_TOKEN_DUMPER_TOKEN") | Set-Content "$env:STEAM_TOKEN_DUMPER_NAME\SharedInfo.cs" } dotnet publish "$env:STEAM_TOKEN_DUMPER_NAME" -c "$env:CONFIGURATION" -f "$env:NET_CORE_VERSION" -o "out/$env:STEAM_TOKEN_DUMPER_NAME/$env:NET_CORE_VERSION" -p:ContinuousIntegrationBuild=true -p:TargetLatestRuntimePatch=false -p:UseAppHost=false --nologo if ($LastExitCode -ne 0) { throw "Last command failed." } dotnet publish "$env:STEAM_TOKEN_DUMPER_NAME" -c "$env:CONFIGURATION" -f "$env:NET_FRAMEWORK_VERSION" -o "out/$env:STEAM_TOKEN_DUMPER_NAME/$env:NET_FRAMEWORK_VERSION" -p:ContinuousIntegrationBuild=true -p:TargetLatestRuntimePatch=false -p:UseAppHost=false --nologo if ($LastExitCode -ne 0) { throw "Last command failed." } dotnet restore ArchiSteamFarm -p:ContinuousIntegrationBuild=true if ($LastExitCode -ne 0) { throw "Last command failed." } $PublishBlock = { param($variant) Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' Set-Location "$env:APPVEYOR_BUILD_FOLDER" if ($variant -like '*-netf') { $targetFramework = $env:NET_FRAMEWORK_VERSION } else { $targetFramework = $env:NET_CORE_VERSION } if ($variant -like 'generic*') { $variantArgs = '-p:TargetLatestRuntimePatch=false', '-p:UseAppHost=false' } else { $variantArgs = '-p:PublishSingleFile=true', '-p:PublishTrimmed=true', '-r', "$variant" } dotnet publish ArchiSteamFarm -c "$env:CONFIGURATION" -f "$targetFramework" -o "out\$variant" "-p:ASFVariant=$variant" -p:ContinuousIntegrationBuild=true --no-restore --nologo $variantArgs if ($LastExitCode -ne 0) { throw "Last command failed." } # If we're including any overlay for this variant, copy it to output directory if (Test-Path "ArchiSteamFarm\overlay\$variant" -PathType Container) { Copy-Item "ArchiSteamFarm\overlay\$variant\*" "out\$variant" -Recurse } # If we're including SteamTokenDumper plugin for this framework, copy it to output directory if (Test-Path "out\$env:STEAM_TOKEN_DUMPER_NAME\$targetFramework" -PathType Container) { if (!(Test-Path "out\$variant\plugins\$env:STEAM_TOKEN_DUMPER_NAME" -PathType Container)) { New-Item -ItemType Directory -Path "out\$variant\plugins\$env:STEAM_TOKEN_DUMPER_NAME" > $null } Copy-Item "out\$env:STEAM_TOKEN_DUMPER_NAME\$targetFramework\*" "out\$variant\plugins\$env:STEAM_TOKEN_DUMPER_NAME" -Recurse } # Icon is available only in .NET Framework and .NET Core Windows build, we'll bundle the .ico file for other flavours if (($targetFramework -eq "$env:NET_CORE_VERSION") -and !(Test-Path "out\$variant\ArchiSteamFarm.exe" -PathType Leaf)) { Copy-Item 'resources\ASF.ico' "out\$variant\ArchiSteamFarm.ico" } # By default use fastest compression $compressionArgs = '-mx=1' # Include extra logic for builds marked for release if ($env:APPVEYOR_REPO_TAG -eq 'true') { # Update link in Changelog.html accordingly if (Test-Path "out\$variant\Changelog.html" -PathType Leaf) { (Get-Content "out\$variant\Changelog.html").Replace('ArchiSteamFarm/commits/main', "ArchiSteamFarm/releases/tag/$env:APPVEYOR_REPO_TAG_NAME") | Set-Content "out\$variant\Changelog.html" } } 7z a -bd -slp -tzip -mm=Deflate $compressionArgs "out\ASF-$variant.zip" "$env:APPVEYOR_BUILD_FOLDER\out\$variant\*" if ($LastExitCode -ne 0) { throw "Last command failed." } # TODO: Change me to Push-AppveyorArtifact once https://github.com/appveyor/ci/issues/2183 is fixed appveyor PushArtifact "out\ASF-$variant.zip" -FileName "ASF-$variant.zip" -DeploymentName "ASF-$variant.zip" } foreach ($variant in $env:VARIANTS.Split([char[]] $null, [System.StringSplitOptions]::RemoveEmptyEntries)) { Start-Job -Name "$variant" $PublishBlock -ArgumentList "$variant" } Get-Job | Receive-Job -Wait deploy: off notifications: - provider: Webhook url: secure: i/og7KzkpbcWcKoUubrLH+KB6bkfqA55FHUlGxLepLmgZNQeNMiMoAFICOFY795fFrFfUNUKqwk7ApXE6HUyWMoiijLj7G/JBLTPkBiTCu8fZMTMqwQm6FiHB3+/0h0C+ukcrBEqnXYSQUh6znpKqJSTrIfXUQ7ftNuC966kBAw= method: POST body: >- { "avatar_url": "https://www.appveyor.com/assets/img/appveyor-logo-256.png", "username": "AppVeyor", "content": "[{{projectName}}:{{branch}}] {{commitMessage}} by {{commitAuthor}} ({{commitId}}) | **{{status}}** on {{buildUrl}}" } on_build_success: true on_build_failure: true on_build_status_changed: false