GitHub actions: Runs rustfmt and Clippy

pull/22/head
Tpt 5 years ago
parent 05a32f7d7a
commit 70f5c25a88
  1. 26
      .github/workflows/build.yml
  2. 3
      lib/src/sparql/algebra.rs
  3. 12
      lib/tests/sparql_test_cases.rs

@ -3,13 +3,29 @@ name: build
on: [push, pull_request]
jobs:
build:
fmt:
name: fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: rustup component add rustfmt
- run: cargo fmt -- --check
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: rustup component add clippy
- run: cargo clippy --all --all-targets
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- run: cargo build
- run: cargo test --verbose --all
env:
RUST_BACKTRACE: 1

@ -770,9 +770,10 @@ impl<'a> fmt::Display for SparqlGraphPattern<'a> {
SparqlGraphPattern(&*a),
SparqlGraphPattern(&*b),
),
#[rustfmt::skip] // TODO: Discrepancy between the latest cargo fmt and the one on GitHub CI
GraphPattern::Graph(g, p) => {
write!(f, "GRAPH {} {{ {} }}", g, SparqlGraphPattern(&*p),)
}
},
GraphPattern::Extend(p, v, e) => write!(
f,
"{} BIND({} AS {})",

@ -28,12 +28,12 @@ fn sparql_w3c_syntax_testsuite() -> Result<()> {
for test_result in manifest_10_urls
.into_iter()
.chain(manifest_11_urls.into_iter())
.flat_map(|manifest| TestManifest::new(manifest))
.flat_map(TestManifest::new)
{
let test = test_result.unwrap();
if test.kind == "PositiveSyntaxTest" || test.kind == "PositiveSyntaxTest11" {
match Query::parse(&read_file_to_string(&test.query)?, Some(&test.query)) {
Err(error) => assert!(false, "Failure on {} with error: {}", test, error),
Err(error) => panic!("Failure on {} with error: {}", test, error),
Ok(query) => {
if let Err(error) = Query::parse(&query.to_string(), None) {
assert!(
@ -53,7 +53,7 @@ fn sparql_w3c_syntax_testsuite() -> Result<()> {
eprintln!("Failure on {}. The output tree is: {}", test, result);
}
} else if test.kind != "QueryEvaluationTest" {
assert!(false, "Not supported test: {}", test);
panic!("Not supported test: {}", test);
}
}
Ok(())
@ -144,7 +144,7 @@ fn sparql_w3c_query_evaluation_testsuite() -> Result<()> {
let tests: Result<Vec<_>> = manifest_10_urls
.into_iter()
.chain(manifest_11_urls.into_iter())
.flat_map(|manifest| TestManifest::new(manifest))
.flat_map(TestManifest::new)
.collect();
let failed: Vec<_> = tests?.into_par_iter().map(|test| {
if test_blacklist.contains(&test.id) {
@ -514,7 +514,7 @@ impl Iterator for TestManifest {
.graph
.object_for_subject_predicate(&test_subject, &rdf::TYPE)
{
Some(Term::NamedNode(c)) => match c.as_str().split("#").last() {
Some(Term::NamedNode(c)) => match c.as_str().split('#').last() {
Some(k) => k.to_string(),
None => return self.next(), //We ignore the test
},
@ -618,7 +618,7 @@ impl Iterator for TestManifest {
NamedOrBlankNode::from(NamedNode::parse(url.clone()).unwrap());
match load_graph(&url) {
Ok(g) => self.graph.extend(g.into_iter()),
Err(e) => return Some(Err(e.into())),
Err(e) => return Some(Err(e)),
}
// New manifests

Loading…
Cancel
Save