Skip to content

Commit

Permalink
Merge pull request #2055 from ewels/actions-ci-remove-dsl1-docker
Browse files Browse the repository at this point in the history
Don't check for `docker pull` commands in `actions_ci` lint test (leftover from DSL1)
ewels authored Nov 25, 2022
2 parents 16beb36 + d004a24 commit 0ba69a4
Showing 5 changed files with 1 addition and 86 deletions.
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -12,8 +12,3 @@ repos:
rev: "v2.6.2"
hooks:
- id: prettier
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.3.0"
hooks:
- id: name-tests-test
args: [--pytest-test-first]
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
### Linting

- Don't lint pipeline name if `manifest.name` in `.nf-core.yml` ([#2035](https://github.com/nf-core/tools/pull/2035))
- Don't check for `docker pull` commands in `actions_ci` lint test (leftover from DSL1)

### General

67 changes: 0 additions & 67 deletions nf_core/lint/actions_ci.py
Original file line number Diff line number Diff line change
@@ -38,35 +38,6 @@ def actions_ci(self):
.. note:: These ``matrix`` variables run the test workflow twice, varying the ``nxf_ver`` variable each time.
This is used in the ``nextflow run`` commands to test the pipeline with both the latest available version
of the pipeline (``''``) and the stated minimum required version.
* The `Docker` container for the pipeline must use the correct pipeline version number:
* Development pipelines:
.. code-block:: bash
docker tag nfcore/<pipeline_name>:dev nfcore/<pipeline_name>:dev
* Released pipelines:
.. code-block:: bash
docker tag nfcore/<pipeline_name>:dev nfcore/<pipeline_name>:<pipeline-version>
* Complete example for a released pipeline called *nf-core/example* with version number ``1.0.0``:
.. code-block:: yaml
:emphasize-lines: 3,8,9
- name: Build new docker image
if: env.GIT_DIFF
run: docker build --no-cache . -t nfcore/example:1.0.0
- name: Pull docker image
if: ${{ !env.GIT_DIFF }}
run: |
docker pull nfcore/example:dev
docker tag nfcore/example:dev nfcore/example:1.0.0
"""
passed = []
failed = []
@@ -101,44 +72,6 @@ def actions_ci(self):
else:
passed.append("'.github/workflows/ci.yml' is triggered on expected events")

# Check that we're pulling the right docker image and tagging it properly
if self.nf_config.get("process.container", ""):
docker_notag = re.sub(r":(?:[\.\d]+|dev)$", "", self.nf_config.get("process.container", "").strip("\"'"))
docker_withtag = self.nf_config.get("process.container", "").strip("\"'")

# docker build
docker_build_cmd = f"docker build --no-cache . -t {docker_withtag}"
try:
steps = ciwf["jobs"]["test"]["steps"]
if not any(docker_build_cmd in step["run"] for step in steps if "run" in step.keys()):
raise AssertionError()
except (AssertionError, KeyError, TypeError):
failed.append(f"CI is not building the correct docker image. Should be: `{docker_build_cmd}`")
else:
passed.append(f"CI is building the correct docker image: `{docker_build_cmd}`")

# docker pull
docker_pull_cmd = f"docker pull {docker_notag}:dev"
try:
steps = ciwf["jobs"]["test"]["steps"]
if not any(docker_pull_cmd in step["run"] for step in steps if "run" in step.keys()):
raise AssertionError()
except (AssertionError, KeyError, TypeError):
failed.append(f"CI is not pulling the correct docker image. Should be: `{docker_pull_cmd}`")
else:
passed.append(f"CI is pulling the correct docker image: {docker_pull_cmd}")

# docker tag
docker_tag_cmd = f"docker tag {docker_notag}:dev {docker_withtag}"
try:
steps = ciwf["jobs"]["test"]["steps"]
if not any(docker_tag_cmd in step["run"] for step in steps if "run" in step.keys()):
raise AssertionError()
except (AssertionError, KeyError, TypeError):
failed.append(f"CI is not tagging docker image correctly. Should be: `{docker_tag_cmd}`")
else:
passed.append(f"CI is tagging docker image correctly: {docker_tag_cmd}")

# Check that we are testing the minimum nextflow version
try:
nxf_ver = ciwf["jobs"]["test"]["strategy"]["matrix"]["NXF_VER"]
13 changes: 0 additions & 13 deletions tests/lint/actions_ci.py
Original file line number Diff line number Diff line change
@@ -26,19 +26,6 @@ def test_actions_ci_fail_wrong_nf(self):
assert results["failed"] == ["Minimum pipeline NF version '1.2.3' is not tested in '.github/workflows/ci.yml'"]


def test_actions_ci_fail_wrong_docker_ver(self):
"""Lint test: actions_actions_ci - FAIL - wrong pipeline version used for docker commands"""

self.lint_obj._load()
self.lint_obj.nf_config["process.container"] = "'nfcore/tools:0.4'"
results = self.lint_obj.actions_ci()
assert results["failed"] == [
"CI is not building the correct docker image. Should be: `docker build --no-cache . -t nfcore/tools:0.4`",
"CI is not pulling the correct docker image. Should be: `docker pull nfcore/tools:dev`",
"CI is not tagging docker image correctly. Should be: `docker tag nfcore/tools:dev nfcore/tools:0.4`",
]


def test_actions_ci_fail_wrong_trigger(self):
"""Lint test: actions_actions_ci - FAIL - workflow triggered incorrectly, NF ver not checked at all"""

1 change: 0 additions & 1 deletion tests/test_lint.py
Original file line number Diff line number Diff line change
@@ -185,7 +185,6 @@ def test_sphinx_md_files(self):
test_actions_awstest_pass,
)
from .lint.actions_ci import (
test_actions_ci_fail_wrong_docker_ver,
test_actions_ci_fail_wrong_nf,
test_actions_ci_fail_wrong_trigger,
test_actions_ci_pass,

0 comments on commit 0ba69a4

Please sign in to comment.