Commit 4c577689 authored by Jens Getreu's avatar Jens Getreu

add continuous delivery pipeline

parent f2d0f482
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/rust/tags/
image: "rust:latest"
# Optional: Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
#services:
# - mysql:latest
# - redis:latest
# - postgres:latest
# Optional: Install a C compiler, cmake and git into the container.
# You will often need this when you (or any of your dependencies) depends on C code.
#before_script:
#- apt-get update -yqq
#- apt-get install -yqq --no-install-recommends build-essential
# Use cargo to test the project
test:cargo:
script:
- rustc --version && cargo --version # Print version info for debugging
- cargo test --all --verbose
language: rust
rust:
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
trigger:
branches:
include: ['*']
tags:
include: ['*']
stages:
- stage: Tests
jobs:
- job:
strategy:
matrix:
windows-stable:
imageName: 'vs2017-win2016'
rustup_toolchain: stable
mac-stable:
imageName: 'macos-10.14'
rustup_toolchain: stable
linux-stable:
imageName: 'ubuntu-16.04'
rustup_toolchain: stable
linux-1.39:
imageName: 'ubuntu-16.04'
rustup_toolchain: 1.39.0
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% --default-host x86_64-pc-windows-msvc
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
displayName: Windows install rust
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- script: cargo build --all
displayName: Cargo build
- script: cargo test --all
displayName: Cargo test
- stage: Release
dependsOn: Tests
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
jobs:
- job:
strategy:
matrix:
windows-stable:
imageName: 'vs2017-win2016'
rustup_toolchain: stable
target: 'x86_64-pc-windows-msvc'
mac-stable:
imageName: 'macos-10.14'
rustup_toolchain: stable
target: 'x86_64-apple-darwin'
linux-stable:
imageName: 'ubuntu-16.04'
rustup_toolchain: stable
target: 'x86_64-unknown-linux-gnu'
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: |
set CARGO_HOME=%USERPROFILE%\.cargo
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN% --default-host x86_64-pc-windows-msvc
set PATH=%PATH%;%USERPROFILE%\.cargo\bin
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
displayName: Windows install rust
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- script: |
rustup target add $TARGET
cargo build --release --target $TARGET
condition: ne( variables['Agent.OS'], 'Windows_NT' )
displayName: Build
- script: |
rustup target add %TARGET%
cargo build --release --target %TARGET%
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Build on Windows
- script: |
strip "$(Build.SourcesDirectory)/target/$(TARGET)/release/stringsext"
condition: eq( variables['Agent.OS'], 'Linux' )
displayName: Strip debug symbols
- task: [email protected]
displayName: Copy assets
condition: ne( variables['Agent.OS'], 'Windows_NT' )
inputs:
sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
contents: stringsext
targetFolder: '$(Build.BinariesDirectory)/'
- task: [email protected]
displayName: Copy assets on Windows
condition: eq( variables['Agent.OS'], 'Windows_NT' )
inputs:
sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release'
contents: stringsext.exe
targetFolder: '$(Build.BinariesDirectory)/'
- task: [email protected]
displayName: Gather assets
condition: ne( variables['Agent.OS'], 'Windows_NT' )
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)/stringsext'
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)/stringsext-$(Build.SourceBranchName)-$(TARGET).tar.gz'
- task: [email protected]
displayName: Gather assets
condition: eq( variables['Agent.OS'], 'Windows_NT' )
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)/stringsext.exe'
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/stringsext-$(Build.SourceBranchName)-$(TARGET).zip'
- task: [email protected]
condition: ne( variables['Agent.OS'], 'Windows_NT' )
inputs:
gitHubConnection: 'github.com_getreu'
repositoryName: 'getreu/stringsext'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(Build.SourceBranchName)'
assets: '$(Build.ArtifactStagingDirectory)/stringsext-$(Build.SourceBranchName)-$(TARGET).tar.gz'
title: '$(Build.SourceBranchName)'
assetUploadMode: 'replace'
addChangeLog: true
- task: [email protected]
condition: eq( variables['Agent.OS'], 'Windows_NT' )
inputs:
gitHubConnection: 'github.com_getreu'
repositoryName: 'getreu/stringsext'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(Build.SourceBranchName)'
assets: '$(Build.ArtifactStagingDirectory)/stringsext-$(Build.SourceBranchName)-$(TARGET).zip'
title: '$(Build.SourceBranchName)'
assetUploadMode: 'replace'
addChangeLog: true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment