From 327baba388212ff6e4747cb31efdca609b845c40 Mon Sep 17 00:00:00 2001 From: Yanick Minder Date: Fri, 15 Nov 2024 13:50:24 +0100 Subject: [PATCH] update readme and pipeline --- .github/workflows/format-action.yml | 47 +++++------------------------ backend/README.md | 11 +++---- backend/pom.xml | 6 ++-- 3 files changed, 16 insertions(+), 48 deletions(-) diff --git a/.github/workflows/format-action.yml b/.github/workflows/format-action.yml index 8ab0c9dd70..e57db39e56 100644 --- a/.github/workflows/format-action.yml +++ b/.github/workflows/format-action.yml @@ -3,7 +3,7 @@ name: 'Format' on: [push] jobs: - Frontend: + frontend: runs-on: ubuntu-latest defaults: run: @@ -15,33 +15,19 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 22.10.0 + node-version: ${{vars.NODE_VERSION}} - name: Npm install run: npm ci - name: Format frontend - run: npm run format + run: npm run check - - name: Commit and Push formated frontend - shell: bash - env: - COMMITPREFIX: '[FM]' - run: | - git config --global user.email "actions@github.com" - git config --global user.name "GitHub Actions" - git add . || { - echo "No files were changed, so we did not commit anything" - exit 1 - } - git commit -m "$COMMITPREFIX Automated formating frontend" || { - echo "No changes to commit, skipping push" - exit 0 - } - git push -f - - Backend: + backend: runs-on: ubuntu-latest + defaults: + run: + working-directory: backend steps: - name: Checkout uses: actions/checkout@v4 @@ -55,21 +41,4 @@ jobs: settings-path: ${{github.workspace}} - name: Format backend - run: mvn formatter:format -f backend/pom.xml - - - name: Commit and Push formated backend - shell: bash - env: - COMMITPREFIX: '[FM]' - run: | - git config --global user.email "actions@github.com" - git config --global user.name "GitHub Actions" - git add . || { - echo "No files were changed, so we did not commit anything" - exit 1 - } - git commit -m "$COMMITPREFIX Automated formating backend" || { - echo "No changes to commit, skipping push" - exit 0 - } - git push -f \ No newline at end of file + run: mvn spotless:check \ No newline at end of file diff --git a/backend/README.md b/backend/README.md index 127c7150a1..b31e5267e7 100644 --- a/backend/README.md +++ b/backend/README.md @@ -33,17 +33,16 @@ USING DOCKER - backend/target Formatting: -- Check code formatting: `mvn formatter:validate` -- Format the code: `mvn formatter:format` +- Check code formatting: `mvn spotless:check` +- Format the code: `mvn spotless:apply` -The `compile` goal execute also a `formatter:format` goal. +The `compile` goal execute also a `spotless:apply` goal. Verify the Backend for coverage check: - `mvn clean verify` ## Formatting -We use the **formatter-maven-plugin** Plugin for formatting the Java code: -https://code.revelc.net/formatter-maven-plugin/ - +We use the **spotless** Plugin for formatting the Java code: +https://github.com/diffplug/spotless ## Build _tbd_ diff --git a/backend/pom.xml b/backend/pom.xml index b51afc91c5..dc933a17df 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -313,9 +313,9 @@ - net.revelc.code.formatter - formatter-maven-plugin - 2.24.1 + com.diffplug.spotless + spotless-maven-plugin + 2.43.0 code-format