Skip to content

Commit

Permalink
Merge pull request mimblewimble#97 from quentinlesceller/azure-pipelines
Browse files Browse the repository at this point in the history
Add Azure Pipelines to grin-wallet
  • Loading branch information
quentinlesceller authored May 9, 2019
2 parents 26c9fad + 9aca9b2 commit baff170
Show file tree
Hide file tree
Showing 6 changed files with 219 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .ci/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
steps:
- script: |
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
choco install -y llvm
displayName: Windows Install Rust
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
displayName: macOS Install Rust
condition: eq( variables['Agent.OS'], 'Darwin' )
- script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
displayName: Linux Install Rust and Dependencies
condition: eq( variables['Agent.OS'], 'Linux' )
50 changes: 50 additions & 0 deletions .ci/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
steps:
- script: 'cargo test --all'
displayName: Cargo Test All
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- script: 'cargo build --release'
displayName: Build Release
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- script: |
MY_TAG="$(Build.SourceBranch)"
MY_TAG=${MY_TAG#refs/tags/}
echo $MY_TAG
echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG"
echo "##vso[task.setvariable variable=build.platform]$PLATFORM"
displayName: "Create my tag variable"
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- task: CopyFiles@2
displayName: Copy assets
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
inputs:
sourceFolder: '$(Build.SourcesDirectory)/target/release'
contents: 'grin-wallet'
targetFolder: '$(Build.BinariesDirectory)/grin-wallet'
- task: ArchiveFiles@2
displayName: Gather assets
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)/grin-wallet'
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)/grin-wallet-$(build.my_tag)-$(build.platform).tar.gz'
- script: |
openssl sha256 $(Build.ArtifactStagingDirectory)/grin-wallet-$(build.my_tag)-$(build.platform).tar.gz > $(Build.ArtifactStagingDirectory)/grin-wallet-$(build.my_tag)-$(build.platform)-sha256sum.txt
displayName: Create Checksum
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- task: GithubRelease@0
displayName: Github release
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
inputs:
gitHubConnection: 'ignopeverell'
repositoryName: 'mimblewimble/grin-wallet'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(build.my_tag)'
assets: |
$(Build.ArtifactStagingDirectory)/grin-wallet-$(build.my_tag)-$(build.platform).tar.gz
$(Build.ArtifactStagingDirectory)/grin-wallet-$(build.my_tag)-$(build.platform)-sha256sum.txt
title: '$(build.my_tag)'
assetUploadMode: 'replace'
addChangeLog: true
10 changes: 10 additions & 0 deletions .ci/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
steps:
- script: 'cargo test --all'
displayName: Windows Cargo Test
condition: and(eq( variables['Agent.OS'], 'Windows_NT' ), eq( variables['CI_JOB'], 'test-all' ))
- script: 'cargo test --all'
displayName: macOS Cargo Test
condition: and(eq( variables['Agent.OS'], 'Darwin' ), eq( variables['CI_JOB'], 'test-all' ))
- script: '.ci/general-jobs'
displayName: Linux Cargo Test
condition: eq( variables['Agent.OS'], 'Linux' )
50 changes: 50 additions & 0 deletions .ci/windows-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
steps:
- script: 'cargo test --all'
displayName: Cargo Test All
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- script: 'cargo build --release'
displayName: Build Release
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- script: |
SET MY_TAG=$(Build.SourceBranch)
SET MY_TAG=%MY_TAG:~10%
echo %MY_TAG%
echo %PLATFORM%
echo ##vso[task.setvariable variable=build.my_tag]%MY_TAG%
echo ##vso[task.setvariable variable=build.platform]%PLATFORM%
displayName: "Create my tag variable"
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- task: CopyFiles@2
displayName: Copy assets
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
inputs:
sourceFolder: '$(Build.SourcesDirectory)\target\release'
contents: 'grin-wallet.exe'
targetFolder: '$(Build.BinariesDirectory)\grin-wallet'
- task: ArchiveFiles@2
displayName: Gather assets
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)\grin-wallet'
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)\grin-wallet-$(build.my_tag)-$(build.platform).zip'
- script: |
powershell -Command "get-filehash -algorithm sha256 $(Build.ArtifactStagingDirectory)\grin-wallet-$(build.my_tag)-$(build.platform).zip | Format-List |  Out-String | ForEach-Object { $_.Trim() } > $(Build.ArtifactStagingDirectory)\grin-wallet-$(build.my_tag)-$(build.platform)-sha256sum.txt"
displayName: Create Checksum
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- task: GithubRelease@0
displayName: Github release
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
inputs:
gitHubConnection: 'ignopeverell'
repositoryName: 'mimblewimble/grin-wallet'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(build.my_tag)'
assets: |
$(Build.ArtifactStagingDirectory)\grin-wallet-$(build.my_tag)-$(build.platform).zip
$(Build.ArtifactStagingDirectory)\grin-wallet-$(build.my_tag)-$(build.platform)-sha256sum.txt
title: '$(build.my_tag)'
assetUploadMode: 'replace'
addChangeLog: true
79 changes: 79 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright 2019 The Grin Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

