Skip to content

Commit 3a8915a

Browse files
sayarrozele
authored andcommitted
fix(react-native-windows): Updated CI configuration. (microsoft#1280)
Updated appveyor.yml to test with both VS2015 & VS2017 (along with their respective platform toolsets), all configurations (Debug, DebugBundle, Release, ReleaseBundle) and all platforms (x86, x64, ARM). However for CI speed, only three configurations are hardcoded into the matrix. (SEE COMMENTS). FIXED: Tests weren't actually running except through OpenCover to record coverage. Nunit3-console is now running and output tests results in an AppVeyor-friendly format Added missing run flow-check (fixes microsoft#1204, microsoft#1203).
1 parent ab137e4 commit 3a8915a

File tree

2 files changed

+71
-24
lines changed

2 files changed

+71
-24
lines changed

appveyor.yml

+68-23
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,40 @@
11
version: 1.0.{build}
22
max_jobs: 2
3-
image: Visual Studio 2015
43

4+
# Reducing build load and CI time by specifying the exact test matrix.
55
environment:
6-
nodejs_version: "6"
6+
nodejs_version: "LTS"
7+
matrix:
8+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
9+
PLATFORM_TOOLSET: v140
10+
CONFIGURATION: Debug
11+
PLATFORM: x64
12+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
13+
PLATFORM_TOOLSET: v140
14+
CONFIGURATION: Debug
15+
PLATFORM: ARM
16+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
17+
PLATFORM_TOOLSET: v141
18+
CONFIGURATION: ReleaseBundle
19+
PLATFORM: x86
20+
21+
# Uncomment to enable entire matrix of tests.
22+
#image:
23+
# - Visual Studio 2015
24+
# - Visual Studio 2017
25+
#configuration:
26+
# - Debug
27+
# - ReleaseBundle
28+
# - DebugBundle
29+
# - Release
30+
#platform:
31+
# - x86
32+
# - x64
33+
# - ARM
34+
35+
matrix:
36+
# Fail everything immediately if one build fails.
37+
fast_finish: true
738

839
hosts:
940
api.nuget.org: 93.184.221.200
@@ -18,46 +49,60 @@ install:
1849
- ps: '[IO.Compression.ZipFile]::ExtractToDirectory("C:\winium.zip", "C:\winium")'
1950

2051
clone_script:
21-
- ps: git clone -q $("--branch=" + $Env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $Env:APPVEYOR_REPO_NAME + ".git") $Env:APPVEYOR_BUILD_FOLDER
22-
- ps: if (!$Env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $Env:APPVEYOR_REPO_COMMIT)}
23-
- ps: if ($Env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($Env:APPVEYOR_PULL_REQUEST_NUMBER)/merge; git checkout -qf FETCH_HEAD}
52+
- ps: git clone -q $("--branch=" + $env:APPVEYOR_REPO_BRANCH) $("https://github.com/" + $env:APPVEYOR_REPO_NAME + ".git") $env:APPVEYOR_BUILD_FOLDER
53+
- ps: if (!$env:APPVEYOR_PULL_REQUEST_NUMBER) {$("git checkout -qf " + $env:APPVEYOR_REPO_COMMIT)}
54+
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER) {git fetch -q origin +refs/pull/$($env:APPVEYOR_PULL_REQUEST_NUMBER)/merge; git checkout -qf FETCH_HEAD}
2455
- ps: git submodule update -q --init --recursive
2556

2657
before_build:
27-
- ps: $env:playgroundNet46_dir=$Env:APPVEYOR_BUILD_FOLDER + "\ReactWindows\Playground.Net46"
28-
- ps: $env:bundle_dir=$Env:APPVEYOR_BUILD_FOLDER + "\ReactWindows\Playground.Net46\ReactAssets"
58+
- ps: $env:playgroundNet46_dir=$env:APPVEYOR_BUILD_FOLDER + "\ReactWindows\Playground.Net46"
59+
- ps: $env:bundle_dir=$env:APPVEYOR_BUILD_FOLDER + "\ReactWindows\Playground.Net46\ReactAssets"
2960
- ps: nuget restore ReactWindows\ReactNative.sln
3061
- npm i -g react-native-cli
3162

