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

Run Unit tests, ITs in parallel if PR is approved. Upgrade checkstyle version #17611

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
68 changes: 55 additions & 13 deletions .github/workflows/unit-and-integration-tests-unified.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,55 @@ jobs:
echo ${{ needs.set-env-var.outputs.DRUID_PREVIOUS_IT_IMAGE_NAME }}
docker save "${{ needs.set-env-var.outputs.DRUID_PREVIOUS_IT_IMAGE_NAME }}" | gzip > druid-container-jdk${{ matrix.jdk }}-version${{ needs.set-env-var.outputs.DRUID_PREVIOUS_VERSION }}.tar.gz

# check if it is a PR and if it is approved. For approved PRs, we do not want to run tests sequentially
check-approval:
runs-on: ubuntu-latest
outputs:
approved: ${{ steps.check.outputs.isApproved }}
steps:
- name: Check if Triggered by a PR
id: determine-trigger
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "isPR=true" >> $GITHUB_ENV
else
echo "isPR=false" >> $GITHUB_ENV

- name: Check PR Approval (if applicable)
id: check
if: ${{ env.isPR == 'true' }}
uses: actions/github-script@v7
with:
script: |
const reviews = await github.rest.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});
const approved = reviews.data.some(review => review.state === 'APPROVED');
core.setOutput("isApproved", approved);

- name: Default to Approved for Branch
id: default-check
if: ${{ env.isPR == 'false' }}
run: echo "::set-output name=isApproved::true"

unit-tests-unapproved:
name: "unit tests - PR unapproved - (jdk17)"
uses: ./.github/workflows/unit-tests.yml
needs: [build, check-approval]
if: ${{ needs.check-approval.outputs.approved != 'true' }}
with:
jdk: 17

unit-tests-approved:
name: "unit tests - PR approved - (jdk17)"
uses: ./.github/workflows/unit-tests.yml
needs: [build, check-approval]
if: ${{ needs.check-approval.outputs.approved == 'true' }}
with:
jdk: 17

unit-tests-phase2:
strategy:
fail-fast: false
Expand All @@ -165,26 +214,19 @@ jobs:
jdk: [ '11', '21.0.4' ]
name: "unit tests (jdk${{ matrix.jdk }})"
uses: ./.github/workflows/unit-tests.yml
needs: unit-tests
if: ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
needs: [unit-tests-unapproved, check-approval]
if: ${{ always() && (needs.check-approval.outputs.approved == 'true' || needs.unit-tests-unapproved.result == 'success' || needs.unit-tests-unapproved.outputs.continue_tests) }}
with:
jdk: ${{ matrix.jdk }}

unit-tests:
name: "unit tests (jdk17)"
uses: ./.github/workflows/unit-tests.yml
needs: build
with:
jdk: 17

standard-its:
needs: unit-tests
if: ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
needs: [unit-tests-unapproved, check-approval]
if: ${{ always() && (needs.check-approval.outputs.approved == 'true' || needs.unit-tests-unapproved.result == 'success' || needs.unit-tests-unapproved.outputs.continue_tests) }}
uses: ./.github/workflows/standard-its.yml

revised-its:
needs: [unit-tests, set-env-var]
if: ${{ always() && (needs.unit-tests.result == 'success' || needs.unit-tests.outputs.continue_tests) }}
needs: [unit-tests-unapproved, check-approval, set-env-var]
if: ${{ always() && (needs.check-approval.outputs.approved == 'true' || needs.unit-tests-unapproved.result == 'success' || needs.unit-tests-unapproved.outputs.continue_tests) }}
uses: ./.github/workflows/revised-its.yml
with:
BACKWARD_COMPATIBILITY_IT_ENABLED: ${{ needs.set-env-var.outputs.BACKWARD_COMPATIBILITY_IT_ENABLED }}
Expand Down
4 changes: 2 additions & 2 deletions codestyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
-->

<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<module name="Checker">
<module name="Header">
Expand Down
5 changes: 2 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<version>3.6.0</version>
<configuration>
<sourceDirectories>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
Expand All @@ -1517,7 +1517,6 @@
<configLocation>codestyle/checkstyle.xml</configLocation>
<suppressionsLocation>codestyle/checkstyle-suppressions.xml</suppressionsLocation>
<suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
<encoding>UTF-8</encoding>
<headerLocation>codestyle/LICENSE.txt</headerLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
Expand All @@ -1529,7 +1528,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.21</version>
<version>10.20.1</version>
</dependency>
</dependencies>
<executions>
Expand Down
Loading