Skip to content

Commit

Permalink
Fix AppVeyor CI build (#85)
Browse files Browse the repository at this point in the history
* Fix AppVeyor CI build
  • Loading branch information
const-cloudinary committed Apr 8, 2018
1 parent 68a197e commit a11f26f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 30 deletions.
33 changes: 10 additions & 23 deletions appveyor.yml
Expand Up @@ -5,11 +5,6 @@
# version format
version: 1.0.{build}

# branches to build
branches:
# whitelist
only:
- master
# Do not build on tags (GitHub and BitBucket)
skip_tags: true

Expand All @@ -27,7 +22,7 @@ max_jobs: 1
#---------------------------------#

# Build worker image (VM template)
image: Visual Studio 2015
image: Visual Studio 2017

# scripts that are called at very beginning, before repo cloning
init:
Expand All @@ -49,20 +44,12 @@ hosts:

# build cache to preserve files/folders between builds
cache:
- packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
- projectA\libs
- node_modules # local npm modules
- '%LocalAppData%\NuGet\Cache'

# scripts that run after cloning repository
install:
# by default, all script lines are interpreted as batch
- echo This is batch
# to run script as a PowerShell command prepend it with ps:
- ps: Write-Host 'This is PowerShell'
# batch commands start from cmd:
- cmd: echo This is batch again
- cmd: set MY_VAR=12345
- appveyor DownloadFile https://dist.nuget.org/win-x86-commandline/latest/nuget.exe

# enable patching of AssemblyInfo.* files
assembly_info:
Expand All @@ -75,8 +62,8 @@ assembly_info:

# Automatically register private account and/or project AppVeyor NuGet feeds.
nuget:
account_feed: true
project_feed: true
account_feed: false
project_feed: false
disable_publish_on_pr: true # disable publishing of .nupkg artifacts to
# account/project feeds for pull request builds

Expand All @@ -103,21 +90,21 @@ configuration: Release
build:
parallel: true # enable MSBuild parallel builds
project: Cloudinary.sln # path to Visual Studio solution or project
publish_wap: false # package Web Application Projects (WAP) for Web Deploy
publish_wap_xcopy: false # package Web Application Projects (WAP) for XCopy deployment
publish_azure: false # package Azure Cloud Service projects and push to artifacts
publish_nuget: false # package projects with .nuspec files and push to artifacts
publish_nuget_symbols: false # generate and publish NuGet symbol packages
include_nuget_references: false # add -IncludeReferencedProjects option while packaging NuGet artifacts

# MSBuild verbosity level
verbosity: minimal
verbosity: normal

test:
assemblies:
- Cloudinary.Test.dll
- Cloudinary.NetCoreTest.dll

# scripts to run before build
before_build:
- ps: .\before_build.ps1
- cmd: nuget restore Cloudinary.sln
- cmd: appveyor-retry nuget restore Cloudinary.sln
# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
before_package:

Expand Down
17 changes: 10 additions & 7 deletions before_build.ps1
@@ -1,10 +1,13 @@
Write-Host "Copying App.config for tests"
Write-Host "Setting up appsettings.json for tests"

$strConfigSource = "c:\projects\cloudinary\Cloudinary.Test\app.config.sample"
$strConfigDest = "c:\projects\cloudinary\Cloudinary.Test\app.config"
$strConfigSource = "$env:APPVEYOR_BUILD_FOLDER\Shared.Tests\appsettings.json.sample"
$strConfigDest = "$env:APPVEYOR_BUILD_FOLDER\Shared.Tests\appsettings.json"

Copy-Item $strConfigSource -Destination $strConfigDest
(Get-Content $strConfigDest).replace('ApiBaseAddress=""', 'ApiBaseAddress="' + $env:ApiBaseAddress + '"') | Set-Content $strConfigDest
(Get-Content $strConfigDest).replace('CloudName=""', 'CloudName="' + $env:CloudName + '"') | Set-Content $strConfigDest
(Get-Content $strConfigDest).replace('ApiKey=""', 'ApiKey="'+ $env:ApiKey + '"') | Set-Content $strConfigDest
(Get-Content $strConfigDest).replace('ApiSecret=""', 'ApiSecret="' + $env:ApiSecret + '"') | Set-Content $strConfigDest

(Get-Content $strConfigDest).replace('"ApiBaseAddress": ""', '"ApiBaseAddress": "' + $env:ApiBaseAddress + '"') | Set-Content $strConfigDest
(Get-Content $strConfigDest).replace('"CloudName": ""', '"CloudName": "' + $env:CloudName + '"') | Set-Content $strConfigDest
(Get-Content $strConfigDest).replace('"ApiKey": ""', '"ApiKey": "'+ $env:ApiKey + '"') | Set-Content $strConfigDest
(Get-Content $strConfigDest).replace('"ApiSecret": ""', '"ApiSecret": "' + $env:ApiSecret + '"') | Set-Content $strConfigDest

Write-Host "Done"

0 comments on commit a11f26f

Please sign in to comment.