3263
build_script:
3364
- ps: mkdir $env:bundle_dir
3465
- ps: react-native bundle --platform windows --entry-file $($env:playgroundNet46_dir + "\index.windows.js") --bundle-output $($env:bundle_dir + "\index.windows.bundle") --assets-dest $env:bundle_dir --dev false; echo "Suppressing error"
35-
- cmd: >-
36-
set DEVENV="%VS140COMNTOOLS%\..\IDE\devenv"
37-
38-
%DEVENV% /build "Debug|x86" ReactWindows\ReactNative.sln
39-
40-
%DEVENV% /build "ReleaseBundle|x64" ReactWindows\ReactNative.sln
41-
42-
%DEVENV% /build "Debug|ARM" ReactWindows\ReactNative.sln
66+
- ps: msbuild /p:Configuration=$env:CONFIGURATION /p:Platform=$env:PLATFORM /p:PlatformToolset=$env:PLATFORM_TOOLSET /nologo /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" "ReactWindows\ReactNative.sln"
4367

4468
# Start Winium in the background, give it a moment to start
4569
before_test:
4670
- ps: $winium = Start-Process -PassThru C:\winium\Winium.Desktop.Driver.exe
4771
- ps: Start-Sleep -s 5
4872

49-
test:
50-
assemblies:
51-
- ReactWindows\ReactNative.Net46.Tests\bin\x64\**\*.Tests.dll
52-
5373
test_script:
54-
# - npm run flow-check
55-
- npm test
74+
# Run Nunit 3.x test engine and output to AppVeyor's UI.
75+
- ps: >-
76+
$platform = Get-ChildItem Env:PLATFORM
77+
78+
$platform = $platform.value
79+
80+
$config = Get-ChildItem Env:CONFIGURATION
81+
82+
if($config.value -eq "ReleaseBundle") { $config = "Release" } elseif ($config -eq "DebugBundle") { $config = "Debug" } else { $config = $config.value }
83+
84+
if($platform -ne "ARM") { nunit3-console "ReactWindows\ReactNative.Net46.Tests\bin\$platform\$config\ReactNative.Net46.Tests.dll" --result=myresults.xml }
85+
86+
if ($platform -eq "ReleaseBundle" -Or $platform -eq "DebugBundle") { npm test }
87+
88+
# Disabling for now
89+
#- npm run flow-check
90+
# Spec test only works when there is a bundle
91+
5692
- npm run lint
5793

5894
after_test:
59-
- ps: Stop-Process -Id $winium.Id
60-
- ReactWindows\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe -register:user -target:"ReactWindows\packages\NUnit.ConsoleRunner.3.5.0\tools\nunit3-console.exe" -targetargs:"ReactWindows\ReactNative.Net46.Tests\bin\x86\Debug\ReactNative.Net46.Tests.dll" -output:ReactWindows_coverage.xml
95+
- ps: >-
96+
Stop-Process -Id $winium.Id
97+
98+
$platform = Get-ChildItem Env:PLATFORM
99+
100+
$config = Get-ChildItem Env:CONFIGURATION
101+
102+
if($config.value -eq "ReleaseBundle") { $config = "Release" } elseif ($config -eq "DebugBundle") { $config = "Debug" } else { $config = $config.value }
103+
104+
if ($platform.value -ne "ARM") { ReactWindows\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe -register:user -target:"ReactWindows\packages\NUnit.ConsoleRunner.3.5.0\tools\nunit3-console.exe" -targetargs:"ReactWindows\ReactNative.Net46.Tests\bin\$env:PLATFORM\$config\ReactNative.Net46.Tests.dll" -output:ReactWindows_coverage.xml }
105+
61106
- "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%"
62107
- pip install codecov
63108
- codecov -f "ReactWindows_coverage.xml"

spec/PlaygroundNet46TestSpec.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var selenium = require('selenium-webdriver');
2+
var path = require('path');
23
var By = selenium.By;
34

45
jasmine.DEFAULT_TIMEOUT_INTERVAL = 15000;
@@ -8,7 +9,8 @@ describe('In PlaygroundNet46 Test', () => {
89
this.driver = new selenium.Builder()
910
.usingServer('http://localhost:9999')
1011
.withCapabilities({
11-
'app': __dirname + '\\..\\ReactWindows\\Playground.Net46\\bin\\x64\\ReleaseBundle\\Playground.Net46.exe',
12+
'app': path.join(__dirname, '\\..\\ReactWindows\\Playground.Net46\\bin\\', process.env["PLATFORM"] || "x86",
13+
process.env["CONFIGURATION"] || "ReleaseBundle", "Playground.Net46.exe"),
1214
'launchDelay': '1000'
1315
})
1416
.forBrowser('desktop')

0 commit comments

Comments
 (0)