Skip to content

Commit

Permalink
Merge pull request #392 from nf-core/check-patch-travis-ci
Browse files Browse the repository at this point in the history
Add Patch to enable PRs coming from patch branch
  • Loading branch information
apeltzer committed Sep 24, 2019
2 parents 6d7eaf1 + 4271ca3 commit b7d34e1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* The tools `create` command now sets up a `TEMPLATE` and a `dev` branch for syncing
* Fixed issue [379](https://github.com/nf-core/tools/issues/379)
* nf-core launch now uses stable parameter schema version 0.1.0
* Check that PR from patch or dev branch is acceptable by linting

### Syncing

Expand All @@ -25,6 +26,7 @@

### Template

* Add new code for Travis CI to allow PRs from patch branches too
* Fix small typo in central readme of tools for future releases
* Small code polishing + typo fix in the template main.nf file
* Switched to yaml.safe_load() to fix PyYAML warning that was thrown because of a possible [exploit](https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation)
Expand Down
2 changes: 1 addition & 1 deletion docs/lint_errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ This test fails if the following happens:

```yaml
before_install:
- '[ $TRAVIS_PULL_REQUEST = "false" ] || [ $TRAVIS_BRANCH != "master" ] || ([ $TRAVIS_PULL_REQUEST_SLUG = $TRAVIS_REPO_SLUG ] && [ $TRAVIS_PULL_REQUEST_BRANCH = "dev" ])'
- '[ $TRAVIS_PULL_REQUEST = "false" ] || [ $TRAVIS_BRANCH != "master" ] || ([ $TRAVIS_PULL_REQUEST_SLUG = $TRAVIS_REPO_SLUG ] && ([ $TRAVIS_PULL_REQUEST_BRANCH = "dev" ] || [ $TRAVIS_PULL_REQUEST_BRANCH = "patch" ]))'
```

## Error #6 - Repository `README.md` tests ## {#6}
Expand Down
8 changes: 4 additions & 4 deletions nf_core/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,14 @@ def check_ci_config(self):
if os.path.isfile(fn):
with open(fn, 'r') as fh:
ciconf = yaml.safe_load(fh)
# Check that we have the master branch protection
travisMasterCheck = '[ $TRAVIS_PULL_REQUEST = "false" ] || [ $TRAVIS_BRANCH != "master" ] || ([ $TRAVIS_PULL_REQUEST_SLUG = $TRAVIS_REPO_SLUG ] && [ $TRAVIS_PULL_REQUEST_BRANCH = "dev" ])'
# Check that we have the master branch protection, but allow patch as well
travisMasterCheck = '[ $TRAVIS_PULL_REQUEST = "false" ] || [ $TRAVIS_BRANCH != "master" ] || ([ $TRAVIS_PULL_REQUEST_SLUG = $TRAVIS_REPO_SLUG ] && ([ $TRAVIS_PULL_REQUEST_BRANCH = "dev" ] || [ $TRAVIS_PULL_REQUEST_BRANCH = "patch" ]))'
try:
assert(travisMasterCheck in ciconf.get('before_install', {}))
except AssertionError:
self.failed.append((5, "Continuous integration must check for master branch PRs: '{}'".format(fn)))
self.failed.append((5, "Continuous integration must check for master/patch branch PRs: '{}'".format(fn)))
else:
self.passed.append((5, "Continuous integration checks for master branch PRs: '{}'".format(fn)))
self.passed.append((5, "Continuous integration checks for master/patch branch PRs: '{}'".format(fn)))
# Check that the nf-core linting runs
try:
assert('nf-core lint ${TRAVIS_BUILD_DIR}' in ciconf['script'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ matrix:

before_install:
# PRs to master are only ok if coming from dev branch
- '[ $TRAVIS_PULL_REQUEST = "false" ] || [ $TRAVIS_BRANCH != "master" ] || ([ $TRAVIS_PULL_REQUEST_SLUG = $TRAVIS_REPO_SLUG ] && [ $TRAVIS_PULL_REQUEST_BRANCH = "dev" ])'
- '[ $TRAVIS_PULL_REQUEST = "false" ] || [ $TRAVIS_BRANCH != "master" ] || ([ $TRAVIS_PULL_REQUEST_SLUG = $TRAVIS_REPO_SLUG ] && ([ $TRAVIS_PULL_REQUEST_BRANCH = "dev" ] || [ $TRAVIS_PULL_REQUEST_BRANCH = "patch" ]))'
# Pull the docker image first so the test doesn't wait for this
- docker pull {{ cookiecutter.name_docker }}:dev
# Fake the tag locally so that the pipeline runs properly
Expand Down
2 changes: 1 addition & 1 deletion tests/lint_examples/minimal_working_example/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ matrix:

before_install:
# PRs to master are only ok if coming from dev branch
- '[ $TRAVIS_PULL_REQUEST = "false" ] || [ $TRAVIS_BRANCH != "master" ] || ([ $TRAVIS_PULL_REQUEST_SLUG = $TRAVIS_REPO_SLUG ] && [ $TRAVIS_PULL_REQUEST_BRANCH = "dev" ])'
- '[ $TRAVIS_PULL_REQUEST = "false" ] || [ $TRAVIS_BRANCH != "master" ] || ([ $TRAVIS_PULL_REQUEST_SLUG = $TRAVIS_REPO_SLUG ] && ([ $TRAVIS_PULL_REQUEST_BRANCH = "dev" ] || [ $TRAVIS_PULL_REQUEST_BRANCH = "patch" ]))'
# Pull the docker image first so the test doesn't wait for this
- docker pull nfcore/tools:dev
# Fake the tag locally so that the pipeline runs properly
Expand Down

0 comments on commit b7d34e1

Please sign in to comment.