Skip to content

Commit a67a5f0

Browse files
author
Will Binns-Smith
authored
Run Rust tests and cache Cargo+yarn dependencies in CI (#6204)
* Run cargo fetch and test in CI * Cache cargo and yarn dependencies in CI
1 parent c8e3747 commit a67a5f0

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

azure-pipelines-template.yml

+28-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ jobs:
99
node_14_x:
1010
node_version: 14.x
1111
maxParallel: 3
12+
variables:
13+
# From https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops
14+
CARGO_HOME: $(Pipeline.Workspace)/.cargo
15+
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
1216
steps:
1317
- task: NodeTool@0
1418
inputs:
@@ -39,9 +43,32 @@ jobs:
3943
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p;
4044
displayName: Bump max inotify watches
4145
46+
# From https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops
47+
- task: Cache@2
48+
inputs:
49+
key: 'cargo | "$(Agent.OS)" | Cargo.lock'
50+
restoreKeys: |
51+
cargo | "$(Agent.OS)"
52+
cargo
53+
path: $(CARGO_HOME)
54+
displayName: Cache Cargo directory
55+
# Like yarn --frozen-lockfile, fails immediately if lockfile needs updates
56+
- script: cargo fetch --locked
57+
displayName: 'Fetch cargo dependencies'
58+
- script: cargo test --all
59+
displayName: 'Run Rust tests'
60+
61+
# From https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops
62+
- task: Cache@2
63+
inputs:
64+
key: 'yarn | "$(Agent.OS)" | yarn.lock'
65+
restoreKeys: |
66+
yarn | "$(Agent.OS)"
67+
yarn
68+
path: $(YARN_CACHE_FOLDER)
69+
displayName: Cache yarn directory
4270
- script: node scripts/link-native.js
4371
displayName: 'Link native dependencies'
44-
4572
# use `--frozen-lockfile` to fail immediately if the committed yarn.lock needs updates
4673
# https://yarnpkg.com/lang/en/docs/cli/install/#toc-yarn-install-frozen-lockfile
4774
- script: yarn --frozen-lockfile

0 commit comments

Comments
 (0)