Skip to content

Commit

Permalink
Merge pull request #46 from 2gis/ci/scripts
Browse files Browse the repository at this point in the history
Add CI scripts
  • Loading branch information
NickAb committed Aug 31, 2015
2 parents a75fb7a + a0f6140 commit 509045d
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 2 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

<!--## Unreleased-->

## v1.2.0

New features:
- Support Action Chains from bindings
- Add new script command for setting value to element using ValuePattern
Expand Down
47 changes: 47 additions & 0 deletions scripts/ci-release.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
#------------------------------

Import-Module '.\setup.ps1' -Args (,('git', 'versioning', 'changelog', 'msbuild', 'nunit', 'github'))

$version = $env:release_version
$description = $env:release_description

# Git checkout master
Invoke-Git ('checkout', 'master') -Verbose

# Update AssembyInfo
Update-AssemblyInfo $assemblyInfoPath $version -Verbose

# Update CHANGELOG.md
Update-Changelog $changelogPath $version $description -Verbose

# Build
Invoke-MSBuild $solution $msbuildProperties -Verbose

# Test
Start-Process $driverMerged -RedirectStandardError $errorLog -RedirectStandardOutput $outputLog
Invoke-NUnit $testFiles -Verbose
& taskkill ('/im', 'Winium.Desktop.Driver.exe', '/f')

# Prepare release artifacts
New-Item -ItemType directory -Path $releaseDir | Out-Null
Add-Type -assembly "system.io.compression.filesystem"
$driverMergedPath = Split-Path $driverMerged
[IO.Compression.ZipFile]::CreateFromDirectory($driverMergedPath, "$releaseDir/Winium.Desktop.Driver.zip")

# Git add changes
Invoke-Git ('add', $assemblyInfoPath) -Verbose
Invoke-Git ('add', $changelogPath) -Verbose

# Git commit and push
Invoke-GitCommit "Version $version" -Verbose
Invoke-Git ('push', 'origin', 'master') -Verbose

# Git tag and push
$buildUrl = $env:BUILD_URL
Invoke-GitTag "Version '$version'. Build url '$buildUrl'." "v$version" -Verbose
Invoke-Git ('push', 'origin', 'master', "v$version") -Verbose

# Create github release
Invoke-CreateGitHubRelease '2gis' $githubProjectName $version $description $releaseDir -Verbose
17 changes: 17 additions & 0 deletions scripts/ci.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
#------------------------------

Import-Module '.\setup.ps1' -Args (,('msbuild', 'nunit'))

# Build
Invoke-MSBuild $solution $msbuildProperties -Verbose

# Test
Start-Process $driverMerged -RedirectStandardError $errorLog -RedirectStandardOutput $outputLog
Invoke-NUnit $testFiles -Verbose
& taskkill ('/im', 'Winium.Desktop.Driver.exe', '/f')

# Artifacts
New-Item -ItemType directory -Path $artifactsDir | Out-Null
Copy-Item -Path ($errorLog, $outputLog) -Destination $artifactsDir
33 changes: 33 additions & 0 deletions scripts/prepare-release.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
#------------------------------

Import-Module '.\setup.ps1' -Args (,('msbuild', 'nunit'))

if (Test-Path $releaseDir)
{
Remove-Item $releaseDir -Force -Recurse
}

New-Item -ItemType directory -Path $releaseDir | Out-Null

Write-Output "Update CHANGELOG.md"
Write-Output "Update version in Assemblies"

Pause

# Build
Invoke-MSBuild $solution $msbuildProperties -Verbose

# Test
Start-Process $driverMerged -RedirectStandardError $errorLog -RedirectStandardOutput $outputLog
Invoke-NUnit $testFiles -Verbose
& taskkill ('/im', 'Winium.Desktop.Driver.exe', '/f')

# Pack driver
Add-Type -assembly "system.io.compression.filesystem"
$driverMergedPath = Split-Path $driverMerged
[IO.Compression.ZipFile]::CreateFromDirectory($driverMergedPath, "$releaseDir/Winium.Desktop.Driver.zip")

Write-Output "Add and push tag using git tag -a -m 'Version *.*.*' v*.*.*"
Write-Output "Upload and attach $releaseDir\* files to release"
36 changes: 36 additions & 0 deletions scripts/setup.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Param(
[string[]]$modules
)

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
#------------------------------

$configuration = 'Release'
$solution = Join-Path $PSScriptRoot '..\src\Winium.sln'
$testFiles = ,"..\src\TestApps.Tests\WindowsFormsTestApplication.Tests\bin\$configuration\WindowsFormsTestApplication.Tests.dll"
$testFiles += "..\src\TestApps.Tests\WpfTestApplication.Tests\bin\$configuration\WpfTestApplication.Tests.dll"
$releaseDir = Join-Path $PSScriptRoot '..\Release'
$artifactsDir = Join-Path $PSScriptRoot '..\Artifacts'
$driverMerged = "..\src\Winium.Desktop.Driver\bin\$configuration\Merge\Winium.Desktop.Driver.exe"
$errorLog = 'error.log'
$outputLog = 'output.log'
$assemblyInfoPath = Join-Path $PSScriptRoot '..\src\Winium.Desktop.Driver\Properties\AssemblyInfo.cs'
$changelogPath = Join-Path $PSScriptRoot '..\CHANGELOG.md'
$githubProjectName = 'Winium.Desktop.Driver'

$msbuildProperties = @{
'Configuration' = $configuration
}

$modulesUrl = 'https://raw.githubusercontent.com/skyline-gleb/dev-help/v0.2.0/psm'

if (!(Get-Module -ListAvailable -Name PsGet))
{
(new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
}

foreach ($module in $modules)
{
Install-Module -ModuleUrl "$modulesUrl/$module.psm1" -Update
}
5 changes: 3 additions & 2 deletions src/Winium.Desktop.Driver/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.*")]
[assembly: AssemblyInformationalVersion("1.2.0")]

0 comments on commit 509045d

Please sign in to comment.