Skip to content

Commit

Permalink
fix: prevent "invalid directive" warning (#78)
Browse files Browse the repository at this point in the history
* fix: prevent "invalid directive" warning

* ci: fix codecov input name

* ci: update codecov action

* ci: add fossa check to CI
  • Loading branch information
Shadow53 authored Jan 27, 2022
1 parent 1e54a7b commit 05d3320
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ jobs:
pytests:
- 'ci-tests/**'
fossa:
name: Fossa License Check
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.cargo == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v2

- uses: fossa-contrib/fossa-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Push-only API key
fossa-api-key: 7b6d2d5fb78bb718019e16184020ef6d

fmt:
name: Cargo fmt
runs-on: ubuntu-latest
Expand Down Expand Up @@ -123,16 +138,16 @@ jobs:

- name: Run grcov
run: |
grcov profraw/*.profraw --binary-path target/debug/ \
grcov profraw/*.profraw --binary-path target/debug \
-s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov \
--excl-br-line "($EXCLUDE_DERIVE|$EXCLUDE_PANICS|$EXCLUDE_TRACING|$EXCLUDE_PROPAGATE_ERROR|$EXCLUDE_MANUAL|$EXCLUDE_LONE_CLOSING_BRACE)" \
--excl-line "($EXCLUDE_DERIVE|$EXCLUDE_PANICS|$EXCLUDE_TRACING|$EXCLUDE_PROPAGATE_ERROR|$EXCLUDE_MANUAL|$EXCLUDE_LONE_CLOSING_BRACE)" \
--excl-br-start "(grcov: ignore-start|mod tests)" --excl-start "(grcov: ignore-start|mod tests)" \
--excl-br-stop "grcov: ignore-end" --excl-stop "grcov: ignore-end"
env:
RUSTFLAGS: "-Zinstrument-coverage"
LLVM_PROFILE_FILE: "default.profraw"
RUSTUP_TOOLCHAIN: "nightly"
RUSTC_BOOTSTRAP: "1"
RUSTUP_TOOLCHAIN: "stable"
HOARD_LOG: "trace"
EXCLUDE_DERIVE: "#\\[derive\\("
EXCLUDE_PANICS: "panic!|todo!|unimplemented!"
Expand All @@ -143,7 +158,7 @@ jobs:


- name: Upload to codecov.io
uses: codecov/codecov-action@v1.0.2
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.lcov
Expand Down
10 changes: 9 additions & 1 deletion ci-tests/tests/testers/correct_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ def _run_warn_on_invalid_uuid(self):
assert self.uuid != invalid_id
assert b'failed to parse uuid in file' in result.stdout

def _run_no_invalid_filter_directive(self):
self.reset()
self.env = {"HOARD_LOG": None}
result = self.run_hoard("validate", capture_output=True)
expected = b"ignoring ``: invalid filter directive"
assert result.stderr is None or expected not in result.stderr
assert result.stdout is None or expected not in result.stdout

def _run_invalid_config_extension(self):
self.reset()
expected_text = b"configuration file must have file extension \""
Expand Down Expand Up @@ -67,4 +75,4 @@ def run_test(self):
self._run_warn_on_invalid_uuid()
self._run_invalid_config_extension()
self._run_missing_config()

self._run_no_invalid_filter_directive()
5 changes: 4 additions & 1 deletion ci-tests/tests/testers/hoard_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ def run_hoard(self, command, allow_failure=False, capture_output=False):
# Run the specified hoard command
# Should automatically operate on all hoards when targets is empty
for key, val in self.env.items():
os.environ[key] = val
if val is None:
del os.environ[key]
else:
os.environ[key] = val

args = ["target/debug/hoard"]
if self.force:
Expand Down
2 changes: 1 addition & 1 deletion src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ pub fn get_subscriber() -> impl Subscriber {
};

let env_filter = EnvFilter::try_from_env(LOG_ENV)
.unwrap_or_else(|_| EnvFilter::new("").add_directive(max_level.into()));
.unwrap_or_else(|_| EnvFilter::default().add_directive(max_level.into()));

FmtSubscriber::builder()
.with_env_filter(env_filter)
Expand Down

0 comments on commit 05d3320

Please sign in to comment.