Skip to content

Commit

Permalink
Merge pull request #1650 from MillironX/feature/setup-nextflow-action
Browse files Browse the repository at this point in the history
Switch CI to nf-core/setup-nextflow action
  • Loading branch information
ewels authored Jun 22, 2022
2 parents 7f8fa83 + 0bab55b commit 5f97960
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 83 deletions.
23 changes: 6 additions & 17 deletions .github/workflows/create-lint-wf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on: [push, pull_request]

env:
NXF_ANSI_LOG: false
CAPSULE_LOG: none

jobs:
MakeTestWorkflow:
Expand All @@ -12,14 +11,9 @@ jobs:
NXF_ANSI_LOG: false
strategy:
matrix:
# Nextflow versions
include:
# Test pipeline minimum Nextflow version
- NXF_VER: "21.10.3"
NXF_EDGE: ""
# Test latest edge release of Nextflow
- NXF_VER: ""
NXF_EDGE: "1"
NXF_VER:
- "21.10.3"
- "latest-everything"
steps:
# Get the repo code
- uses: actions/checkout@v2
Expand All @@ -38,14 +32,9 @@ jobs:
# Set up Nextflow
- name: Install Nextflow
env:
NXF_VER: ${{ matrix.NXF_VER }}
# Uncomment only if the edge release is more recent than the latest stable release
# See https://github.com/nextflow-io/nextflow/issues/2467
# NXF_EDGE: ${{ matrix.NXF_EDGE }}
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
uses: nf-core/setup-nextflow@v1
with:
version: ${{ matrix.NXF_VER }}

# Install the Prettier linting tools
- uses: actions/setup-node@v2
Expand Down
23 changes: 6 additions & 17 deletions .github/workflows/create-test-wf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on: [push, pull_request]

env:
NXF_ANSI_LOG: false
CAPSULE_LOG: none

jobs:
RunTestWorkflow:
Expand All @@ -12,14 +11,9 @@ jobs:
NXF_ANSI_LOG: false
strategy:
matrix:
# Nextflow versions
include:
# Test pipeline minimum Nextflow version
- NXF_VER: "21.10.3"
NXF_EDGE: ""
# Test latest edge release of Nextflow
- NXF_VER: ""
NXF_EDGE: "1"
NXF_VER:
- "21.10.3"
- "latest-everything"
steps:
- uses: actions/checkout@v2
name: Check out source-code repository
Expand All @@ -35,14 +29,9 @@ jobs:
pip install .
- name: Install Nextflow
env:
NXF_VER: ${{ matrix.NXF_VER }}
# Uncomment only if the edge release is more recent than the latest stable release
# See https://github.com/nextflow-io/nextflow/issues/2467
# NXF_EDGE: ${{ matrix.NXF_EDGE }}
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
uses: nf-core/setup-nextflow@v1
with:
version: ${{ matrix.NXF_VER }}

- name: Run nf-core/tools
run: |
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
push:
pull_request:

# Uncomment if we need an edge release of Nextflow again
# env: NXF_EDGE: 1

jobs:
pytest:
runs-on: ubuntu-latest
Expand All @@ -30,11 +27,9 @@ jobs:
pip install -e .
- name: Install Nextflow
env:
CAPSULE_LOG: none
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
uses: nf-core/setup-nextflow@v1
with:
version: "latest-everything"

- name: Test with pytest
run: python3 -m pytest tests/ --color=yes --cov-report=xml --cov-config=.github/.coveragerc --cov=nf_core
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
description: Only run on nf-core/testpipeline?
required: true

# Uncomment if we need an edge release of Nextflow again
# env: NXF_EDGE: 1

jobs:
get-pipelines:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,13 +54,9 @@ jobs:
pip install .
- name: Install Nextflow
env:
CAPSULE_LOG: none
run: |
mkdir /tmp/nextflow
cd /tmp/nextflow
wget -qO- get.nextflow.io | bash
sudo ln -s /tmp/nextflow/nextflow /usr/local/bin/nextflow
uses: nf-core/setup-nextflow@v1
with:
version: "latest-everything"

- name: Run synchronisation
if: github.repository == 'nf-core/tools'
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Template

