trigger:
branches:
include: ['*']
tags:
include: ['*']
strategy:
matrix:
windows-stable:
imageName: 'vs2017-win2016'
target: 'x86_64-pc-windows-msvc'
rustup_toolchain: stable
mac-stable:
imageName: 'macos-10.13'
target: 'x86_64-apple-darwin'
rustup_toolchain: stable
linux-stable:
imageName: 'ubuntu-16.04'
target: 'x86_64-unknown-linux-gnu'
rustup_toolchain: stable
pool:
vmImage: $(imageName)
steps:
- script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
displayName: Install rust
condition: ne( variables['Agent.OS'], 'Windows_NT' )
- script: |
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN%
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
displayName: Windows install rust
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- script: cargo build --release
displayName: Cargo build
- script: cargo test
displayName: Cargo test
- bash: |
MY_TAG="$(Build.SourceBranch)"
MY_TAG=${MY_TAG#refs/tags/}
echo $MY_TAG
echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG"
displayName: "Create tag variable"
- bash: |
DATE="$(date +%Y-%m-%d)"
echo "##vso[task.setvariable variable=build.date]$DATE"
displayName: "Create date variable"
- bash: |
echo "##vso[task.setvariable variable=build.binary_name]evtx_dump.exe"
displayName: "Create date variable"
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- bash: |
echo "##vso[task.setvariable variable=build.binary_name]evtx_dump"
displayName: "Create date variable"
condition: ne( variables['Agent.OS'], 'Windows_NT' )
- task: CopyFiles@2
displayName: Copy assets
inputs:
sourceFolder: '$(Build.SourcesDirectory)/target/release'
contents: |
$(build.binary_name)
targetFolder: '$(Build.BinariesDirectory)/$(build.binary_name)'
- task: ArchiveFiles@2
displayName: Gather assets
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)/$(build.binary_name)'
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)/evtx_dump-$(build.my_tag)-$(TARGET).tar.gz'
- task: GithubRelease@0
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
gitHubConnection: 'Github'
repositoryName: 'omerbenamram/evtx'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(build.my_tag)'
assets: '$(Build.ArtifactStagingDirectory)/evtx_dump-$(build.my_tag)-$(TARGET).tar.gz'
title: '$(build.my_tag) - $(build.date)'
assetUploadMode: 'replace'
addChangeLog: false