forked from apache/kafka
-
Notifications
You must be signed in to change notification settings - Fork 65
[LI-HOTFIX] Add a Github Actions workflow to trigger build and test upon PR and push #106
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
Merged
Lincong
merged 3 commits into
linkedin:2.4-li
from
Lincong:github-action-workflow-to-build-and-test
Jan 5, 2021
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License | ||
|
|
||
| name: Pull Request Build and Test Workflow | ||
|
|
||
| # Run this workflow every time a new pull request is created in the repository | ||
| on: | ||
| push: | ||
| branches: | ||
| # Push events on the 2.4-li branch | ||
| - '2.4-li' | ||
| # Push events on the 2.4-li-dev-* branch | ||
| - '2.4-li-dev-*' | ||
| pull_request: | ||
| types: [opened, reopened, edited, synchronize] | ||
|
Lincong marked this conversation as resolved.
Outdated
|
||
|
|
||
| jobs: | ||
| build: | ||
| # Name the Job | ||
| name: Build Pull Request | ||
| # Set the type of machine to run on | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| # Checks out a copy of your repository on the ubuntu-latest machine | ||
| - name: Checkout code | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| # bring in all history because the gradle versions plugin needs to "walk back" to the closest ancestor tag | ||
| fetch-depth: 0 | ||
| - name: Set up JDK 1.8 | ||
| uses: actions/setup-java@v1 | ||
| with: | ||
| java-version: 1.8 | ||
| - name: Build with Gradle | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| # exclude the streams test and connect test | ||
| run: ./gradlew cleanTest :clients:test :core:test --no-daemon -PxmlFindBugsReport=true -PtestLoggingEvents=started,passed,skipped,failed | ||
|
Lincong marked this conversation as resolved.
Outdated
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this workflow will also be triggered when pushing to these branches. Is this the intended behavior? Or you want it to be triggered only on pull request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I do intend to trigger this workflow whenever those branches are updated (a PR is merged to it or someone force push to it).
If we do not include the
pushevent here, will the workflow be trigger when we merge a PR to any of those branches?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, then you may want to change the name / description here:
"name: Pull Request Build and Test Workflow
Run this workflow every time a new pull request is created in the repository"
It looks like it will just happen during a PR creation.
Otherwise all look good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for triggering the test workflow upon push events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The motivation is that when we need to force-push to a branch, we hope to trigger this workflow too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, we should never allow force push to an official branch such as 2.4-li.
Assuming there are no force-pushes, then it seems we don't need to trigger CI on regular push events.
I'd suggest we remove these, what do you think?