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

Move gitlint from Buildkite to GitHub Actions #2692

Merged
merged 4 commits into from
Feb 20, 2020
Merged
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ steps:
###########
# Lint jobs
###########
- label: Lint Git commits
command: .buildkite/scripts/lint_git.sh
plugins:
<<: *docker_plugin

- label: Lint Go node
command:
- .buildkite/go/lint.sh
Expand Down
19 changes: 0 additions & 19 deletions .buildkite/scripts/lint_git.sh

This file was deleted.

6 changes: 4 additions & 2 deletions .changelog/2572.internal.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
github: Add new steps to ci-lint workflow

Add _Lint Markdown files_ and _Lint Change Log fragments_ steps to ci-lint
GitHub Actions workflow.
Add _Lint git commits_, _Lint Markdown files_ and _Lint Change Log fragments_
steps to ci-lint GitHub Actions workflow.

Remove _Lint Git commits_ step from Buildkite's CI pipeline.
1 change: 1 addition & 0 deletions .changelog/2662.internal.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ Make: Add lint targets
Add a general `lint` target that depends on the following lint targets:

- `lint-go`: Lint Go code,
- `lint-git`: Lint git commits,
- `lint-md`: Lint Markdown files (except Change Log fragments),
- `lint-changelog`: Lint Change Log fragments.
8 changes: 8 additions & 0 deletions .changelog/2692.internal.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Make: Add lint targets

Add a general `lint` target that depends on the following lint targets:

- `lint-go`: Lint Go code,
- `lint-git`: Lint git commits,
- `lint-md`: Lint Markdown files (except Change Log fragments),
- `lint-changelog`: Lint Change Log fragments.
6 changes: 6 additions & 0 deletions .changelog/2692.internal.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
github: Add new steps to ci-lint workflow

Add _Lint git commits_, _Lint Markdown files_ and _Lint Change Log fragments_
steps to ci-lint GitHub Actions workflow.

Remove _Lint Git commits_ step from Buildkite's CI pipeline.
1 change: 1 addition & 0 deletions .changelog/2692.internal.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gitlint: Require body length of at least 20 characters (if body exists)
12 changes: 12 additions & 0 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
# Check out pull request's HEAD commit instead of the merge commit to
# prevent gitlint from failing due to too long commit message titles,
# e.g. "Merge 3e621938d65caaa67f8e35d145335d889d470fc8 into 19a39b2f66cd7a165082d1486b2f1eb36ec2354a".
ref: ${{ github.event.pull_request.head.sha }}
# Fetch all history so gitlint can check the relevant commits.
fetch-depth: '0'
- name: Set up Python 3
uses: actions/setup-python@v1
- name: Set up Node.js 12
Expand All @@ -45,6 +52,11 @@ jobs:
env:
BASE_BRANCH: ${{ github.base_ref }}
if: github.event_name == 'pull_request'
- name: Lint git commits
run: |
make lint-git
# Always run this step so that all linting errors can be seen at once.
if: always()
- name: Lint Markdown files
run: |
make lint-md
Expand Down
6 changes: 3 additions & 3 deletions .gitlint
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ ignore=body-is-missing
[title-max-length]
line-length=72

[B1]
[body-max-line-length]
line-length=80

[B5]
min-length=0
[body-min-length]
min-length=20

[title-must-not-contain-word]
words=wip
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,17 @@ fmt-go:

fmt: $(fmt-targets)

# Lint code and documentation.
lint-targets := lint-go lint-md lint-changelog
# Lint code, commits and documentation.
lint-targets := lint-go lint-git lint-md lint-changelog

lint-go:
@$(MAKE) -C go lint

lint-git: fetch-git
@COMMIT_SHA=`git rev-parse $(OASIS_CORE_GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH)` && \
echo "Running gitlint for commits from $(OASIS_CORE_GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH) ($${COMMIT_SHA:0:7})..."; \
gitlint --commits $(OASIS_CORE_GIT_ORIGIN_REMOTE)/$(RELEASE_BRANCH)...HEAD

lint-md:
@npx markdownlint-cli '**/*.md' --ignore .changelog/

Expand All @@ -76,7 +81,7 @@ lint-changelog:
npx markdownlint-cli --config .changelog/.markdownlint.yml .changelog/ || exit_status=$$?; \
for fragment in $(CHANGELOG_FRAGMENTS_NON_TRIVIAL); do \
echo "Running gitlint on $$fragment..."; \
gitlint --msg-filename $$fragment || exit_status=$$?; \
gitlint --msg-filename $$fragment -c title-max-length.line-length=78 || exit_status=$$?; \
done; \
exit $$exit_status

Expand Down