Skip to content

Commit f14c7a5

Browse files
authored
Merge pull request #719 from nf-core/dev
1.10.2 Patch release
2 parents 2ccb064 + 95c399d commit f14c7a5

File tree

18 files changed

+336
-257
lines changed

18 files changed

+336
-257
lines changed

.github/workflows/branch.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ jobs:
2424
message: |
2525
Hi @${{ github.event.pull_request.user.login }},
2626
27-
It looks like this pull-request is has been made against the ${{github.event.pull_request.head.repo.full_name}} `master` branch.
28-
The `master` branch on nf-core repositories should always contain code from the latest release.
29-
Beacuse of this, PRs to `master` are only allowed if they come from the ${{github.event.pull_request.head.repo.full_name}} `dev` branch.
27+
It looks like this pull-request has been made against the ${{github.event.pull_request.head.repo.full_name}} `master` branch. The `master` branch on nf-core repositories should always contain code from the latest release. Beacuse of this, PRs to `master` are only allowed if they come from the ${{github.event.pull_request.head.repo.full_name}} `dev` branch.
3028
3129
You do not need to close this PR, you can change the target branch to `dev` by clicking the _"Edit"_ button at the top of this page.
3230

.github/workflows/sync.yml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,34 @@ on:
44
types: [published]
55

66
jobs:
7-
sync-all:
8-
name: Sync all pipelines
7+
get-pipelines:
98
runs-on: ubuntu-latest
9+
outputs:
10+
matrix: ${{ steps.set-matrix.outputs.matrix }}
11+
steps:
12+
- id: set-matrix
13+
run: |
14+
curl -O https://nf-co.re/pipeline_names.json
15+
echo "::set-output name=matrix::$(cat pipeline_names.json)"
1016
17+
sync:
18+
needs: get-pipelines
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix: ${{fromJson(needs.get-pipelines.outputs.matrix)}}
22+
fail-fast: false
1123
steps:
24+
1225
- uses: actions/checkout@v2
13-
name: Check out source-code repository
26+
name: Check out nf-core/tools
27+
28+
- uses: actions/checkout@v2
29+
name: Check out nf-core/${{ matrix.pipeline }}
30+
with:
31+
repository: nf-core/${{ matrix.pipeline }}
32+
ref: dev
33+
token: ${{ secrets.nf_core_bot_auth_token }}
34+
path: nf-core/${{ matrix.pipeline }}
1435

1536
- name: Set up Python 3.8
1637
uses: actions/setup-python@v1
@@ -32,14 +53,20 @@ jobs:
3253
- name: Run synchronisation
3354
if: github.repository == 'nf-core/tools'
3455
env:
35-
AUTH_TOKEN: ${{ secrets.nf_core_bot_auth_token }}
56+
GITHUB_AUTH_TOKEN: ${{ secrets.nf_core_bot_auth_token }}
3657
run: |
3758
git config --global user.email "[email protected]"
3859
git config --global user.name "nf-core-bot"
39-
nf-core --log-file sync_log.txt sync --all --username nf-core-bot --auth-token $AUTH_TOKEN
60+
nf-core --log-file sync_log_${{ matrix.pipeline }}.txt sync nf-core/${{ matrix.pipeline }} \
61+
--from-branch dev \
62+
--pull-request \
63+
--username nf-core-bot \
64+
--repository nf-core/${{ matrix.pipeline }}
65+
4066
4167
- name: Upload sync log file artifact
68+
if: ${{ always() }}
4269
uses: actions/upload-artifact@v2
4370
with:
44-
name: sync-log-file
45-
path: sync_log.txt
71+
name: sync_log_${{ matrix.pipeline }}
72+
path: sync_log_${{ matrix.pipeline }}.txt

CHANGELOG.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
11
# nf-core/tools: Changelog
22

