Skip to content

Commit

Permalink
Update krates to 0.2.0 (#130)
Browse files Browse the repository at this point in the history
* Update krates to 0.2.0
* Add check script for external repos
* Check external repos in CI
* Update CHANGELOG
  • Loading branch information
Jake-Shadle authored Feb 5, 2020
1 parent e540885 commit 3b7efcf
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 21 deletions.
32 changes: 17 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
args: -- --ignored

self:
name: Self Check
name: Check Users
strategy:
matrix:
os: [ubuntu-latest]
Expand Down Expand Up @@ -106,6 +106,8 @@ jobs:
with:
command: deny
args: -L debug check
- name: check external users
run: ./scripts/check_external.sh

# Build `mdBook` documentation and upload it as a temporary build artifact
doc-book:
Expand All @@ -127,20 +129,20 @@ jobs:
name: Publish Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: cargo publish
uses: actions-rs/cargo@v1
with:
command: publish
args: --dry-run
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: cargo publish
uses: actions-rs/cargo@v1
with:
command: publish
args: --dry-run

release:
name: Release
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/target
**/*.rs.bk
/examples/06_advisories/target
/examples/06_advisories/target
scripts/check
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- The configuration used for the command is recursively searched for in parent directories starting in the same directory as the `Cargo.toml` (unless explicitly specified).
- The target list used when evaluating cfg expressions for dependencies has been updated to the list of targets supported by 1.41.0. This will give undesired behavior if you happen to use a target triple that has been removed from 1.41.0 that is available in the Rust version you have.

### Fixed
- Resolved [#122](https://github.com/EmbarkStudios/cargo-deny/issues/122) by pruning the packages that are checked against the advisory database to the same set used by all other checks
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ crossbeam = "0.7.3"
erased-serde = "0.3.9"
fern = "0.5.9"
home = "0.5.3"
krates = "0.1.0"
krates = "0.2.0"
log = "0.4.8"
parking_lot = "0.10.0"
rayon = "1.3.0"
Expand Down
90 changes: 90 additions & 0 deletions scripts/check_external.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
const REPOS: &[&str] = &[
"git://github.com/EmbarkStudios/ash-molten.git",
"git://github.com/EmbarkStudios/cargo-about.git",
//"git://github.com/EmbarkStudios/cargo-fetcher.git",
"git://github.com/bitshifter/glam-rs.git",
"git://github.com/EmbarkStudios/physx-rs.git",
"git://github.com/gwihlidal/smush-rs.git",
"git://github.com/EmbarkStudios/tame-gcs.git",
"git://github.com/EmbarkStudios/tame-oauth.git",
"git://github.com/EmbarkStudios/texture-synthesis.git",
"git://github.com/hyperium/tonic.git",
];

fn main() {
use std::process::Command;

let td = std::env::temp_dir().join("deny-repos");
// This kind of doesn't work on windows!
if td.exists() {
std::fs::remove_dir_all(&td).unwrap();
}
std::fs::create_dir_all(&td).unwrap();

let (tx, rx) = std::sync::mpsc::channel();

for repo in REPOS {
let tx = tx.clone();
let td = td.clone();
std::thread::spawn(move || {
let repo_name = &repo[repo.rfind('/').unwrap() + 1..];
let repo_dir = td.join(repo_name);

println!("cloning {}", repo);

match Command::new("git")
.arg("clone")
.arg(repo)
.arg(&repo_dir)
.output()
{
Ok(out) => {
if !out.status.success() {
let err_str = String::from_utf8(out.stderr)
.unwrap_or_else(|e| format!("git err output has bad utf8: {}", e));
tx.send(Some((repo, err_str))).unwrap();
return;
}
}
Err(e) => {
tx.send(Some((repo, format!("failed to spawn git clone: {}", e))))
.unwrap();
return;
}
};

println!("checking {}", repo);

match Command::new("cargo")
.args(&["deny", "-L", "debug", "check"])
.current_dir(repo_dir)
.output()
{
Ok(out) => {
if !out.status.success() {
let err_str = String::from_utf8(out.stderr)
.unwrap_or_else(|e| format!("deny err output has bad utf8: {}", e));
tx.send(Some((repo, err_str))).unwrap();
}
}
Err(e) => {
tx.send(Some((repo, format!("failed to spawn cargo deny: {}", e))))
.unwrap();
}
}
});
}

drop(tx);

let mut code = 0;
while let Ok(bad) = rx.recv() {
if let Some((repo, output)) = bad {
code = 1;

eprintln!("failed {}:\n{}", repo, output);
}
}

std::process::exit(code);
}
6 changes: 6 additions & 0 deletions scripts/check_external.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -eu

dir=$(dirname "${BASH_SOURCE[0]}")
rustc -g -o "${dir}/check" "${dir}/check_external.rs"
"${dir}/check"

0 comments on commit 3b7efcf

Please sign in to comment.