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

feat(CI): Added GitHub Actions to check for code style violations #13489

Merged
merged 41 commits into from
Jan 18, 2024
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c91b7db
feat: Added CI to auto-format files in PR
SaptarshiSarkar12 Dec 12, 2023
f4c6f51
Merge branch 'apache:3.2' into 3.2
SaptarshiSarkar12 Dec 12, 2023
6128c12
feat: Added GH Action to comment in PR if code is not formatted
SaptarshiSarkar12 Dec 23, 2023
2193b33
Merge branch 'apache:3.2' into 3.2
SaptarshiSarkar12 Dec 23, 2023
885a645
Merge branch '3.2' of github.com:SaptarshiSarkar12/dubbo into 3.2
SaptarshiSarkar12 Dec 23, 2023
3fd6a45
test: Added a slight mistake in code style in one of the java file
SaptarshiSarkar12 Dec 23, 2023
767d09a
CI: Added a `continue-on-error` tag to continue the whole workflow
SaptarshiSarkar12 Dec 23, 2023
1af0ccd
CI: Updated github-actions-script to v6
SaptarshiSarkar12 Dec 23, 2023
2c2e587
CI: Changed to gh cli from gh-actions-script
SaptarshiSarkar12 Dec 23, 2023
dab6cf2
CI: Fixed syntax error in format workflow
SaptarshiSarkar12 Dec 23, 2023
bf5b8b0
CI: Fixed syntax error in format workflow
SaptarshiSarkar12 Dec 23, 2023
e71580d
CI: Fixed syntax error in format workflow
SaptarshiSarkar12 Dec 23, 2023
c82d903
Merge branch '3.2' into 3.2
SaptarshiSarkar12 Dec 26, 2023
3694f50
feat(CI): Added scheduled cron jobs to check for formatting
SaptarshiSarkar12 Dec 26, 2023
ff9f2f3
chore: Shortened formatter Workflow name
SaptarshiSarkar12 Dec 26, 2023
3f65420
fix: Changed `check-format` CI to trigger on push
SaptarshiSarkar12 Jan 3, 2024
6ad4643
Merge branch '3.2' into 3.2
SaptarshiSarkar12 Jan 3, 2024
7ebf0a4
Merge branch '3.2' into 3.2
SaptarshiSarkar12 Jan 4, 2024
1589a21
fix: `Check-Format` CI should now run on push
SaptarshiSarkar12 Jan 4, 2024
6522f8a
fix: `Check-Format` CI should now run on pull requests
SaptarshiSarkar12 Jan 4, 2024
ecee9f5
chore: Create an extra tab space in one of the Java files for CI testing
SaptarshiSarkar12 Jan 4, 2024
99fe214
feat(CI): Added workflow summary feature to check-format CI
SaptarshiSarkar12 Jan 4, 2024
6243a0c
feat(CI): Added workflow summary feature to check-format CI
SaptarshiSarkar12 Jan 4, 2024
d2b328b
feat(CI): Added workflow summary feature to check-format CI
SaptarshiSarkar12 Jan 4, 2024
93b1de7
fix(CI): Fixed gh run in generating workflow summary feature to check…
SaptarshiSarkar12 Jan 4, 2024
25238be
fix(CI): Fixed gh run in generating workflow summary feature to check…
SaptarshiSarkar12 Jan 4, 2024
06695ef
fix(CI): Fixed gh run in generating workflow summary feature to check…
SaptarshiSarkar12 Jan 4, 2024
61d55ac
fix(CI): Fixed gh run in generating workflow summary feature to check…
SaptarshiSarkar12 Jan 4, 2024
bb133d6
fix(CI): Fixed workflow summary generation feature to check-format CI
SaptarshiSarkar12 Jan 4, 2024
2df0973
fix(CI): Fixed backtick issue in workflow summary
SaptarshiSarkar12 Jan 4, 2024
592b60c
Merge branch '3.2' into 3.2
SaptarshiSarkar12 Jan 8, 2024
a20d6b8
feat: Added a line in summary to ask how can they fix the code style …
SaptarshiSarkar12 Jan 8, 2024
b441af8
fix: Reduced font size of reminder
SaptarshiSarkar12 Jan 8, 2024
98ed260
fix: Reduced font size of reminder
SaptarshiSarkar12 Jan 8, 2024
f990797
Merge branch '3.2' into 3.2
SaptarshiSarkar12 Jan 10, 2024
2ee8627
feat(CI): Merged `format-check` workflow into `Build and Test PR` wor…
SaptarshiSarkar12 Jan 10, 2024
4134b06
Merge branch '3.2' of github.com:SaptarshiSarkar12/dubbo into 3.2
SaptarshiSarkar12 Jan 10, 2024
39d4a2d
Merge branch '3.2' into 3.2
SaptarshiSarkar12 Jan 10, 2024
dda326b
Merge branch '3.2' into 3.2
SaptarshiSarkar12 Jan 17, 2024
c839869
Merge branch '3.2' of github.com:apache/dubbo into 3.2
SaptarshiSarkar12 Jan 18, 2024
596aa44
chore: Removed unnecessary whitespace changes
SaptarshiSarkar12 Jan 18, 2024
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
61 changes: 55 additions & 6 deletions .github/workflows/build-and-test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,49 @@ env:
'