trigger:
branches:
include:
- master
tags:
include: ['*']

pr:
branches:
include: ['*']

variables:
RUST_BACKTRACE: '1'
RUST_FLAGS: '-C debug-assertions'

jobs:
- job: linux
pool:
vmImage: ubuntu-16.04
strategy:
matrix:
config/libwallet/api:
CI_JOB: test
CI_JOB_ARGS: config libwallet api
impls:
CI_JOB: test
CI_JOB_ARGS: impls
controller/all:
CI_JOB: test
CI_JOB_ARGS: controller .
release:
CI_JOB: release
PLATFORM: linux-amd64
steps:
- template: '.ci/install.yml'
- template: '.ci/test.yml'
- template: '.ci/release.yml'
- job: macos
pool:
vmImage: macos-10.13
strategy:
matrix:
test:
CI_JOB: test-all
release:
CI_JOB: release
PLATFORM: macos
steps:
- template: '.ci/install.yml'
- template: '.ci/test.yml'
- template: '.ci/release.yml'
- job: windows
pool:
vmImage: vs2017-win2016
strategy:
matrix:
test:
CI_JOB: test-all
release:
CI_JOB: release
PLATFORM: win-x64
steps:
- template: '.ci/install.yml'
- template: '.ci/test.yml'
- template: '.ci/windows-release.yml'
12 changes: 12 additions & 0 deletions controller/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ pub fn outputs(
account, cur_height
);
println!();
if term::stdout().is_none() {
println!("Could not open terminal");
return Ok(());
}
let mut t = term::stdout().unwrap();
t.fg(term::color::MAGENTA).unwrap();
writeln!(t, "{}", title).unwrap();
Expand Down Expand Up @@ -132,6 +136,10 @@ pub fn txs(
account, cur_height
);
println!();
if term::stdout().is_none() {
println!("Could not open terminal");
return Ok(());
}
let mut t = term::stdout().unwrap();
t.fg(term::color::MAGENTA).unwrap();
writeln!(t, "{}", title).unwrap();
Expand Down Expand Up @@ -409,6 +417,10 @@ pub fn accounts(acct_mappings: Vec<AcctPathMapping>) {
pub fn tx_messages(tx: &TxLogEntry, dark_background_color_scheme: bool) -> Result<(), Error> {
let title = format!("Transaction Messages - Transaction '{}'", tx.id,);
println!();
if term::stdout().is_none() {
println!("Could not open terminal");
return Ok(());
}
let mut t = term::stdout().unwrap();
t.fg(term::color::MAGENTA).unwrap();
writeln!(t, "{}", title).unwrap();
Expand Down

0 comments on commit baff170

Please sign in to comment.