Skip to content

Commit

Permalink
Merge pull request #37 from petabridge/dev
Browse files Browse the repository at this point in the history
v0.1.0 Release
  • Loading branch information
Aaronontheweb authored Jul 12, 2019
2 parents 1146224 + fcbbc07 commit b3b2c26
Show file tree
Hide file tree
Showing 31 changed files with 767 additions and 204 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ _site/

# MSTest test Results
[Tt]est[Rr]esult*/
[Pp]erf[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Akka.Persistence.Azure

Update this readme file with your details.
**Currently not released**

We're still in the process of developing a high-throughput journal and snapshot store system around Azure Table and Blob storage. We expect this to be released soon, however.

## Building this solution
To run the build script associated with this solution, execute the following:
Expand Down Expand Up @@ -49,4 +51,4 @@ If you add any new projects to the solution created with this template, be sure

```
<Import Project="..\common.props" />
```
```
4 changes: 2 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#### 0.1.0 August 14 2017 ####
First release
#### 0.1.0 July 12 2019 ####
**Beta Release of Akka.Persistence.Azure**
8 changes: 8 additions & 0 deletions build-system/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Azure Pipelines Build Files
These `.yaml` files are used by Windows Azure DevOps Pipelines to help execute the following types of builds:

- Pull request validation on Linux (Mono / .NET Core)
- Pull request validation on Windows (.NET Framework / .NET Core)
- NuGet releases with automatic release notes posted to a Github Release repository.

**NOTE**: you will need to change some of the pipeline variables inside the `windows-release.yaml` for your specific project and you will also want to create variable groups with your signing and NuGet push information.
47 changes: 47 additions & 0 deletions build-system/azure-pipeline.template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
parameters:
name: ''
vmImage: ''
scriptFileName: ''
scriptArgs: 'all'
timeoutInMinutes: 120

jobs:
- job: ${{ parameters.name }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
pool:
vmImage: ${{ parameters.vmImage }}
steps:
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
clean: false # whether to fetch clean each time
submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
persistCredentials: true
# Linux or macOS
- task: Bash@3
displayName: Linux / OSX Build
inputs:
filePath: ${{ parameters.scriptFileName }}
arguments: ${{ parameters.scriptArgs }}
continueOnError: true
condition: in( variables['Agent.OS'], 'Linux', 'Darwin' )
env:
AZURE_CONNECTION_STR: $(azureConnectionString)
# Windows
- task: BatchScript@1
displayName: Windows Build
inputs:
filename: ${{ parameters.scriptFileName }}
arguments: ${{ parameters.scriptArgs }}
continueOnError: true
condition: eq( variables['Agent.OS'], 'Windows_NT' )
env:
AZURE_CONNECTION_STR: $(azureConnectionString)
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx' #TestResults folder usually
testRunTitle: ${{ parameters.name }}
mergeTestResults: true
- script: 'echo 1>&2'
failOnStderr: true
displayName: 'If above is partially succeeded, then fail'
condition: eq(variables['Agent.JobStatus'], 'SucceededWithIssues')
22 changes: 22 additions & 0 deletions build-system/linux-pr-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Pull request validation for Linux against the `dev` and `master` branches
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference
trigger:
branches:
include:
- dev
- master

name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)

pr:
autoCancel: true # indicates whether additional pushes to a PR should cancel in-progress runs for the same PR. Defaults to true
branches:
include: [ dev, master ] # branch names which will trigger a build

jobs:
- template: azure-pipeline.template.yaml
parameters:
name: Ubuntu
vmImage: 'ubuntu-16.04'
scriptFileName: ./build.sh
scriptArgs: all
22 changes: 22 additions & 0 deletions build-system/windows-pr-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Pull request validation for Windows against the `dev` and `master` branches
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference
trigger:
branches:
include:
- dev
- master

pr:
autoCancel: true # indicates whether additional pushes to a PR should cancel in-progress runs for the same PR. Defaults to true
branches:
include: [ dev, master ] # branch names which will trigger a build

name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)

jobs:
- template: azure-pipeline.template.yaml
parameters:
name: Windows
vmImage: 'vs2017-win2016'
scriptFileName: build.cmd
scriptArgs: all
38 changes: 38 additions & 0 deletions build-system/windows-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Release task for PbLib projects
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference

pool:
vmImage: vs2017-win2016
demands: Cmd

trigger:
branches:
include:
- refs/tags/*

variables:
- group: Signing Keys #create this group with SECRET variables `signingUsername` and `signingPassword`
- group: NuGet Keys #create this group with SECRET variables `nugetKey`
- name: githubConnectionName
value: Releases #replace this
- name: projectName
value: Akka.Persistence.Azure #replace this
- name: githubRepositoryName
value: petabridge/Akka.Persistence.Azure #replace this

steps:
- task: BatchScript@1
displayName: 'FAKE Build'
inputs:
filename: build.cmd
arguments: 'All SignClientUser=$(signingUsername) SignClientSecret=$(signingPassword) nugetpublishurl=https://www.nuget.org/api/v2/package nugetkey=$(Akka.NET Tools NuGet)'

- task: GitHubRelease@0
displayName: 'GitHub release (create)'
inputs:
gitHubConnection: $(githubConnectionName)
repositoryName: $(githubRepositoryName)
title: '$(projectName) v$(Build.SourceBranchName)'
releaseNotesFile: 'RELEASE_NOTES.md'
assets: |
bin\nuget\*.nupkg
146 changes: 96 additions & 50 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ open Fake.DocFxHelper

// Information about the project for Nuget and Assembly info files
let product = "Akka.Persistence.Azure"
let authors = [ "Your name here" ]
let copyright = "Copyright © 2017"
let company = "Your name here"
let description = "Your description here"
let tags = ["";]
let configuration = "Release"

// Metadata used when signing packages and DLLs
let signingName = "Akka.Persistence.Azure"
let signingDescription = "Akka.Persistence.Azure library for use with Akka.NET."
let signingUrl = "https://devops.petabridge.com/"

// Read release notes and version
let solutionFile = FindFirstMatchingFile "*.sln" __SOURCE_DIRECTORY__ // dynamically look up the solution
let buildNumber = environVarOrDefault "BUILD_NUMBER" "0"
let hasTeamCity = (not (buildNumber = "0")) // check if we have the TeamCity environment variable for build # set
let preReleaseVersionSuffix = (if (not (buildNumber = "0")) then (buildNumber) else "") + "-beta"
let preReleaseVersionSuffix = "beta" + (if (not (buildNumber = "0")) then (buildNumber) else DateTime.UtcNow.Ticks.ToString())
let versionSuffix =
match (getBuildParam "nugetprerelease") with
| "dev" -> preReleaseVersionSuffix
Expand All @@ -45,6 +45,9 @@ let workingDir = output @@ "build"
let nugetExe = FullName @"./tools/nuget.exe"

Target "Clean" (fun _ ->
ActivateFinalTarget "KillCreatedProcesses"


CleanDir output
CleanDir outputTests
CleanDir outputPerfTests
Expand All @@ -57,13 +60,6 @@ Target "AssemblyInfo" (fun _ ->
XmlPokeInnerText "./src/common.props" "//Project/PropertyGroup/PackageReleaseNotes" (releaseNotes.Notes |> String.concat "\n")
)

Target "RestorePackages" (fun _ ->
DotNetCli.Restore
(fun p ->
{ p with
Project = solutionFile
NoCache = false })
)

Target "Build" (fun _ ->
DotNetCli.Build
Expand Down Expand Up @@ -104,8 +100,8 @@ Target "RunTests" (fun _ ->
let runSingleProject project =
let arguments =
match (hasTeamCity) with
| true -> (sprintf "xunit -c Release -nobuild -parallel none -teamcity -xml %s_xunit.xml" (outputTests @@ fileNameWithoutExt project))
| false -> (sprintf "xunit -c Release -nobuild -parallel none -xml %s_xunit.xml" (outputTests @@ fileNameWithoutExt project))
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none -teamcity" (outputTests))
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none" (outputTests))

let result = ExecProcess(fun info ->
info.FileName <- "dotnet"
Expand All @@ -119,39 +115,74 @@ Target "RunTests" (fun _ ->
)

Target "NBench" <| fun _ ->
let nbenchTestPath = findToolInSubPath "NBench.Runner.exe" (toolsDir @@ "NBench.Runner*")
printfn "Using NBench.Runner: %s" nbenchTestPath

let nbenchTestAssemblies = !! "./src/**/*Tests.Performance.dll" // doesn't support .NET Core at the moment

let runNBench assembly =
let includes = getBuildParam "include"
let excludes = getBuildParam "exclude"
let teamcityStr = (getBuildParam "teamcity")
let enableTeamCity =
match teamcityStr with
| null -> false
| "" -> false
| _ -> bool.Parse teamcityStr

let args = StringBuilder()
|> append assembly
|> append (sprintf "output-directory=\"%s\"" outputPerfTests)
|> append (sprintf "concurrent=\"%b\"" true)
|> append (sprintf "trace=\"%b\"" true)
|> append (sprintf "teamcity=\"%b\"" enableTeamCity)
|> appendIfNotNullOrEmpty includes "include="
|> appendIfNotNullOrEmpty excludes "include="
|> toText

let result = ExecProcess(fun info ->
info.FileName <- nbenchTestPath
info.WorkingDirectory <- (Path.GetDirectoryName (FullName nbenchTestPath))
info.Arguments <- args) (System.TimeSpan.FromMinutes 45.0) (* Reasonably long-running task. *)
if result <> 0 then failwithf "NBench.Runner failed. %s %s" nbenchTestPath args
let projects =
match (isWindows) with
| true -> !! "./src/**/*.Tests.Performance.csproj"
| _ -> !! "./src/**/*.Tests.Performance.csproj" // if you need to filter specs for Linux vs. Windows, do it here


let runSingleProject project =
let arguments =
match (hasTeamCity) with
| true -> (sprintf "nbench --nobuild --teamcity --concurrent true --trace true --output %s" (outputPerfTests))
| false -> (sprintf "nbench --nobuild --concurrent true --trace true --output %s" (outputPerfTests))

let result = ExecProcess(fun info ->
info.FileName <- "dotnet"
info.WorkingDirectory <- (Directory.GetParent project).FullName
info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0)

ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.DontFailBuild result

nbenchTestAssemblies |> Seq.iter runNBench
projects |> Seq.iter runSingleProject

//--------------------------------------------------------------------------------
// Code signing targets
//--------------------------------------------------------------------------------
Target "SignPackages" (fun _ ->
let canSign = hasBuildParam "SignClientSecret" && hasBuildParam "SignClientUser"
if(canSign) then
log "Signing information is available."

let assemblies = !! (outputNuGet @@ "*.nupkg")

let signPath =
let globalTool = tryFindFileOnPath "SignClient.exe"
match globalTool with
| Some t -> t
| None -> if isWindows then findToolInSubPath "SignClient.exe" "tools/signclient"
elif isMacOS then findToolInSubPath "SignClient" "tools/signclient"
else findToolInSubPath "SignClient" "tools/signclient"

let signAssembly assembly =
let args = StringBuilder()
|> append "sign"
|> append "--config"
|> append (__SOURCE_DIRECTORY__ @@ "appsettings.json")
|> append "-i"
|> append assembly
|> append "-r"
|> append (getBuildParam "SignClientUser")
|> append "-s"
|> append (getBuildParam "SignClientSecret")
|> append "-n"
|> append signingName
|> append "-d"
|> append signingDescription
|> append "-u"
|> append signingUrl
|> toText

let result = ExecProcess(fun info ->
info.FileName <- signPath
info.WorkingDirectory <- __SOURCE_DIRECTORY__
info.Arguments <- args) (System.TimeSpan.FromMinutes 5.0) (* Reasonably long-running task. *)
if result <> 0 then failwithf "SignClient failed.%s" args

assemblies |> Seq.iter (signAssembly)
else
log "SignClientSecret not available. Skipping signing"
)

//--------------------------------------------------------------------------------
// Nuget targets
Expand Down Expand Up @@ -221,6 +252,19 @@ Target "DocFx" (fun _ ->
DocFxJson = docsPath @@ "docfx.json" })
)

//--------------------------------------------------------------------------------
// Cleanup
//--------------------------------------------------------------------------------

FinalTarget "KillCreatedProcesses" (fun _ ->
log "Shutting down dotnet build-server"
let result = ExecProcess(fun info ->
info.FileName <- "dotnet"
info.WorkingDirectory <- __SOURCE_DIRECTORY__
info.Arguments <- "build-server shutdown") (System.TimeSpan.FromMinutes 2.0)
if result <> 0 then failwithf "dotnet build-server shutdown failed"
)

//--------------------------------------------------------------------------------
// Help
//--------------------------------------------------------------------------------
Expand All @@ -233,6 +277,7 @@ Target "Help" <| fun _ ->
" Targets for building:"
" * Build Builds"
" * Nuget Create and optionally publish nugets packages"
" * SignPackages Signs all NuGet packages, provided that the following arguments are passed into the script: SignClientSecret={secret} and SignClientUser={username}"
" * RunTests Runs tests"
" * All Builds, run tests, creates and optionally publish nuget packages"
" * DocFx Creates a DocFx-based website for this solution"
Expand All @@ -250,16 +295,17 @@ Target "All" DoNothing
Target "Nuget" DoNothing

// build dependencies
"Clean" ==> "RestorePackages" ==> "AssemblyInfo" ==> "Build" ==> "BuildRelease"
"Clean" ==> "AssemblyInfo" ==> "Build" ==> "BuildRelease"

// tests dependencies
"Clean" ==> "Build" ==> "RunTests"

// nuget dependencies
"Clean" ==> "RestorePackages" ==> "Build" ==> "CreateNuget"
"CreateNuget" ==> "PublishNuget" ==> "Nuget"
"Clean" ==> "Build" ==> "CreateNuget"
"CreateNuget" ==> "SignPackages" ==> "PublishNuget" ==> "Nuget"

// docs
"BuildRelease" ==> "Docfx"
"Clean" ==> "BuildRelease" ==> "Docfx"

// all
"BuildRelease" ==> "All"
Expand Down
Loading

0 comments on commit b3b2c26

Please sign in to comment.