jobs:
check-format:
name: Check if code needs formatting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Maven
uses: actions/setup-java@v4
with:
java-version: 21
distribution: zulu
- name: Check if code aligns with code style
id: check
run: mvn --log-file mvn.log spotless:check
continue-on-error: true
- name: Upload checkstyle result
uses: actions/upload-artifact@v4
with:
name: checkstyle-result
path: mvn.log
- name: Generate Summary for successful run
if: ${{ steps.check.outcome == 'success' }}
run: |
echo ":ballot_box_with_check: Kudos! No formatting issues found!" >> $GITHUB_STEP_SUMMARY
- name: Generate Summary for failed run
if: ${{ steps.check.outcome == 'failure' }}
run: |
echo "## :negative_squared_cross_mark: Formatting issues found!" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
cat mvn.log | grep "ERROR" | sed 's/Check if code needs formatting Check if code aligns with code style [0-9A-Z:.-]\+//' | sed 's/\[ERROR] //' | head -n -11 >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "Please run \`mvn spotless:apply\` to fix the formatting issues." >> $GITHUB_STEP_SUMMARY
- name: Fail if code needs formatting
if: ${{ steps.check.outcome == 'failure' }}
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
core.setFailed("Formatting issues found!")

license:
name: "Check License"
needs: check-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -43,6 +85,8 @@ jobs:
mode: check

build-source:
name: "Build Dubbo"
needs: check-format
runs-on: ubuntu-latest
outputs:
version: ${{ steps.dubbo-version.outputs.version }}
Expand Down Expand Up @@ -98,6 +142,7 @@ jobs:

unit-test-prepare:
name: "Preparation for Unit Test"
needs: check-format
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -146,7 +191,7 @@ jobs:
echo "--- End Print Rsa Public Key"

unit-test:
needs: [build-source, unit-test-prepare]
needs: [check-format, build-source, unit-test-prepare]
name: "Unit Test On ubuntu-latest"
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -212,6 +257,7 @@ jobs:
path: "**/target/site/**/jacoco.xml"

samples-test-prepare:
needs: check-format
runs-on: ubuntu-latest
env:
JOB_COUNT: 3
Expand All @@ -229,7 +275,7 @@ jobs:
name: samples-test-list
path: test/jobs
samples-test-job:
needs: [build-source, samples-test-prepare]
needs: [check-format, build-source, samples-test-prepare]
name: "Samples Test on ubuntu-latest (JobId: ${{matrix.job_id}})"
runs-on: ubuntu-latest
timeout-minutes: 90
Expand Down Expand Up @@ -296,7 +342,7 @@ jobs:
name: samples-test-result
path: test/jobs/*-result*
samples-test-result:
needs: [samples-test-job]
needs: [check-format, samples-test-job]
if: always()
runs-on: ubuntu-latest
env:
Expand All @@ -315,6 +361,7 @@ jobs:
run: ./test/scripts/merge-test-results.sh

integration-test-prepare:
needs: check-format
runs-on: ubuntu-latest
env:
JOB_COUNT: 3
Expand All @@ -332,7 +379,7 @@ jobs:
name: test-list
path: test/jobs
integration-test-job:
needs: [build-source, integration-test-prepare]
needs: [check-format, build-source, integration-test-prepare]
name: "Integration Test on ubuntu-latest (JobId: ${{matrix.job_id}})"
runs-on: ubuntu-latest
timeout-minutes: 90
Expand Down Expand Up @@ -399,7 +446,7 @@ jobs:
name: test-result
path: test/jobs/*-result*
integration-test-result:
needs: [integration-test-job]
needs: [check-format, integration-test-job]
if: always()
runs-on: ubuntu-latest
env:
Expand All @@ -419,7 +466,7 @@ jobs:

jacoco-result-merge:
runs-on: ubuntu-latest
needs: [integration-test-result, samples-test-result, unit-test]
needs: [check-format, integration-test-result, samples-test-result, unit-test]
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -475,6 +522,7 @@ jobs:
verbose: true

error-code-inspecting:
needs: check-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -513,6 +561,7 @@ jobs:
path: ${{ github.workspace }}/dubbo-test-tools/dubbo-error-code-inspector/error-inspection-result.txt

native-image-inspecting:
needs: check-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
Loading