Skip to content

Commit

Permalink
Merge pull request #413 from TimLariviere/azure-pipelines
Browse files Browse the repository at this point in the history
 Set up CI with Azure Pipelines
  • Loading branch information
TimLariviere authored May 24, 2019
2 parents 87e2000 + 5631978 commit f78b4d8
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 12 deletions.
11 changes: 11 additions & 0 deletions DEVGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ On Windows:

FAKE will have updated `Directory.Build.props` and `template.json`. Commit all changes.

While you could release immediately manually, it is recommended to do a release PR and publish the NuGet packages generated by the CI builds.

Lastly, publish all the generated packages to NuGet by running these commands:

On OSX:
Expand Down Expand Up @@ -154,3 +156,12 @@ Smallest app size is produced by
![app size](https://user-images.githubusercontent.com/7204669/42222786-1096c20a-7ece-11e8-99d6-e1c63a6a2f30.png)

Also check the app actually runs with these settings.

## Dev Notes - Continuous Integration builds

This repository uses several Azure DevOps pipelines to ensure the code always builds correctly and prepare NuGet packages.

Every pull request is automatically valided with a partial build on a Windows agent (compile) and a full build on a macOS agent (compile and test)
If needed, collaborators and owners of this repository can run a full build on Windows, macOS and Linux by commenting `/azp run full build` in a pull request.

All commits in master (like merged PRs) are built with a full build (Windows, macOS and Linux)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
F# Functional App Development, using Elmish and Xamarin.Forms
=======

[![NuGet version](https://badge.fury.io/nu/Fabulous.Core.svg)](https://badge.fury.io/nu/Fabulous.Core) [![Build status (Windows)](https://ci.appveyor.com/api/projects/status/4qajefd4c6sbjfrt/branch/master?svg=true)](https://ci.appveyor.com/project/dsyme/elmish-xamarinforms/branch/master) [![Build status (OSX)](https://travis-ci.org/fsprojects/Fabulous.svg?branch=master)](https://travis-ci.org/fsprojects/Fabulous) [![Join the chat at https://gitter.im/fsprojects/Fabulous](https://badges.gitter.im/fsprojects/Fabulous.svg)](https://gitter.im/fsprojects/Fabulous?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![NuGet version](https://badge.fury.io/nu/Fabulous.Core.svg)](https://badge.fury.io/nu/Fabulous.Core) [![Build status (Windows)](https://ci.appveyor.com/api/projects/status/4qajefd4c6sbjfrt/branch/master?svg=true)](https://ci.appveyor.com/project/dsyme/elmish-xamarinforms/branch/master) [![Build status (OSX)](https://travis-ci.org/fsprojects/Fabulous.svg?branch=master)](https://travis-ci.org/fsprojects/Fabulous)[![Build Status](https://dev.azure.com/timothelariviere/Fabulous/_apis/build/status/Full%20Build?branchName=master)](https://dev.azure.com/timothelariviere/Fabulous/_build/latest?definitionId=7&branchName=master) [![Join the chat at https://gitter.im/fsprojects/Fabulous](https://badges.gitter.im/fsprojects/Fabulous.svg)](https://gitter.im/fsprojects/Fabulous?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Never write a ViewModel class again! Conquer the world with clean dynamic UIs!

Expand Down
54 changes: 54 additions & 0 deletions azure-pipelines-full.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
trigger:
- master

jobs:
- job: Linux
pool:
vmImage: 'ubuntu-16.04'
steps:
- script: |
sudo apt-get update
sudo apt-get install fsharp
displayName: 'Install F#'
- script: ./build.sh Test
- task: CopyFiles@1
inputs:
contents: ./build_output/*.nupkg
targetFolder: $(Build.ArtifactStagingDirectory)
flattenFolders: true
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: Linux

- job: macOS
pool:
vmImage: 'macOS-10.14'
steps:
- script: ./build.sh Test
- task: CopyFiles@1
inputs:
contents: ./build_output/*.nupkg
targetFolder: $(Build.ArtifactStagingDirectory)
flattenFolders: true
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: macOS

- job: Windows
pool:
vmImage: 'windows-2019'
steps:
- script: |
choco install gtksharp
.\build.cmd Test
- task: CopyFiles@2
inputs:
contents: build_output\*.nupkg
targetFolder: $(Build.ArtifactStagingDirectory)
flattenFolders: true
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: Windows
17 changes: 17 additions & 0 deletions azure-pipelines-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
trigger:
- none
pr:
- master

jobs:
- job: Windows
pool:
vmImage: 'windows-2019'
steps:
- script: .\build.cmd

- job: macOS
pool:
vmImage: 'macOS-10.14'
steps:
- script: ./build.sh Test
22 changes: 14 additions & 8 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,21 @@ let release = ReleaseNotes.load "RELEASE_NOTES.md"
let buildDir = Path.getFullName "./build_output"

let removeIncompatiblePlatformProjects pattern =
if not Environment.isWindows then
if Environment.isMacOS then
pattern
-- "samples/**/*.WPF.fsproj"
-- "samples/**/*.UWP.fsproj"
elif not Environment.isMacOS then
-- "samples/**/*.UWP.fsproj"
elif Environment.isWindows then
pattern
-- "samples/**/*.MacOS.fsproj"
-- "samples/**/*.macOS.fsproj"
-- "samples/**/*.iOS.fsproj"
else
pattern
-- "samples/**/*.macOS.fsproj"
-- "samples/**/*.iOS.fsproj"
-- "samples/**/*.WPF.fsproj"
-- "samples/**/*.UWP.fsproj"
-- "samples/**/*.Droid.fsproj"

let projects = [
{ Name = "Src"; Path = !! "src/**/*.fsproj"; Action = DotNetPack; OutputPath = buildDir }
Expand Down Expand Up @@ -182,6 +188,7 @@ Target.create "TestTemplatesNuGet" (fun _ ->
let extraArgs =
if Environment.isWindows then " --WPF --UWP"
elif Environment.isMacOS then " --macOS"
elif Environment.isLinux then " --Android=false --iOS=false"
else ""

DotNet.exec id "new fabulous-app" (sprintf "-n %s -lang F# --GTK%s" testAppName extraArgs) |> ignore
Expand All @@ -196,12 +203,11 @@ Target.create "TestTemplatesNuGet" (fun _ ->
restorePackageDotnetCli testAppName (testAppName + ".UWP") "csproj" pkgs

// Build for all combinations
let slash = if Environment.isUnix then "\\" else ""
for c in ["Debug"; "Release"] do
for p in ["Any CPU"; "iPhoneSimulator"] do
let args = (sprintf "%s/%s.sln /p:Platform=\"%s\" /p:Configuration=%s /p:PackageSources=%s\"https://api.nuget.org/v3/index.json;%s%s\"" testAppName testAppName p c slash pkgs slash)
let code = Shell.Exec("msbuild", args)
if code <> 0 then failwithf "%s %s failed, error code %d" "msbuild" args code
let sln = sprintf "%s/%s.sln" testAppName testAppName
let properties = [("RestorePackages", "True"); ("Platform", p); ("Configuration", c); ("PackageSources", sprintf "https://api.nuget.org/v3/index.json;%s" pkgs)]
MSBuild.run id "" "Build" properties [sln] |> Trace.logItems ("Build-Output: ")
)

Target.create "Build" ignore
Expand Down
6 changes: 3 additions & 3 deletions tests/Fabulous.Cli.Tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ type TestClass () =

[<Test>]
member this.TestCanEvaluateCounterApp () =
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ + "/../../Samples/CounterApp/CounterApp"
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ + "/../../samples/CounterApp/CounterApp"
TestHelpers.createNetStandardProjectArgs "CounterApp" elmishExtraRefs
Assert.AreEqual(0, FSharpDaemon.Driver.main( [| "dummy.exe"; "--eval"; "@CounterApp.args.txt" |]))

[<Test>]
member this.TestCanEvaluateTicTacToeApp () =
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ + "/../../Samples/TicTacToe/TicTacToe"
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ + "/../../samples/TicTacToe/TicTacToe"
TestHelpers.createNetStandardProjectArgs "TicTacToe" elmishExtraRefs
Assert.AreEqual(0, FSharpDaemon.Driver.main( [| "dummy.exe"; "--eval"; "@TicTacToe.args.txt" |]))

Expand All @@ -50,7 +50,7 @@ let theRef = Fabulous.DynamicViews.ViewRef<Xamarin.Forms.Label>()

[<Test>]
member this.TestCallUnitFunction() =
ElmishTestCase "TestCallUnitFunction" """
ElmishTestCase "TestCallUnitFunction" """
let theRef = FSharp.Core.LanguagePrimitives.GenericZeroDynamic<int>()
"""

Expand Down

0 comments on commit f78b4d8

Please sign in to comment.