Skip to content

Commit

Permalink
Cache cargo build to speed things up
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Jan 29, 2024
1 parent 56f24d4 commit cc4a6d8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
24 changes: 9 additions & 15 deletions azure-pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ jobs:
- script: dotnet nbgv cloud -c
displayName: ⚙ Set build number

- pwsh: src/nerdbank-zcash-rust/build_all.ps1 -Release
displayName: 🛠️ cargo build
- pwsh: cargo test -r --target x86_64-pc-windows-msvc
displayName: 🧪 cargo test
workingDirectory: src/nerdbank-zcash-rust
- template: cargo.yml
parameters:
test_target: x86_64-pc-windows-msvc

- template: dotnet.yml
parameters:
Expand All @@ -45,11 +43,9 @@ jobs:

- template: install-dependencies.yml

- pwsh: src/nerdbank-zcash-rust/build_all.ps1 -Release
displayName: 🛠️ cargo build
- pwsh: cargo test -r --target x86_64-unknown-linux-gnu
displayName: 🧪 cargo test
workingDirectory: src/nerdbank-zcash-rust
- template: cargo.yml
parameters:
test_target: x86_64-unknown-linux-gnu

- template: dotnet.yml
parameters:
Expand All @@ -70,11 +66,9 @@ jobs:

- template: install-dependencies.yml

- pwsh: src/nerdbank-zcash-rust/build_all.ps1 -Release
displayName: 🛠️ cargo build
- pwsh: cargo test -r --target x86_64-apple-darwin
displayName: 🧪 cargo test
workingDirectory: src/nerdbank-zcash-rust
- template: cargo.yml
parameters:
test_target: x86_64-apple-darwin

- template: dotnet.yml
parameters:
Expand Down
21 changes: 21 additions & 0 deletions azure-pipelines/cargo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
parameters:
- name: test_target

steps:
- task: Cache@2
inputs:
key: '"cargo" | "$(Agent.OS)"' # | src/nerdbank-zcash-rust/cargoTomlTargets/**/Cargo.lock'
path: $(Build.SourcesDirectory)/src/nerdbank-zcash-rust/target
displayName: cache cargo build
# - task: Cache@2
# inputs:
# key: '"cargo-registry" | "$(Agent.OS)"' # | src/nerdbank-zcash-rust/cargoTomlTargets/**/Cargo.lock'
# path: $(HOME)/.cargo/registry
# displayName: cache cargo registry

- pwsh: src/nerdbank-zcash-rust/build_all.ps1 -Release
displayName: 🛠️ cargo build
- pwsh: cargo test -r --target ${{ parameters.test_target }}
displayName: 🧪 cargo test
workingDirectory: src/nerdbank-zcash-rust
condition: and(succeeded(), ne('${{ parameters.test_target }}', ''))

0 comments on commit cc4a6d8

Please sign in to comment.