-
Notifications
You must be signed in to change notification settings - Fork 7
/
azure-pipelines.yml
91 lines (81 loc) · 2.48 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
variables:
- name: RUSTUP_TOOLCHAIN
value: 1.67.0
trigger: none
strategy:
matrix:
linux:
imageName: ubuntu-20.04
binName: git-remote-gosh-linux-amd64
mac:
imageName: macOS-12
binName: git-remote-gosh-darwin-amd64
windows:
imageName: windows-2019
binName: git-remote-gosh-windows-amd64
maxParallel: 3
pool:
vmImage: $(imageName)
steps:
# Pre-requirements
# Linux
- script: |
sudo apt install -y protobuf-compiler
condition: eq( variables['Agent.OS'], 'Linux' )
displayName: Install pre-requirements Linux
# Mac
- script: |
brew install protobuf
condition: eq( variables['Agent.OS'], 'Darwin' )
displayName: Install pre-requirements MacOS
# Windows
- script: |
choco install protoc
condition: eq( variables['Agent.OS'], 'Windows_NT' )
displayName: Install pre-requirements Windows
# Rust setup
# Linux and macOS.
- script: |
set -e
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain $RUSTUP_TOOLCHAIN
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
env:
RUSTUP_TOOLCHAIN: ${{ variables.RUSTUP_TOOLCHAIN }}
displayName: "Install rust (*nix)"
condition: not(eq(variables['Agent.OS'], 'Windows_NT'))
# Windows.
- script: |
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --profile minimal --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"
env:
RUSTUP_TOOLCHAIN: ${{ variables.RUSTUP_TOOLCHAIN }}
displayName: "Install rust (windows)"
condition: eq(variables['Agent.OS'], 'Windows_NT')
# Set correct toolchain
- bash: |
rustup default $RUSTUP_TOOLCHAIN
rustup update $RUSTUP_TOOLCHAIN
env:
RUSTUP_TOOLCHAIN: ${{ variables.RUSTUP_TOOLCHAIN }}
displayName: "Set correct Rust version"
# Build
- bash: |
mkdir -p ./resources
cp ../contracts/gosh/*.abi.json ./resources/
workingDirectory: v2_x/git-remote-gosh
displayName: Prepare
- script: |
cargo build --release
workingDirectory: v2_x/git-remote-gosh
displayName: Build
# Publish
# Linux and macOS.
- publish: ./v2_x/git-remote-gosh/target/release/git-remote-gosh
artifact: $(binName)
condition: not(eq(variables['Agent.OS'], 'Windows_NT'))
# Windows
- publish: ./v2_x/git-remote-gosh/target/release/git-remote-gosh.exe
artifact: $(binName).exe
condition: eq(variables['Agent.OS'], 'Windows_NT')