Skip to content

Commit

Permalink
CI: Fetch and cache Sapling parameters for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
str4d committed Jun 26, 2020
1 parent 9012672 commit bbc3ec5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 20 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -50,6 +50,21 @@ jobs:
with:
toolchain: 1.40.0
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
uses: actions-rs/cargo@v1
with:
Expand Down
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions zcash_proofs/Cargo.toml
Expand Up @@ -31,6 +31,10 @@ download-params = ["minreq"]
local-prover = ["directories"]
multicore = ["bellman/multicore"]

[[example]]
name = "get-params-path"
required-features = ["directories"]

[[example]]
name = "download-params"
required-features = ["download-params"]
Expand Down
7 changes: 7 additions & 0 deletions zcash_proofs/examples/get-params-path.rs
@@ -0,0 +1,7 @@
fn main() {
if let Some(path) = zcash_proofs::default_params_folder() {
if let Some(path) = path.to_str() {
println!("{}", path);
}
}
}
2 changes: 1 addition & 1 deletion zcash_proofs/src/lib.rs
Expand Up @@ -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.
#[cfg(feature = "directories")]
fn default_params_folder() -> Option<PathBuf> {
pub fn default_params_folder() -> Option<PathBuf> {
BaseDirs::new().map(|base_dirs| {
if cfg!(any(windows, target_os = "macos")) {
base_dirs.data_dir().join("ZcashParams")
Expand Down

0 comments on commit bbc3ec5

Please sign in to comment.