-
Notifications
You must be signed in to change notification settings - Fork 206
Add offline configs test action #3524
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8bb8ba5
add offline configs test
mashehu 95a50c7
[automated] Update CHANGELOG.md
nf-core-bot 17b08b7
Merge branch 'dev' into add-offline-config-tester
mashehu 4994ece
Apply suggestions from code review
mashehu ff3a11d
Merge branch 'dev' into add-offline-config-tester
mashehu 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 hidden or 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,158 @@ | ||
name: Sync template | ||
on: | ||
# schedule: | ||
# # once a month | ||
# - cron: "0 0 1 * *" | ||
workflow_dispatch: | ||
inputs: | ||
testpipeline: | ||
type: boolean | ||
description: Only run on nf-core/testpipeline? | ||
required: true | ||
force_pr: | ||
description: "Force a PR to be created" | ||
type: boolean | ||
default: false | ||
mashehu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pipeline: | ||
description: "Pipeline to sync" | ||
mashehu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type: string | ||
default: "all" | ||
debug: | ||
description: "Enable debug/verbose mode (true or false)" | ||
mashehu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type: boolean | ||
default: false | ||
|
||
# Cancel if a newer run is started | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
get-pipelines: | ||
runs-on: "ubuntu-latest" | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- id: set-matrix | ||
run: | | ||
if [ "${{ github.event.inputs.testpipeline }}" == "true" ]; then | ||
echo '{"pipeline":["testpipeline"]}' > pipeline_names.json | ||
elif [ "${{ github.event.inputs.pipeline }}" != "all" ] && [ "${{ github.event.inputs.pipeline }}" != "" ]; then | ||
curl -O https://nf-co.re/pipeline_names.json | ||
# check if the pipeline exists | ||
if ! grep -q "\"${{ github.event.inputs.pipeline }}\"" pipeline_names.json; then | ||
echo "Pipeline ${{ github.event.inputs.pipeline }} does not exist" | ||
exit 1 | ||
fi | ||
echo '{"pipeline":["${{ github.event.inputs.pipeline }}"]}' > pipeline_names.json | ||
else | ||
curl -O https://nf-co.re/pipeline_names.json | ||
fi | ||
echo "matrix=$(cat pipeline_names.json)" >> $GITHUB_OUTPUT | ||
|
||
test_offline_configs: | ||
needs: get-pipelines | ||
runs-on: "ubuntu-latest" | ||
strategy: | ||
matrix: ${{fromJson(needs.get-pipelines.outputs.matrix)}} | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | ||
name: Check out nf-core/tools | ||
with: | ||
ref: ${{ github.ref_name }} | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | ||
name: Check out nf-core/${{ matrix.pipeline }} | ||
with: | ||
repository: nf-core/${{ matrix.pipeline }} | ||
ref: dev | ||
token: ${{ secrets.nf_core_bot_auth_token }} | ||
path: nf-core/${{ matrix.pipeline }} | ||
fetch-depth: "0" | ||
- name: Check the correct default config base of the nf-core configs | ||
id: check_default_config | ||
uses: GuillaumeFalourd/assert-command-line-output@v2 | ||
with: | ||
command_line: nextflow config -value params.custom_config_base . | ||
contains: https://raw.githubusercontent.com/nf-core/configs/master | ||
expected_result: PASSED | ||
- name: Check the correct inclusion of an existing institutional profile | ||
id: check_profile_inclusion | ||
uses: GuillaumeFalourd/assert-command-line-output@v2 | ||
with: | ||
command_line: nextflow config -profile google -o flat . # We will hopefully always have this profile in configs, even if some HPCs are retired. | ||
mashehu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
contains: "The nf-core framework" # Part of the citation, should always be printed if profile is included | ||
mashehu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
expected_result: PASSED | ||
- name: Check the failed inclusion of a non-existing institutional profile | ||
id: check_nonexistent_profile | ||
uses: GuillaumeFalourd/assert-command-line-output@v2 | ||
with: | ||
command_line: nextflow config -profile GLaDOS -o flat . | ||
contains: "Unknown configuration profile: 'GLaDOS'" | ||
expected_result: PASSED | ||
- name: Check that offline prevents inclusion of nf-core configs | ||
id: check_offline_mode | ||
uses: GuillaumeFalourd/assert-command-line-output@v2 | ||
env: | ||
NXF_OFFLINE: true | ||
with: | ||
command_line: nextflow config -profile google -o flat . | ||
contains: "Unknown configuration profile: 'google'" | ||
expected_result: PASSED | ||
|
||
- name: Create Issue on Test Failure | ||
if: ${{ failure() }} | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.nf_core_bot_auth_token }} | ||
script: | | ||
const testNames = [ | ||
{ id: 'check_default_config', name: 'Default config base check' }, | ||
{ id: 'check_profile_inclusion', name: 'Institutional profile inclusion check' }, | ||
{ id: 'check_nonexistent_profile', name: 'Non-existent profile check' }, | ||
{ id: 'check_offline_mode', name: 'Offline mode check' } | ||
]; | ||
|
||
// Get list of failed steps | ||
const failedTests = testNames.filter(test => | ||
context.job.steps[test.id] && context.job.steps[test.id].outcome === 'failure' | ||
).map(test => test.name); | ||
|
||
const issueTitle = '⚠️ Config test failures detected'; | ||
|
||
// Check if there's already an open issue with the same title | ||
const existingIssues = await github.rest.issues.listForRepo({ | ||
owner: 'nf-core', | ||
repo: '${{ matrix.pipeline }}', | ||
state: 'open', | ||
creator: 'nf-core-bot' | ||
}); | ||
|
||
const duplicateIssue = existingIssues.data.find(issue => | ||
issue.title === issueTitle | ||
); | ||
|
||
if (duplicateIssue) { | ||
console.log(`Issue already exists: ${duplicateIssue.html_url}`); | ||
|
||
} else { | ||
# // Create a new issue | ||
# await github.rest.issues.create({ | ||
# owner: 'nf-core', | ||
# repo: '${{ matrix.pipeline }}', | ||
# title: issueTitle, | ||
# body: `## Config Test Failures | ||
|
||
# The following config tests failed in the GitHub Actions workflow: | ||
|
||
# ${failedTests.map(test => `- ${test}`).join('\n')} | ||
|
||
# ### Workflow Details: | ||
# - Workflow: ${context.workflow} | ||
# - Run ID: ${context.runId} | ||
# - Branch: ${context.ref} | ||
|
||
# Please check the [workflow run](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) for more details.` | ||
# }); | ||
console.log(`failed tests: ${failedTests}`); | ||
} |
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.