1313
1414env :
1515 NXF_ANSI_LOG : false
16- NFTEST_VER : " 0.8.1"
16+ NFT_VER : " 0.8.4"
17+ NFT_WORKDIR : " ~"
18+ NFT_DIFF : " pdiff"
19+ NFT_DIFF_ARGS : " --line-numbers --expand-tabs=2"
1720
1821concurrency :
1922 group : " ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
@@ -24,64 +27,110 @@ jobs:
2427 name : Check for changes
2528 runs-on : ubuntu-latest
2629 outputs :
27- # Expose matched filters as job 'tags' output variable
28- tags : ${{ steps.filter .outputs.changes }}
30+ changes : ${{ steps.changed_files.outputs.any_modified }}
31+ tags : ${{ steps.list .outputs.tags }}
2932 steps :
33+ - uses : actions/setup-python@v4
34+ with :
35+ python-version : " 3.11"
36+ architecture : " x64"
37+
3038 - uses : actions/checkout@v3
31- - name : Combine all tags.yml files
32- id : get_username
33- run : find . -name "tags.yml" -not -path "./.github/*" -exec cat {} + > .github/tags.yml
34- - name : debug
35- run : cat .github/tags.yml
36- - uses : dorny/paths-filter@v2
37- id : filter
3839 with :
39- filters : " .github/tags.yml "
40+ fetch-depth : 0
4041
41- define_nxf_versions :
42- name : Choose nextflow versions to test against depending on target branch
43- runs-on : ubuntu-latest
44- outputs :
45- matrix : ${{ steps.nxf_versions.outputs.matrix }}
46- steps :
47- - id : nxf_versions
42+ - uses : tj-actions/changed-files@v42
43+ id : changed_files
44+ with :
45+ dir_names : " true"
46+ output_renamed_files_as_deleted_and_added : " true"
47+ # Define list of additional rules for testing paths
48+ # Mostly, we define additional 'pipeline' or 'all' tests here
49+ files_yaml : |
50+ ".":
51+ - .github/workflows/**
52+ - nf-test.config
53+ - nextflow.config
54+ tests:
55+ - assets/*
56+ - bin/*
57+ - conf/*
58+ - main.nf
59+ - nextflow_schema.json
60+
61+ files_ignore : |
62+ .git*
63+ .gitpod.yml
64+ .prettierignore
65+ .prettierrc.yml
66+ **.md
67+ **.png
68+ modules.json
69+ pyproject.toml
70+ tower.yml
71+
72+ - name : debug
4873 run : |
49- if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "dev" && "${{ matrix.NXF_VER }}" != "latest-everything" ]]; then
50- echo matrix='["latest-everything"]' | tee -a $GITHUB_OUTPUT
51- else
52- echo matrix='["latest-everything", "23.04.0"]' | tee -a $GITHUB_OUTPUT
53- fi
74+ echo ${{ steps.changed_files.outputs.any_modified }}
75+ echo ${{ steps.changed_files.outputs.all_changed_files }}
76+ echo ${{ steps.changed_files.outputs.changed_keys }}
77+
78+ - name : nf-test list tags
79+ id : list
80+ if : ${{ steps.changed_files.outputs.any_modified }}
81+ run : |
82+ echo tags=$(python \
83+ .github/python/find_changed_files.py \
84+ -t pipeline workflow process \
85+ -p ${{ steps.changed_files.outputs.all_changed_files }} ${{ steps.changed_files.outputs.changed_keys }} \
86+ ) >> $GITHUB_OUTPUT
87+
88+ - name : debug2
89+ run : |
90+ echo ${{ steps.list.outputs.tags }}
5491
5592 test :
56- name : ${{ matrix.tags }} ${{ matrix.profile }} NF ${{ matrix.NXF_VER }}
57- needs : [changes, define_nxf_versions ]
58- if : needs.changes.outputs.tags != '[]'
93+ name : ${{ matrix.tags }} ${{ matrix.profile }} NF- ${{ matrix.NXF_VER }}
94+ needs : [changes]
95+ if : needs.changes.outputs.changes
5996 runs-on : ubuntu-latest
6097 strategy :
6198 fail-fast : false
6299 matrix :
63- NXF_VER : ${{ fromJson(needs.define_nxf_versions.outputs.matrix) }}
100+ NXF_VER :
101+ - " latest-everything"
102+ - " 23.04"
64103 tags : ["${{ fromJson(needs.changes.outputs.tags) }}"]
65104 profile :
66105 - " docker"
67106
68107 steps :
69108 - name : Check out pipeline code
70- uses : actions/checkout@v3
109+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
71110
72111 - name : Install Nextflow
73- uses : nf-core/setup-nextflow@v1
112+ uses : nf-core/setup-nextflow@b9f764e8ba5c76b712ace14ecbfcef0e40ae2dd8 # v1
74113 with :
75114 version : " ${{ matrix.NXF_VER }}"
76115
116+ - uses : actions/setup-python@v4
117+ with :
118+ python-version : " 3.11"
119+ architecture : " x64"
120+
121+ - name : Install pdiff to see diff between nf-test snapshots
122+ run : |
123+ python -m pip install --upgrade pip
124+ pip install pdiff
125+
77126 - name : Cache nf-test installation
78127 id : cache-software
79128 uses : actions/cache@v3
80129 with :
81130 path : |
82131 /usr/local/bin/nf-test
83132 /home/runner/.nf-test/nf-test.jar
84- key : ${{ runner.os }}-${{ env.NFTEST_VER }}-nftest
133+ key : ${{ runner.os }}-${{ env.NFT_VER }}-nftest
85134
86135 - name : Install nf-test
87136 if : steps.cache-software.outputs.cache-hit != 'true'
@@ -91,7 +140,12 @@ jobs:
91140
92141 - name : Run nf-test
93142 run : |
94- nf-test test --tag ${{ matrix.tags }} --profile "test,${{ matrix.profile }}" --junitxml=test.xml
143+ nf-test test --verbose --tag ${{ matrix.tags }} --profile "+${{ matrix.profile }}" --junitxml=test.xml --tap=test.tap
144+
145+ - uses : pcolby/tap-summary@v1
146+ with :
147+ path : >-
148+ test.tap
95149
96150 - name : Output log on failure
97151 if : failure()
@@ -104,3 +158,23 @@ jobs:
104158 if : always() # always run even if the previous step fails
105159 with :
106160 report_paths : test.xml
161+
162+ confirm-pass :
163+ runs-on : ubuntu-latest
164+ needs :
165+ - changes
166+ - test
167+ if : always()
168+ steps :
169+ - name : All tests ok
170+ if : ${{ !contains(needs.*.result, 'failure') }}
171+ run : exit 0
172+ - name : One or more tests failed
173+ if : ${{ contains(needs.*.result, 'failure') }}
174+ run : exit 1
175+
176+ - name : debug-print
177+ if : always()
178+ run : |
179+ echo "toJSON(needs) = ${{ toJSON(needs) }}"
180+ echo "toJSON(needs.*.result) = ${{ toJSON(needs.*.result) }}"
0 commit comments