-
Notifications
You must be signed in to change notification settings - Fork 734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: Update module_name filter step #7106
Open
edmundmiller
wants to merge
21
commits into
master
Choose a base branch
from
modules_filter_function
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+125
−14
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f2cefbb
ci: Add test cases for lint filter
edmundmiller bff204a
ci: Add second test case
edmundmiller 58b68b7
ci: Add update from 2a35c14b54cacbb77d7f7394d04ebf155ad0a136
edmundmiller 3ad5691
test: Fix asserts
edmundmiller fd04c72
test: Expand to catch any endsWith
edmundmiller 5ec131f
ci: Update module_name filter step
edmundmiller 0bf2a94
Update .github/scripts/get_module_path.js
edmundmiller 43ccceb
ci: Working to avoid source of truth issues
edmundmiller 6ac53bd
ci: Generate two path ways
edmundmiller bdafba2
style: Touch a module
edmundmiller 8c198ef
ci: Fix json encoding error
edmundmiller c6b77a4
ci: Try to get everything wired up
edmundmiller 3466025
ci: Handle json strings properly
edmundmiller 2846b2e
ci: Maybe this will parse the JSON?
edmundmiller b016c5a
ci: Update if check
edmundmiller 759b025
Enhance debugging in get_module_path.js and lint.yml workflow
edmundmiller 4af8e94
fix: Update condition in lint.yml for module file checks
edmundmiller a460e24
ci: Set result correctly
edmundmiller 0327be7
Return the result instead of setting it
edmundmiller 06e885a
Try changing the result-encoding
edmundmiller 8f619f6
Enhance JSON handling and debugging in GitHub Actions
edmundmiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// Test this locally with: | ||
// node .github/scripts/get_module_path.js | ||
|
||
// Core functionality that processes the file paths | ||
function get_module_names(filter_modules_files) { | ||
return [ | ||
...new Set( | ||
filter_modules_files.map((path) => | ||
path | ||
.replace("tests/", "") | ||
.replace("modules/nf-core/", "") | ||
.split("/") | ||
.slice(0, 2) | ||
.filter( | ||
(x) => | ||
!x.startsWith("main.nf") && | ||
x !== "tests" && | ||
x !== "meta.yml" && | ||
x !== "environment.yml" && | ||
!x.endsWith(".snap") && | ||
!x.endsWith(".config") | ||
) | ||
.join("/") | ||
) | ||
), | ||
]; | ||
} | ||
|
||
// GitHub Actions entry point | ||
function run({ github, context }) { | ||
try { | ||
// Debug logging | ||
console.log('Context payload:', context.payload); | ||
console.log('Input files:', context.payload.inputs?.files); | ||
|
||
// Get the files from the context and ensure it's a valid JSON string | ||
let files; | ||
if (typeof context.payload.inputs?.files === "string") { | ||
console.log('Processing string input'); | ||
files = JSON.parse(context.payload.inputs.files); | ||
} else if (Array.isArray(context.payload.inputs?.files)) { | ||
console.log('Processing array input'); | ||
files = context.payload.inputs.files; | ||
} else { | ||
console.log('No valid input found, defaulting to empty array'); | ||
files = []; | ||
} | ||
|
||
console.log('Files to process:', files); | ||
const result = get_module_names(files); | ||
console.log('Processed result:', result); | ||
|
||
// Ensure we're returning a properly formatted JSON string | ||
const jsonResult = JSON.stringify(result); | ||
console.log('Final JSON output:', jsonResult); | ||
return jsonResult; | ||
} catch (error) { | ||
console.error("Error processing module paths:", error); | ||
console.error("Error details:", { | ||
errorName: error.name, | ||
errorMessage: error.message, | ||
errorStack: error.stack | ||
}); | ||
return "[]"; | ||
} | ||
} | ||
|
||
// Test cases | ||
function runTests() { | ||
const test_case_1 = [ | ||
"modules/nf-core/umicollapse/tests/main.nf.test", | ||
"modules/nf-core/umicollapse/tests/main.nf.test.snap", | ||
"modules/nf-core/umicollapse/tests/nextflow.config", | ||
"modules/nf-core/umicollapse/tests/nextflow_PE.config", | ||
"modules/nf-core/umicollapse/tests/nextflow_SE.config", | ||
"modules/nf-core/umitools/dedup/tests/main.nf.test", | ||
"modules/nf-core/umitools/dedup/tests/main.nf.test.snap", | ||
"modules/nf-core/umitools/dedup/main.nf", | ||
]; | ||
const result_1 = ["umicollapse", "umitools/dedup"]; | ||
|
||
const test_case_2 = [ | ||
"modules/nf-core/mafft/align/environment.yml", | ||
"modules/nf-core/mafft/align/main.nf", | ||
"modules/nf-core/mafft/align/meta.yml", | ||
"modules/nf-core/mafft/align/tests/main.nf.test", | ||
"modules/nf-core/mafft/align/tests/main.nf.test.snap", | ||
"modules/nf-core/mafft/guidetree/environment.yml", | ||
"modules/nf-core/mafft/guidetree/main.nf", | ||
"modules/nf-core/mafft/guidetree/meta.yml", | ||
"modules/nf-core/mafft/guidetree/tests/main.nf.test", | ||
"modules/nf-core/mafft/guidetree/tests/main.nf.test.snap", | ||
"tests/modules/nf-core/epang/split/main.nf", | ||
]; | ||
const result_2 = ["mafft/align", "mafft/guidetree", "epang/split"]; | ||
|
||
console.assert(JSON.stringify(get_module_names(test_case_1)) === JSON.stringify(result_1), "Test case 1 failed"); | ||
console.assert(JSON.stringify(get_module_names(test_case_2)) === JSON.stringify(result_2), "Test case 2 failed"); | ||
|
||
console.log("All tests passed!"); | ||
} | ||
|
||
// Handle different execution contexts | ||
if (require.main === module) { | ||
// Script was run directly (node get_module_path.js) | ||
runTests(); | ||
} else { | ||
// Script was imported/required | ||
module.exports = run; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
process { | ||
ext.args = { "--proband earlycasualcaiman --father hugelymodelbat --mother slowlycivilbuck --af-tag AF regions" } | ||
ext.args = { "--proband earlycasualcaiman --father hugelymodelbat --mother slowlycivilbuck --af-tag AF regions" } | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this ended up in the PR, but otherwise that looks good to me.