-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from 2gis/ci/scripts
Add CI scripts
- Loading branch information
Showing
6 changed files
with
145 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters