Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: lint commit message in separate Travis job #24254

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ cache: ccache
os: linux
matrix:
include:
- name: "First commit message adheres to guidelines at <a href=\"https://goo.gl/p2fr5Q\">https://goo.gl/p2fr5Q</a>"
if: type = pull_request
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😮

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

language: node_js
node_js: "node"
script:
- if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
bash -x tools/lint-pr-commit-message.sh ${TRAVIS_PULL_REQUEST};
Copy link
Contributor

@refack refack Nov 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you split this into install & script the install part will fold.

      install:
        - RET=0
          if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
            bash -x tools/lint-pr-commit-message.sh ${TRAVIS_PULL_REQUEST} > out.txt
            RET=$?
          fi
          export RET
      script:
         - cat out.txt || true
           exit $RET

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redirecting stdout to file will lose coloring (okay not a major issue 😛). But if we do want to allow folding perhaps the thing to do is split the shell script so that the first part works out the first commit (this can be the install (before_script?) step) and then script would directly run npx core-validate-commit ....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in install == fetch from GitHub...
It will be a nicer UX, but will make the script more complex.
Your call.

fi
- name: "Linter"
language: node_js
node_js: "node"
env:
- NODE=$(which node)
script:
- make lint
# Lint the first commit in the PR.
- if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
bash tools/lint-pr-commit-message.sh ${TRAVIS_PULL_REQUEST} || true;
fi
- name: "Test Suite"
addons:
apt:
Expand Down