diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml new file mode 100644 index 0000000..008c857 --- /dev/null +++ b/.ci/azure-pipelines.yml @@ -0,0 +1,39 @@ +trigger: + batch: true + branches: + include: [master] # branch names which will trigger a build +pr: + autoCancel: true + branches: + include: [master] + +jobs: +- job: test + displayName: Typecheck & test + pool: + vmImage: ubuntu-16.04 + steps: + - script: | + curl https://sh.rustup.rs -sSf | sh -s -- -y + echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" + displayName: Install Rust stable + - script: | + cd binary + cargo check + displayName: cargo check + - script: | + cd binary + cargo test + displayName: cargo test + +- template: .ci/template.yml + parameters: + name: Linux + vmImage: ubuntu-16.04 + target: x86_64-unknown-linux-gnu + +- template: .ci/template.yml + parameters: + name: macOS + vmImage: macOS-10.13 + target: x86_64-apple-darwin diff --git a/.ci/template.yml b/.ci/template.yml new file mode 100644 index 0000000..aa8dda7 --- /dev/null +++ b/.ci/template.yml @@ -0,0 +1,23 @@ +jobs: +- job: ${{ parameters.name }} + condition: eq(variables['build.sourceBranch'], 'refs/heads/master') + dependsOn: test + condition: succeeded() + pool: + vmImage: ${{ parameters.vmImage }} + steps: + #- script: | + # curl https://sh.rustup.rs -sSf | sh -s -- -y + # echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" + # displayName: Install Rust + - ${{ if eq(parameters.name, 'Linux') }}: + - script: cargo build --release --target=${{ parameters.target }} + displayName: Build binary + - script: | + mkdir release + mv target/${{ parameters.target }}/release/sd release/linux-x64 + displayName: Package binary + - task: PublishPipelineArtifact@0 + inputs: + artifactName: Binary for ${{ parameters.name }} + targetPath: release/