- Fix bug in pipeline readme logo URL ([#1590](https://github.com/nf-core/tools/pull/1590))
- Switch CI to use [setup-nextflow](https://github.com/nf-core/setup-nextflow) action to install Nextflow ([#1650](https://github.com/nf-core/tools/pull/1650))

### Linting

Expand All @@ -19,6 +20,7 @@
- Updated the package requirements to prevent defunct installations of nf-core ([#1620](https://github.com/nf-core/tools/pull/1620))
- Fix and improve broken test for Singularity container download ([#1622](https://github.com/nf-core/tools/pull/1622))
- Use [`$XDG_CACHE_HOME`](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) or `~/.cache` instead of `$XDG_CONFIG_HOME` or `~/config/` as base directory for API cache
- Switch CI to use [setup-nextflow](https://github.com/nf-core/setup-nextflow) action to install Nextflow ([#1650](https://github.com/nf-core/tools/pull/1650))

### Modules

Expand Down
8 changes: 5 additions & 3 deletions nf_core/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ def bump_nextflow_version(pipeline_obj, new_version):
pipeline_obj,
[
(
# example: - NXF_VER: '20.04.0'
rf"- NXF_VER: [\'\"]{re.escape(current_version)}[\'\"]",
f"- NXF_VER: '{new_version}'",
# example:
# NXF_VER:
# - "20.04.0"
rf"- [\"]{re.escape(current_version)}[\"]",
f'- "{new_version}"',
)
],
)
Expand Down
4 changes: 2 additions & 2 deletions nf_core/lint/actions_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ def actions_ci(self):

# Check that we are testing the minimum nextflow version
try:
matrix = ciwf["jobs"]["test"]["strategy"]["matrix"]["include"]
assert any([i.get("NXF_VER") == self.minNextflowVersion for i in matrix])
nxf_ver = ciwf["jobs"]["test"]["strategy"]["matrix"]["NXF_VER"]
assert any([i == self.minNextflowVersion for i in nxf_ver])
except (KeyError, TypeError):
failed.append("'.github/workflows/ci.yml' does not check minimum NF version")
except AssertionError:
Expand Down
25 changes: 7 additions & 18 deletions nf_core/pipeline-template/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:

env:
NXF_ANSI_LOG: false
CAPSULE_LOG: none

jobs:
test:
Expand All @@ -20,31 +19,21 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# Nextflow versions
include:
# Test pipeline minimum Nextflow version
- NXF_VER: "21.10.3"
NXF_EDGE: ""
# Test latest edge release of Nextflow {%- raw %}
- NXF_VER: ""
NXF_EDGE: "1"
NXF_VER:
- "21.10.3"
- "latest-everything"
steps:
- name: Check out pipeline code
uses: actions/checkout@v2

- name: Install Nextflow
env:
NXF_VER: ${{ matrix.NXF_VER }}
# Uncomment only if the edge release is more recent than the latest stable release
# See https://github.com/nextflow-io/nextflow/issues/2467
# NXF_EDGE: ${{ matrix.NXF_EDGE }}
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
uses: nf-core/setup-nextflow@v1
with:
version: "{% raw %}${{ matrix.NXF_VER }}{% endraw %}"

- name: Run pipeline with test data
# TODO nf-core: You can customise CI pipeline run tests as required
# For example: adding multiple test runs with different parameters
# Remember that you can parallelise this by using strategy.matrix
run: |
nextflow run ${GITHUB_WORKSPACE} -profile test,docker --outdir ./results {%- endraw %}
nextflow run ${GITHUB_WORKSPACE} -profile test,docker --outdir ./results
6 changes: 1 addition & 5 deletions nf_core/pipeline-template/.github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ jobs:
uses: actions/checkout@v2

- name: Install Nextflow
env:
CAPSULE_LOG: none
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
uses: nf-core/setup-nextflow@v1

- uses: actions/setup-python@v3
with:
Expand Down
7 changes: 4 additions & 3 deletions tests/test_bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ def test_bump_nextflow_version(datafiles, tmp_path):
pipeline_obj = nf_core.utils.Pipeline(test_pipeline_dir)
pipeline_obj._load()

# Bump the version number to a specific version
version = "21.10.3"
# Bump the version number to a specific version, preferably one
# we're not already on
version = "22.04.3"
nf_core.bump_version.bump_nextflow_version(pipeline_obj, version)
new_pipeline_obj = nf_core.utils.Pipeline(test_pipeline_dir)

Expand All @@ -75,7 +76,7 @@ def test_bump_nextflow_version(datafiles, tmp_path):
# Check .github/workflows/ci.yml
with open(new_pipeline_obj._fp(".github/workflows/ci.yml")) as fh:
ci_yaml = yaml.safe_load(fh)
assert ci_yaml["jobs"]["test"]["strategy"]["matrix"]["include"][0]["NXF_VER"] == version
assert ci_yaml["jobs"]["test"]["strategy"]["matrix"]["NXF_VER"][0] == version

# Check README.md
with open(new_pipeline_obj._fp("README.md")) as fh:
Expand Down

0 comments on commit 5f97960

Please sign in to comment.