3-
## [v1.10.1](https://github.com/nf-core/tools/releases/tag/1.10.1) - [2020-07-30]
3+
## [v1.10.2 - Copper Camel _(brought back from the dead)_](https://github.com/nf-core/tools/releases/tag/1.10.2) - [2020-07-31]
4+
5+
Second patch release to address some small errors discovered in the pipeline template.
6+
Apologies for the inconvenience.
7+
8+
* Fix syntax error in `/push_dockerhub.yml` GitHub Action workflow
9+
* Change `params.readPaths` -> `params.input_paths` in `test_full.config`
10+
* Check results when posting the lint results as a GitHub comment
11+
* This feature is unfortunately not possible when making PRs from forks outside of the nf-core organisation for now.
12+
* More major refactoring of the automated pipeline sync
13+
* New GitHub Actions matrix parallelisation of sync jobs across pipelines [[#673](https://github.com/nf-core/tools/issues/673)]
14+
* Removed the `--all` behaviour from `nf-core sync` as we no longer need it
15+
* Sync now uses a new list of pipelines on the website which does not include archived pipelines [[#712](https://github.com/nf-core/tools/issues/712)]
16+
* When making a PR it checks if a PR already exists - if so it updates it [[#710](https://github.com/nf-core/tools/issues/710)]
17+
* More tests and code refactoring for more stable code. Hopefully fixes 404 error [[#711](https://github.com/nf-core/tools/issues/711)]
18+
19+
## [v1.10.1 - Copper Camel _(patch)_](https://github.com/nf-core/tools/releases/tag/1.10.1) - [2020-07-30]
420

521
Patch release to fix the automatic template synchronisation, which failed in the v1.10 release.
622

723
* Improved logging: `nf-core --log-file log.txt` now saves a verbose log to disk.
8-
* GitHub actions sync now uploads verbose log as an artifact.
9-
* Sync - fixed several minor bugs, improved logging.
24+
* nf-core/tools GitHub Actions pipeline sync now uploads verbose log as an artifact.
25+
* Sync - fixed several minor bugs, made logging less verbose.
1026
* Python Rich library updated to `>=4.2.1`
27+
* Hopefully fix git config for pipeline sync so that commit comes from @nf-core-bot
28+
* Fix sync auto-PR text indentation so that it doesn't all show as code
29+
* Added explicit flag `--show-passed` for `nf-core lint` instead of taking logging verbosity
1130

1231
## [v1.10 - Copper Camel](https://github.com/nf-core/tools/releases/tag/1.10) - [2020-07-30]
1332

docs/lint_errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ This test will fail if the following requirements are not met in these files:
177177

178178
2. `linting.yml`: Specifies the commands to lint the pipeline repository using `nf-core lint` and `markdownlint`
179179
* Must be turned on for `push` and `pull_request`.
180-
* Must have the command `nf-core lint ${GITHUB_WORKSPACE}`.
180+
* Must have the command `nf-core -l lint_log.txt lint ${GITHUB_WORKSPACE}`.
181181
* Must have the command `markdownlint ${GITHUB_WORKSPACE} -c ${GITHUB_WORKSPACE}/.github/markdownlint.yml`.
182182

183183
3. `branch.yml`: Ensures that pull requests to the protected `master` branch are coming from the correct branch when a PR is opened against the _nf-core_ repository.

nf_core/__main__.py

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -550,14 +550,12 @@ def bump_version(pipeline_dir, new_version, nextflow):
550550

551551

552552
@nf_core_cli.command("sync", help_priority=10)
553-
@click.argument("pipeline_dir", type=click.Path(exists=True), nargs=-1, metavar="<pipeline directory>")
553+
@click.argument("pipeline_dir", required=True, type=click.Path(exists=True), metavar="<pipeline directory>")
554554
@click.option("-b", "--from-branch", type=str, help="The git branch to use to fetch workflow vars.")
555555
@click.option("-p", "--pull-request", is_flag=True, default=False, help="Make a GitHub pull-request with the changes.")
556-
@click.option("-u", "--username", type=str, help="GitHub username for the PR.")
557-
@click.option("-r", "--repository", type=str, help="GitHub repository name for the PR.")
558-
@click.option("-a", "--auth-token", type=str, help="GitHub API personal access token.")
559-
@click.option("--all", is_flag=True, default=False, help="Sync template for all nf-core pipelines.")
560-
def sync(pipeline_dir, from_branch, pull_request, username, repository, auth_token, all):
556+
@click.option("-r", "--repository", type=str, help="GitHub PR: target repository.")
557+
@click.option("-u", "--username", type=str, help="GitHub PR: auth username.")
558+
def sync(pipeline_dir, from_branch, pull_request, repository, username):
561559
"""
562560
Sync a pipeline TEMPLATE branch with the nf-core template.
563561
@@ -571,24 +569,13 @@ def sync(pipeline_dir, from_branch, pull_request, username, repository, auth_tok
571569
new release of nf-core/tools (and the included template) is made.
572570
"""
573571

574-
# Pull and sync all nf-core pipelines
575-
if all:
576-
nf_core.sync.sync_all_pipelines(username, auth_token)
577-
else:
578-
# Manually check for the required parameter
579-
if not pipeline_dir or len(pipeline_dir) != 1:
580-
log.error("Either use --all or specify one <pipeline directory>")
581-
sys.exit(1)
582-
else:
583-
pipeline_dir = pipeline_dir[0]
584-
585-
# Sync the given pipeline dir
586-
sync_obj = nf_core.sync.PipelineSync(pipeline_dir, from_branch, pull_request)
587-
try:
588-
sync_obj.sync()
589-
except (nf_core.sync.SyncException, nf_core.sync.PullRequestException) as e:
590-
log.error(e)
591-
sys.exit(1)
572+
# Sync the given pipeline dir
573+
sync_obj = nf_core.sync.PipelineSync(pipeline_dir, from_branch, pull_request, repository, username)
574+
try:
575+
sync_obj.sync()
576+
except (nf_core.sync.SyncException, nf_core.sync.PullRequestException) as e:
577+
log.error(e)
578+
sys.exit(1)
592579

593580

594581
if __name__ == "__main__":

nf_core/lint.py

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ def check_actions_lint(self):
771771
self.passed.append((5, "Continuous integration runs Markdown lint Tests: `{}`".format(fn)))
772772

773773
# Check that the nf-core linting runs
774-
nfcore_lint_cmd = "nf-core lint ${GITHUB_WORKSPACE}"
774+
nfcore_lint_cmd = "nf-core -l lint_log.txt lint ${GITHUB_WORKSPACE}"
775775
try:
776776
steps = lintwf["jobs"]["nf-core"]["steps"]
777777
assert any([nfcore_lint_cmd in step["run"] for step in steps if "run" in step.keys()])
@@ -1440,39 +1440,55 @@ def github_comment(self):
14401440
"""
14411441
If we are running in a GitHub PR, try to post results as a comment
14421442
"""
1443-
if os.environ.get("GITHUB_TOKEN", "") != "" and os.environ.get("GITHUB_COMMENTS_URL", "") != "":
1444-
try:
1445-
headers = {"Authorization": "token {}".format(os.environ["GITHUB_TOKEN"])}
1446-
# Get existing comments - GET
1447-
get_r = requests.get(url=os.environ["GITHUB_COMMENTS_URL"], headers=headers)
1448-
if get_r.status_code == 200:
1449-
1450-
# Look for an existing comment to update
1451-
update_url = False
1452-
for comment in get_r.json():
1453-
if comment["user"]["login"] == "github-actions[bot]" and comment["body"].startswith(
1454-
"\n#### `nf-core lint` overall result"
1455-
):
1456-
# Update existing comment - PATCH
1457-
log.info("Updating GitHub comment")
1458-
update_r = requests.patch(
1459-
url=comment["url"],
1460-
data=json.dumps({"body": self.get_results_md().replace("Posted", "**Updated**")}),
1461-
headers=headers,
1462-
)
1463-
return
1464-
1465-
# Create new comment - POST
1466-
if len(self.warned) > 0 or len(self.failed) > 0:
1467-
log.info("Posting GitHub comment")
1468-
post_r = requests.post(
1469-
url=os.environ["GITHUB_COMMENTS_URL"],
1470-
data=json.dumps({"body": self.get_results_md()}),
1443+
if os.environ.get("GITHUB_TOKEN", "") == "":
1444+
log.debug("Environment variable GITHUB_TOKEN not found")
1445+
return
1446+
if os.environ.get("GITHUB_COMMENTS_URL", "") == "":
1447+
log.debug("Environment variable GITHUB_COMMENTS_URL not found")
1448+
return
1449+
try:
1450+
headers = {"Authorization": "token {}".format(os.environ["GITHUB_TOKEN"])}
1451+
# Get existing comments - GET
1452+
get_r = requests.get(url=os.environ["GITHUB_COMMENTS_URL"], headers=headers)
1453+
if get_r.status_code == 200:
1454+
1455+
# Look for an existing comment to update
1456+
update_url = False
1457+
for comment in get_r.json():
1458+
if comment["user"]["login"] == "github-actions[bot]" and comment["body"].startswith(
1459+
"\n#### `nf-core lint` overall result"
1460+
):
1461+
# Update existing comment - PATCH
1462+
log.info("Updating GitHub comment")
1463+
update_r = requests.patch(
1464+
url=comment["url"],
1465+
data=json.dumps({"body": self.get_results_md().replace("Posted", "**Updated**")}),
14711466
headers=headers,
14721467
)
1468+
return
1469+
1470+
# Create new comment - POST
1471+
if len(self.warned) > 0 or len(self.failed) > 0:
1472+
r = requests.post(
1473+
url=os.environ["GITHUB_COMMENTS_URL"],
1474+
data=json.dumps({"body": self.get_results_md()}),
1475+
headers=headers,
1476+
)
1477+
try:
1478+
r_json = json.loads(r.content)
1479+
response_pp = json.dumps(r_json, indent=4)
1480+
except:
1481+
r_json = r.content
1482+
response_pp = r.content
1483+
1484+
if r.status_code == 201:
1485+
log.info("Posted GitHub comment: {}".format(r_json["html_url"]))
1486+
log.debug(response_pp)
1487+
else:
1488+
log.warn("Could not post GitHub comment: '{}'\n{}".format(r.status_code, response_pp))
14731489

1474-
except Exception as e:
1475-
log.warning("Could not post GitHub comment: {}\n{}".format(os.environ["GITHUB_COMMENTS_URL"], e))
1490+
except Exception as e:
1491+
log.warning("Could not post GitHub comment: {}\n{}".format(os.environ["GITHUB_COMMENTS_URL"], e))
14761492

14771493
def _wrap_quotes(self, files):
14781494
if not isinstance(files, list):

nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ These tests are run both with the latest available version of `Nextflow` and als
4646

4747
## Patch
4848

49-
: warning: Only in the unlikely and regretful event of a release happening with a bug.
49+
:warning: Only in the unlikely and regretful event of a release happening with a bug.
5050

5151
* On your own fork, make a new branch `patch` based on `upstream/master`.
5252
* Fix the bug, and bump version (X.Y.Z+1).

nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/workflows/awsfulltest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: conda install -c conda-forge awscli
2222
- name: Start AWS batch job
2323
# TODO nf-core: You can customise AWS full pipeline tests as required
24-
# Add full size test data (but still relatively small datasets for few samples)
24+
# Add full size test data (but still relatively small datasets for few samples)
2525
# on the `test_full.config` test runs with only one set of parameters
2626
# Then specify `-profile test_full` instead of `-profile test` on the AWS batch command
2727
{% raw %}env:

nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/workflows/branch.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
1818
{% raw %}
1919
# If the above check failed, post a comment on the PR explaining the failure
20+
# NOTE - this doesn't currently work if the PR is coming from a fork, due to limitations in GitHub actions secrets
2021
- name: Post PR comment
2122
if: failure()
2223
uses: mshick/add-pr-comment@v1

nf_core/pipeline-template/{{cookiecutter.name_noslash}}/.github/workflows/linting.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,12 @@ jobs:
5757
GITHUB_COMMENTS_URL: ${{ github.event.pull_request.comments_url }}
5858
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5959
GITHUB_PR_COMMIT: ${{ github.event.pull_request.head.sha }}
60-
run: nf-core lint ${GITHUB_WORKSPACE}
60+
run: nf-core -l lint_log.txt lint ${GITHUB_WORKSPACE}
61+
62+
- name: Upload linting log file artifact
63+
if: ${{ always() }}
64+
uses: actions/upload-artifact@v2
65+
with:
66+
name: linting-log-file
67+
path: lint_log.txt
6168
{% endraw %}

0 commit comments

Comments
 (0)