From 8f1d73d9ba4faa7f00d0570f58f0ef717f459ac6 Mon Sep 17 00:00:00 2001 From: Johannes Coetzee Date: Fri, 21 Jun 2024 17:26:29 +0200 Subject: [PATCH 1/2] Move formatting workflows into separate file --- .github/workflows/formatting_check.yml | 63 ++++++++++++++++++++++++++ .github/workflows/maven_tests.yml | 37 --------------- 2 files changed, 63 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/formatting_check.yml diff --git a/.github/workflows/formatting_check.yml b/.github/workflows/formatting_check.yml new file mode 100644 index 0000000000..4e562675fe --- /dev/null +++ b/.github/workflows/formatting_check.yml @@ -0,0 +1,63 @@ +name: Check codegen and formatting + +#on: [push, pull_request] +#on: [pull_request] +on: + # Trigger the workflow on push to master (ignoring .md only changes) + push: + branches: + - master + paths-ignore: + - '**.md' + + # Trigger the workflow on any pull_request (ignoring .md only changes) + pull_request: + paths-ignore: + - '**.md' + + # Enable manual triggering (important for contributors to enable a check on their fork) + workflow_dispatch: + +# If a build is running in the current branch, and the branch is updated, we cancel the previous build and start +# a new one with the updated changes. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + # Run checkstyle validations for pipeline + checkstyle_check: + name: Validate checkstyle + runs-on: ubuntu-latest + steps: + - name: Checkout latest code + uses: actions/checkout@v4.1.7 + with: + fetch-depth: "0" + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'zulu' + - name: Validate Project Checkstyle + run: ./mvnw -B checkstyle:check + + spotless_check: + name: Validate code generation and formatting + runs-on: ubuntu-latest + steps: + - name: Checkout latest code + uses: actions/checkout@v4.1.7 + with: + fetch-depth: "0" + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'zulu' + - name: Generate code and format + run: | + ./run_core_metamodel_generator.sh + # ./run_core_generators.sh automatically runs ./mvnw spotless:apply + ./run_core_generators.sh + git diff --exit-code diff --git a/.github/workflows/maven_tests.yml b/.github/workflows/maven_tests.yml index 0603c1608a..ddabe7f3ff 100644 --- a/.github/workflows/maven_tests.yml +++ b/.github/workflows/maven_tests.yml @@ -101,40 +101,3 @@ jobs: verbose: false # optional (default = false): flags: javaparser-symbol-solver,AlsoSlowTests,${{ matrix.os }},jdk-${{ matrix.jdk }} env_vars: OS,JDK - - # Run checkstyle validations for pipeline - checkstyle_check: - name: Validate checkstyle - runs-on: ubuntu-latest - steps: - - name: Checkout latest code - uses: actions/checkout@v4.1.7 - with: - fetch-depth: "0" - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - java-version: '11' - distribution: 'zulu' - - name: Validate Project Checkstyle - run: ./mvnw -B checkstyle:check - - spotless_check: - name: Validate code generation and formatting - runs-on: ubuntu-latest - steps: - - name: Checkout latest code - uses: actions/checkout@v4.1.7 - with: - fetch-depth: "0" - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - java-version: '11' - distribution: 'zulu' - - name: Generate code and format - run: | - ./run_core_metamodel_generator.sh - # ./run_core_generators.sh automatically runs ./mvnw spotless:apply - ./run_core_generators.sh - git diff --exit-code From f4fe6f3bbf8f4864509fd828ba034c157511e3d0 Mon Sep 17 00:00:00 2001 From: Johannes Coetzee Date: Fri, 21 Jun 2024 18:21:43 +0200 Subject: [PATCH 2/2] Change spotless job name for clarity --- .github/workflows/formatting_check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/formatting_check.yml b/.github/workflows/formatting_check.yml index 4e562675fe..93aa36a7a2 100644 --- a/.github/workflows/formatting_check.yml +++ b/.github/workflows/formatting_check.yml @@ -43,7 +43,7 @@ jobs: run: ./mvnw -B checkstyle:check spotless_check: - name: Validate code generation and formatting + name: Spotless check runs-on: ubuntu-latest steps: - name: Checkout latest code