-
Notifications
You must be signed in to change notification settings - Fork 8
82 lines (73 loc) · 2.85 KB
/
validate_external_data.yml
File metadata and controls
82 lines (73 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Validate External Data
on:
pull_request:
paths:
- "R/**"
- "data-raw/**"
- "inst/extdata/**"
- ".github/workflows/update_external_data.yml"
- ".github/workflows/validate_external_data.yml"
workflow_dispatch:
jobs:
validate-external-data:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: "release"
use-public-rspm: true
- name: Setup dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgload, any::jsonlite, any::digest, any::gson, any::testthat, bioc::bugsigdbr
- name: Validate Disbiome builder with fixtures
run: >
Rscript -e 'pkgload::load_all(".");
testthat::test_dir(
"tests/testthat",
filter = "build_disbiome",
reporter = "summary"
)'
- name: Validate eggNOG builder and runtime with fixtures
run: >
Rscript -e 'pkgload::load_all(".");
testthat::test_dir(
"tests/testthat",
filter = "build_eggnog|enrichEggNOG_external",
reporter = "summary"
)'
- name: Build BugSigDB artifact
run: >
Rscript -e 'source("data-raw/build_bugsigdb.R");
build_bugsigdb_artifact(
output_dir = "build/external-data/bugsigdb/current",
base_url = "https://yulab-smu.github.io/MicrobiomeProfiler/datasets/bugsigdb/current"
)'
- name: Validate manifests and artifacts
run: >
Rscript -e 'manifests <- list.files("build/external-data",
pattern = "manifest.json$", recursive = TRUE, full.names = TRUE);
stopifnot(length(manifests) >= 1);
for (path in manifests) {
manifest <- jsonlite::fromJSON(path, simplifyVector = FALSE);
stopifnot(!is.null(manifest$dataset), !is.null(manifest$version),
length(manifest$artifact_files) >= 1);
artifact <- manifest$artifact_files[[1]];
artifact_path <- file.path(dirname(path), artifact$name);
stopifnot(file.exists(artifact_path));
stopifnot(identical(
digest::digest(file = artifact_path, algo = "sha256", serialize = FALSE),
artifact$sha256
));
object <- readRDS(artifact_path);
if (identical(artifact$object_type, "gson")) {
stopifnot(inherits(object, "GSON"));
} else if (identical(artifact$object_type, "term2gene_bundle")) {
stopifnot(all(c("dataset", "version", "term2gene", "term2name", "metadata") %in% names(object)));
} else {
stop("Unsupported object_type: ", artifact$object_type);
}
}'