Add wasm sample for CI (#2372)

* Add wasm sample for CI

* Add wasm sample for CI

* Add wasm sample for CI
This commit is contained in:
Jonathan Turner
2020-08-19 07:34:05 +12:00
committed by GitHub
parent 738541f727
commit 43e061f8c6
17 changed files with 492 additions and 17 deletions

View File

@@ -1,4 +1,3 @@
use git2::Repository;
use std::path::Path;
use std::{env, fs, io};
@@ -18,11 +17,20 @@ fn main() -> Result<(), io::Error> {
Ok(())
}
fn latest_commit_hash<P: AsRef<Path>>(dir: P) -> Result<String, git2::Error> {
let dir = dir.as_ref();
Ok(Repository::discover(dir)?
.head()?
.peel_to_commit()?
.id()
.to_string())
#[allow(unused_variables)]
fn latest_commit_hash<P: AsRef<Path>>(dir: P) -> Result<String, Box<dyn std::error::Error>> {
#[cfg(feature = "git2")]
{
use git2::Repository;
let dir = dir.as_ref();
Ok(Repository::discover(dir)?
.head()?
.peel_to_commit()?
.id()
.to_string())
}
#[cfg(not(feature = "git2"))]
{
Ok(String::new())
}
}