Skip to content

Commit

Permalink
Github actions: Require code to be formatted with Spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
Huulivoide committed Jun 13, 2024
1 parent 2825ccb commit daf9d90
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ on:
workflow_dispatch:

jobs:
run_spotless_check:
name: Check code is formatted with Spotless
uses: ./.github/workflows/spotless.yml

run_java_tests:
needs: run_spotless_check
name: Run Java tests
uses: ./.github/workflows/java-tests.yml

Expand Down Expand Up @@ -64,6 +69,7 @@ jobs:
run_e2e_tests:
needs:
- run_spotless_check
- run_java_tests
- push_to_registry
name: Run E2E tests
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/spotless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 'Spotless'
on:
# this workflow is only called by others, won't be executed on itself
workflow_call:

jobs:
spotless:
name: Check code is formatted with Spotless
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
java-package: jdk
architecture: x64
distribution: temurin

- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Run Spotless Check
run: mvn spotless:check

0 comments on commit daf9d90

Please sign in to comment.