Skip to content

Commit

Permalink
Mostly fix coverage workflow & other minor tweaks (#82)
Browse files Browse the repository at this point in the history
* Bump timeout for coverage runs

* Switch submodule to apertium org

* Bump reset duration to 10m in future

* Tweak some names

* Add --debug

* Try downgrading

* Exclude rlx

* Why did I ever enable this???
  • Loading branch information
sushain97 authored Mar 13, 2021
1 parent 9d8e370 commit 7cbfb9d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
uses: actions-rs/[email protected]
with:
version: "0.16.0"
args: --out Lcov
args: --out Lcov --timeout 120 --exclude-files src/stats/tree-sitter-apertium/*
- name: Upload coverage
uses: coverallsapp/github-action@master
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "src/stats/tree-sitter-apertium"]
path = src/stats/tree-sitter-apertium
url = git@github.com:mr-martian/tree-sitter-apertium.git
url = https://github.com/apertium/tree-sitter-apertium.git
2 changes: 0 additions & 2 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
condense_wildcard_suffixes = true
match_block_trailing_comma = true
imports_granularity = "Crate"
report_fixme = "Unnumbered"
report_todo = "Unnumbered"
unstable_features = true
use_field_init_shorthand = true
use_try_shorthand = true
Expand Down
8 changes: 4 additions & 4 deletions src/stats/lexd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ pub fn get_stats(_logger: &Logger, body: &str) -> Result<Vec<(StatKind, JsonValu
let mut walker: TreeCursor = tree.root_node().walk();

for child in tree.root_node().children(&mut walker) {
let mut walker2: TreeCursor = child.walk();
let mut child_walker: TreeCursor = child.walk();
if child.kind() == "pattern_block" {
if child.child(0).unwrap().kind() == "pattern_start" {
if child.child(0).map(|node| node.kind()) == Some("pattern_start") {
patterns.insert("");
}
for line in child.children(&mut walker2) {
for line in child.children(&mut child_walker) {
if line.kind() == "pattern_line" {
pat_entries += 1;
} else if line.kind() == "identifier" {
patterns.insert(&body[line.byte_range()]);
}
}
} else if child.kind() == "lexicon_block" {
for line in child.children(&mut walker2) {
for line in child.children(&mut child_walker) {
if line.kind() == "lexicon_line" {
lex_entries += 1;
} else if line.kind() == "identifier" {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ macro_rules! run_test_with_github_auth {

let server = MockServer::start();
for (i, mut listing) in PACKAGE_LISTING.clone().into_iter().enumerate() {
let reset = (Utc::now() + Duration::minutes(2)).format("%FT%TZ").to_string();
let reset = (Utc::now() + Duration::minutes(30)).format("%FT%TZ").to_string();
listing["data"]["rateLimit"]["resetAt"] = json!(&reset).into();

let after = if i == 0 {
Expand Down
5 changes: 5 additions & 0 deletions src/tests/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,13 @@ fn lexd_module_stats() {

#[test]
fn module_specific_stats() {
#[cfg(not(tarpaulin))]
let kinds = [("monodix", 2), ("rlx", 1), ("postdix", 1)];

// TODO: Bring back `rlx` once tarpaulin doesn't sometimes hang on `cg-comp`.
#[cfg(tarpaulin)]
let kinds = [("monodix", 2), ("postdix", 1)];

for (kind, stat_count) in &kinds {
let module = format!("apertium-{}", TEST_LT_MODULE);
let endpoint = format!("/{}/{}?async=false", module, kind);
Expand Down

0 comments on commit 7cbfb9d

Please sign in to comment.