Skip to content

Commit 636879c

Browse files
committed
generate nf-test snapshot for testing if not present
1 parent 2be2850 commit 636879c

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

.github/workflows/create-test-lint-wf-template.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,33 @@ jobs:
102102
cd create-test-lint-wf
103103
nf-core --log-file log.txt pipelines create -n testpipeline -d "This pipeline is for testing" -a "Testing McTestface" --template-yaml template_skip_${{ matrix.TEMPLATE }}.yml
104104
105-
# Test pipeline with nf-test
105+
# Copy snapshot file
106+
- name: copy snapshot file
107+
if: ${{ matrix.TEMPLATE != 'all' && matrix.TEMPLATE != 'nf-test' }}
108+
run: |
109+
cp .github/__snapshots__/${{ matrix.TEMPLATE }}.nf.test.snap create-test-lint-wf/my-prefix-testpipeline/tests/default.nf.test.snap
110+
111+
# Generate snapshot if not there
112+
- name: run pipeline nf-test and generate snapshot if previous step failed
113+
if: ${{ failure() && matrix.TEMPLATE != 'all' && matrix.TEMPLATE != 'nf-test' }}
114+
shell: bash
115+
env:
116+
NFT_DIFF: "pdiff"
117+
NFT_DIFF_ARGS: "--line-numbers --width 120 --expand-tabs=2"
118+
run: |
119+
cd create-test-lint-wf/my-prefix-testpipeline
120+
nf-test test \
121+
--profile=+docker \
122+
--verbose
123+
cd ../..
124+
cp create-test-lint-wf/my-prefix-testpipeline/tests/default.nf.test.snap .github/__snapshots__/${{ matrix.TEMPLATE }}.nf.test.snap
125+
git config --global user.email "[email protected]"
126+
git config --global user.name "nf-core-bot"
127+
git add .github/__snapshots__/${{ matrix.TEMPLATE }}.nf.test.snap
128+
git commit -m "Generate snapshot for ${{ matrix.TEMPLATE }} template"
129+
git push
130+
131+
# Run pipeline with nf-test
106132
- name: run pipeline nf-test
107133
if: ${{ matrix.TEMPLATE != 'all' && matrix.TEMPLATE != 'nf-test' }}
108134
shell: bash
@@ -114,8 +140,9 @@ jobs:
114140
nf-test test \
115141
--profile=+docker \
116142
--verbose \
143+
--ci
117144
118-
# Remove -nf-test folder before linting
145+
# Remove .nf-test folder before linting
119146
- name: remove .nf-test folder
120147
if: ${{ matrix.TEMPLATE != 'all' && matrix.TEMPLATE != 'nf-test' }}
121148
run: |

0 commit comments

Comments
 (0)