Skip to content

Comments

Add static-checks Github Action#13347

Merged
abhishekagarwal87 merged 15 commits intoapache:masterfrom
tejaswini-imply:add-static_checks_github_action
Nov 17, 2022
Merged

Add static-checks Github Action#13347
abhishekagarwal87 merged 15 commits intoapache:masterfrom
tejaswini-imply:add-static_checks_github_action

Conversation

@tejaswini-imply
Copy link
Member

We are moving away from the Travis CI/CD pipeline to GitHub Actions. As the first step, this PR adds static-checks GitHub action (triggered on any pull request activity) to run all the below steps:

animal sniffer checks
checkstyle
enforcer checks
forbidden api checks
pmd checks
spotbugs checks
license checks
license checks for hadoop 3
script checks
analyze dependencies
analyze hadoop 3 dependencies
(openjdk11) strict compilation

Optimizations implemented:

  1. Caching maven dependencies.
  2. Running checks parallelly.
  3. Concurrency - single job per PR at a time.


name: Static Checks CI
on:
pull_request:
Copy link
Member

Choose a reason for hiding this comment

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

I think we also need this GitHub Action to run on each commit on master and release branch.

e.g.

on:
  push:
    branches: [ master ]

Copy link
Member

Choose a reason for hiding this comment

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

BTW, why does the GitHub Action not run for this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

it's possible that Infra needs to enable actions for this repo?

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems like it. This runs on a PR raised in the fork repo.

Copy link
Contributor

Choose a reason for hiding this comment

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

https://the-asf.slack.com/archives/CBX4TSBQ8/p1668410098261039 - We need to merge the first PR before it can get triggered.

@cryptoe cryptoe added the Area - Dev For items related to the project itself, like dev docs and checklists, but not CI label Nov 13, 2022
@tejaswini-imply
Copy link
Member Author

Here is the Static Checks CI GitHub actions on a forked repo - https://github.com/tejaswini-imply/druid/actions/runs/3442505350

Copy link
Contributor

@imply-elliott imply-elliott left a comment

Choose a reason for hiding this comment

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

Generally looks great for a basic pipeline we can iterate upon!

cache: 'maven'
- run: |
echo 'Running Maven install...' &&
MAVEN_OPTS='-Xmx3000m' \
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move this to a env variable so it's set the same way as others and universally applied:

env:
  MAVEN_OPTS: -Xmx3000m


sudo apt-get update && sudo apt-get install python3 -y
curl https://bootstrap.pypa.io/pip/3.5/get-pip.py | sudo -H python3
../../check_test_suite.py && travis_terminate 0 || echo 'Continuing setup'
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this reference to travis_terminate here? I saw this in my tests too and I don't think this will work in Actions?

java-version: '8'
cache: 'maven'
- run: |-
MAVEN_OPTS='-Xmx3000m' ${MVN} ${MAVEN_SKIP} dependency:analyze -DoutputXML=true -DignoreNonCompile=true -DfailOnWarning=true ${{ matrix.HADOOP_PROFILE }} ||
Copy link
Contributor

Choose a reason for hiding this comment

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

We can pull out MAVEN_OPTS here when set as a global env variable.

# errorprone requires JDK 11
# Strict compilation requires more than 2 GB
- run: |
MAVEN_OPTS='-Xmx3000m' ${MVN} clean -DstrictCompile compile test-compile --fail-at-end ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS}
Copy link
Contributor

Choose a reason for hiding this comment

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

We can pull out MAVEN_OPTS here when set as a global env variable.

needs: [build]
steps:
- uses: actions/checkout@v3
- name: setup java 8
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we expect to only run some of these checks with java 8, or should they eventually be run for all supported versions?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe eventually, This is the existing flow with Travis checks.

@tejaswini-imply
Copy link
Member Author

Thanks for the review @imply-elliott, I have addressed your comments in the latest commit. PTAL.

Copy link
Contributor

@imply-elliott imply-elliott left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my comments!

@abhishekagarwal87 abhishekagarwal87 merged commit 8e9e46b into apache:master Nov 17, 2022
@kfaraz kfaraz added this to the 25.0 milestone Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area - Dev For items related to the project itself, like dev docs and checklists, but not CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants