Skip to content

Commit

Permalink
Merge pull request #22 from seqeralabs/update_ci
Browse files Browse the repository at this point in the history
Copy in CI from fetchngs
  • Loading branch information
pinin4fjords authored May 3, 2024
2 parents 64f2b7b + deebe24 commit 7ce3bae
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 28 deletions.
10 changes: 10 additions & 0 deletions .github/include.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
".":
- ./.github/workflows/**
- ./nf-test.config
- ./nextflow.config
tests:
- ./assets/*
- ./bin/*
- ./conf/*
- ./main.nf
- ./nextflow_schema.json
77 changes: 50 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,92 @@
name: nf-aggregate CI
# This workflow runs the pipeline with the minimal test dataset to check that it completes without any syntax errors
name: nf-core CI
on:
pull_request:
release:
types:
- published
types: [published]
merge_group:
types:
- checks_requested
branches:
- master
- dev

env:
NXF_ANSI_LOG: false
NFT_VER: "0.8.4"
NFT_WORKDIR: "~"
NFT_DIFF: "pdiff"
NFT_DIFF_ARGS: "--line-numbers --expand-tabs=2"
TOWER_ACCESS_TOKEN: ${{ secrets.TOWER_ACCESS_TOKEN }}

concurrency:
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
cancel-in-progress: true

jobs:
changes:
name: Find tags to test
name: Check for changes
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.get_tags.outputs.result }}
nf_test_files: ${{ steps.list.outputs.components }}
steps:
- uses: actions/checkout@v3
- name: Combine all tags.yml files
id: get_username
run: find . -name "tags.yml" -not -path "./.github/*" -exec cat {} + > .github/tags.yml
- name: debug
run: cat .github/tags.yml
- name: Get tags using yq
id: get_tags
uses: mikefarah/yq@master
with:
cmd: yq -e '. | keys | tojson' .github/tags.yml
fetch-depth: 0

- name: List nf-test files
id: list
uses: adamrtalbot/[email protected]
with:
head: ${{ github.sha }}
base: origin/${{ github.base_ref }}
include: .github/include.yaml

nf-test:
name: nf-test ${{ matrix.tags }} ${{ matrix.profile }} nf-${{ matrix.NXF_VER }}
- name: print list of nf-test files
run: |
echo ${{ steps.list.outputs.components }}
test:
name: ${{ matrix.nf_test_files }} ${{ matrix.profile }} NF-${{ matrix.NXF_VER }}
needs: [changes]
if: needs.changes.outputs.tags != '[]'
if: needs.changes.outputs.nf_test_files != '[]'
runs-on: ubuntu-latest
env:
TOWER_ACCESS_TOKEN: ${{ secrets.TOWER_ACCESS_TOKEN }}
strategy:
fail-fast: false
matrix:
NXF_VER:
- "23.10.0"
- "latest-everything"
tags: ${{ fromJson(needs.changes.outputs.tags) }}
nf_test_files: ["${{ fromJson(needs.changes.outputs.nf_test_files) }}"]
profile:
- "docker"

steps:
- name: Check out pipeline code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Nextflow
uses: nf-core/setup-nextflow@v1
uses: nf-core/setup-nextflow@v2
with:
version: "${{ matrix.NXF_VER }}"

- uses: actions/setup-python@v4
with:
python-version: "3.11"
architecture: "x64"

- name: Install pdiff to see diff between nf-test snapshots
run: |
python -m pip install --upgrade pip
pip install pdiff
- name: Cache nf-test installation
id: cache-software
uses: actions/cache@v3
with:
path: |
/usr/local/bin/nf-test
/home/runner/.nf-test/nf-test.jar
key: ${{ runner.os }}-${{ env.NFTEST_VER }}-nftest
key: ${{ runner.os }}-${{ env.NFT_VER }}-nftest

- name: Install nf-test
if: steps.cache-software.outputs.cache-hit != 'true'
Expand All @@ -80,7 +96,12 @@ jobs:
- name: Run nf-test
run: |
nf-test test --tag ${{ matrix.tags }} --profile "test,${{ matrix.profile }}" --junitxml=test.xml --verbose
nf-test test --verbose ${{ matrix.nf_test_files }} --profile "+${{ matrix.profile }}" --junitxml=test.xml --tap=test.tap
- uses: pcolby/tap-summary@v1
with:
path: >-
test.tap
- name: Output log on failure
if: failure()
Expand All @@ -96,11 +117,13 @@ jobs:

confirm-pass:
runs-on: ubuntu-latest
needs: [changes, nf-test]
needs:
- changes
- test
if: always()
steps:
- name: All tests ok
if: ${{ success() || !contains(needs.*.result, 'failure') }}
if: ${{ !contains(needs.*.result, 'failure') }}
run: exit 0
- name: One or more tests failed
if: ${{ contains(needs.*.result, 'failure') }}
Expand Down
2 changes: 1 addition & 1 deletion nf-test.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ config {
configFile "tests/nextflow.config"

// run all test with the defined docker profile from the main nextflow.config
profile ""
profile "test"
}

0 comments on commit 7ce3bae

Please sign in to comment.