CI: Fetch and cache Sapling parameters for tests

This commit is contained in:
Jack Grigg 2020-06-26 12:48:44 +12:00
parent 9012672164
commit bbc3ec54c7
5 changed files with 27 additions and 20 deletions

View File

@ -50,6 +50,21 @@ jobs:
with: with:
toolchain: 1.40.0 toolchain: 1.40.0
override: true override: true
- name: Fetch path to Zcash parameters
working-directory: ./zcash_proofs
run: echo "::set-env name=ZCASH_PARAMS::$(cargo run --release --example get-params-path --features directories)"
- name: Cache Zcash parameters
id: cache-params
uses: actions/cache@v2
with:
path: ${{ env.ZCASH_PARAMS }}
key: ${{ runner.os }}-params
- name: Fetch Zcash parameters
if: steps.cache-params.outputs.cache-hit != 'true'
working-directory: ./zcash_proofs
run: cargo run --release --example download-params --features download-params
- name: cargo fetch - name: cargo fetch
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:

View File

@ -1,19 +0,0 @@
language: rust
rust:
- 1.40.0
cache: cargo
before_script:
- rustup component add rustfmt
script:
- cargo build --verbose --release --all
- cargo fmt --all -- --check
- cargo test --verbose --release --all
- cargo test --verbose --release --all -- --ignored
before_cache:
- rm -rf "$TRAVIS_HOME/.cargo/registry/src"
- cargo install cargo-update || echo "cargo-update already installed"
- cargo install-update -a # update outdated cached binaries

View File

@ -31,6 +31,10 @@ download-params = ["minreq"]
local-prover = ["directories"] local-prover = ["directories"]
multicore = ["bellman/multicore"] multicore = ["bellman/multicore"]
[[example]]
name = "get-params-path"
required-features = ["directories"]
[[example]] [[example]]
name = "download-params" name = "download-params"
required-features = ["download-params"] required-features = ["download-params"]

View File

@ -0,0 +1,7 @@
fn main() {
if let Some(path) = zcash_proofs::default_params_folder() {
if let Some(path) = path.to_str() {
println!("{}", path);
}
}
}

View File

@ -39,7 +39,7 @@ const DOWNLOAD_URL: &str = "https://download.z.cash/downloads";
/// Returns the default folder that the Zcash proving parameters are located in. /// Returns the default folder that the Zcash proving parameters are located in.
#[cfg(feature = "directories")] #[cfg(feature = "directories")]
fn default_params_folder() -> Option<PathBuf> { pub fn default_params_folder() -> Option<PathBuf> {
BaseDirs::new().map(|base_dirs| { BaseDirs::new().map(|base_dirs| {
if cfg!(any(windows, target_os = "macos")) { if cfg!(any(windows, target_os = "macos")) {
base_dirs.data_dir().join("ZcashParams") base_dirs.data_dir().join("ZcashParams")