trigger: branches: include: ['*'] tags: include: ['*'] jobs: - job: 'Test' strategy: matrix: windows-stable: imageName: 'vs2017-win2016' rustup_toolchain: stable mac-stable: imageName: 'macos-10.13' rustup_toolchain: stable linux-stable: imageName: 'ubuntu-16.04' rustup_toolchain: stable linux-beta: imageName: 'ubuntu-16.04' rustup_toolchain: beta linux-nightly: imageName: 'ubuntu-16.04' rustup_toolchain: nightly 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 --all displayName: Cargo build - script: cargo test --all displayName: Cargo test - job: 'Cross' strategy: matrix: musl: target: 'x86_64-unknown-linux-musl' imageName: 'ubuntu-16.04' gnu: target: 'x86_64-unknown-linux-gnu' imageName: 'ubuntu-16.04' mac: target: 'x86_64-apple-darwin' imageName: 'macos-10.13' pool: vmImage: $(imageName) steps: - script: | DATE="$(date +%Y-%m-%d)" echo "##vso[task.setvariable variable=build.date]$DATE" displayName: "Create date variable" - script: | 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 my tag variable" - script: | curl https://sh.rustup.rs -sSf | sh -s -- -y echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" displayName: Install rust - script: | set -eou D=$(mktemp -d) git clone https://github.com/rust-embedded/cross.git "$D" cd "$D" curl -O -L "https://gist.githubusercontent.com/nickbabcock/c7bdc8e5974ed9956abf46ffd7dc13ff/raw/e211bc17ea88e505003ad763fac7060b4ac1d8d0/patch" git apply patch cargo install --path . rm -rf "$D" displayName: Install cross - script: cross build --release --all --target $TARGET displayName: Build - task: CopyFiles@2 displayName: Copy assets inputs: sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release' contents: | sd targetFolder: '$(Build.BinariesDirectory)/sd' - task: ArchiveFiles@2 displayName: Gather assets inputs: rootFolderOrFile: '$(Build.BinariesDirectory)/sd' archiveType: 'tar' tarCompression: 'gz' archiveFile: '$(Build.ArtifactStagingDirectory)/sd-$(build.my_tag)-$(TARGET).tar.gz' - task: GithubRelease@0 condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/')) inputs: gitHubConnection: 'chmln' repositoryName: 'chmln/sd' action: 'edit' target: '$(build.sourceVersion)' tagSource: 'manual' tag: '$(build.my_tag)' assets: '$(Build.ArtifactStagingDirectory)/sd-$(build.my_tag)-$(TARGET).tar.gz' title: '$(build.my_tag) - $(build.date)' assetUploadMode: 'replace' addChangeLog: false