1
+ version : 2.1
2
+
3
+ # Circle CI dependencies.
4
+ # Rust Orb: https://github.com/CircleCI-Public/rust-orb
5
+ # Github Orb: https://github.com/CircleCI-Public/github-cli-orb
6
+ orbs :
7
+
8
+
9
+
10
+ # We run jobs on the following platforms: linux, macos and windows.
11
+ # These are their specifications:
12
+ executors :
13
+ linux : &linux
14
+ docker :
15
+ - image : cimg/base:stable
16
+ resource_class : medium+
17
+ macos : &macos
18
+ macos :
19
+ xcode : " 11.4"
20
+ windows : &windows
21
+ machine :
22
+ image : ' windows-server-2019-vs2019:stable'
23
+ resource_class : windows.xlarge
24
+ shell : powershell.exe -ExecutionPolicy Bypass
25
+
26
+ # Describes the three jobs we run for apollo-rs: lint and test.
27
+ jobs :
28
+ lint :
29
+ parameters :
30
+ rust_channel :
31
+ type : enum
32
+ enum : ["stable", "nightly"]
33
+ default : stable
34
+ platform :
35
+ type : executor
36
+ executor : << parameters.platform >>
37
+ steps :
38
+ - checkout
39
+ # - restore_cache:
40
+ # keys:
41
+ # - rust-target-v1-{{<< parameters.platform >>}}-{{ checksum "Cargo.lock" }}
42
+ - install_system_deps :
43
+ rust_channel : << parameters.rust_channel >>
44
+ platform : << parameters.platform >>
45
+ # - save_cache:
46
+ # key: rust-target-v1-{{<< parameters.platform >>}}-{{ checksum "Cargo.lock" }}
47
+ # paths:
48
+ # - target/
49
+ - run :
50
+ name : Run cargo clippy
51
+ command : cargo clippy
52
+
53
+ test :
54
+ parameters :
55
+ rust_channel :
56
+ type : enum
57
+ enum : ["stable", "nightly"]
58
+ default : stable
59
+ platform :
60
+ type : executor
61
+ executor : << parameters.platform >>
62
+ steps :
63
+ - checkout
64
+ # - restore_cache:
65
+ # keys:
66
+ # - rust-target-v1-{{<< parameters.platform >>}}-{{ checksum "Cargo.lock" }}
67
+ - install_system_deps :
68
+ rust_channel : << parameters.rust_channel >>
69
+ platform : << parameters.platform >>
70
+ # - save_cache:
71
+ # key: rust-target-v1-{{<< parameters.platform >>}}-{{ checksum "Cargo.lock" }}
72
+ # paths:
73
+ # - target/
74
+ - run :
75
+ name : Run cargo test
76
+ command : cargo test
77
+
78
+ # Workflow consists of running the jobs previously described.
79
+ workflows :
80
+ lint :
81
+ jobs :
82
+ - lint :
83
+ name : Lint
84
+ matrix :
85
+ parameters :
86
+ platform : [linux]
87
+ rust_channel : [stable]
88
+ test :
89
+ jobs :
90
+ - test :
91
+ name : Test (<< matrix.rust_channel >> rust on << matrix.platform >>)
92
+ matrix :
93
+ parameters :
94
+ platform : [linux, macos, windows]
95
+ rust_channel : [stable, nightly]
96
+
97
+
98
+ # The folowing are reusable command snippets can be referred to in any `steps`.
99
+ # Commands we currently have: install_system_deps, install_rust_toolchain.
100
+ commands :
101
+ install_system_deps :
102
+ parameters :
103
+ platform :
104
+ type : executor
105
+ rust_channel :
106
+ type : enum
107
+ enum : ["stable", "nightly"]
108
+ steps :
109
+ - when :
110
+ condition :
111
+ equal : [ *linux, << parameters.platform >> ]
112
+ steps :
113
+ - run :
114
+ name : Update apt repositories
115
+ command : sudo apt-get update
116
+ - run :
117
+ name : Check glibc version
118
+ command : ldd --version
119
+ - run :
120
+ name : Install OpenSSL
121
+ command : sudo apt-get install -y libssl-dev
122
+
123
+ - when :
124
+ condition :
125
+ equal : [ *macos, << parameters.platform >> ]
126
+ steps :
127
+ - run :
128
+ name : Skip homebrew update
129
+ command : echo "HOMEBREW_NO_AUTO_UPDATE=1" >> $BASH_ENV
130
+ - run :
131
+
132
+ command :
brew install [email protected]
133
+
134
+ - install_rust_toolchain :
135
+ rust_channel : << parameters.rust_channel >>
136
+ platform : << parameters.platform >>
137
+
138
+ install_rust_toolchain :
139
+ parameters :
140
+ rust_channel :
141
+ type : enum
142
+ enum : ["stable", "nightly"]
143
+ platform :
144
+ type : executor
145
+ steps :
146
+ - unless :
147
+ condition :
148
+ equal : [ *windows, << parameters.platform >> ]
149
+ steps :
150
+ - rust/install :
151
+ version : << parameters.rust_channel >>
152
+
153
+ - when :
154
+ condition :
155
+ equal : [ *windows, << parameters.platform >> ]
156
+ steps :
157
+ - run :
158
+ name : Install rustup
159
+ environment :
160
+ # Override auto-detection of RAM for rustc install.
161
+ # https://github.com/rust-lang/rustup/issues/2229#issuecomment-585855925
162
+ RUSTUP_UNPACK_RAM : " 21474836480"
163
+ command : |
164
+ $installer_dir = "$Env:TEMP"
165
+ echo "Downloading rustup"
166
+ (New-Object System.Net.WebClient).DownloadFile("https://win.rustup.rs/x86_64", "$installer_dir\rustup-init.exe")
167
+ echo "Installing rustup"
168
+ & $installer_dir\rustup-init.exe --profile minimal -y
169
+ exit $LASTEXITCODE
170
+ - run :
171
+ name : Configure cargo for Windows
172
+ command : |
173
+ Add-Content -path "${Env:USERPROFILE}\.cargo\config.toml" @"
174
+ [net]
175
+ git-fetch-with-cli = true
176
+ "@
0 commit comments