From e356a77bc2e683fb7996c7a3235864f8942e8022 Mon Sep 17 00:00:00 2001 From: Tglman Date: Tue, 25 Jun 2024 17:29:20 +0200 Subject: [PATCH] chore: update ci configuration with newer config and java versions --- .github/workflows/maven_java_8.yml | 36 ------------- .github/workflows/release.yml | 28 ---------- .github/workflows/tests.yml | 83 ++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 64 deletions(-) delete mode 100644 .github/workflows/maven_java_8.yml delete mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/maven_java_8.yml b/.github/workflows/maven_java_8.yml deleted file mode 100644 index e77a08d..0000000 --- a/.github/workflows/maven_java_8.yml +++ /dev/null @@ -1,36 +0,0 @@ -# This workflow will build a Java project with Maven -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven - -name: Java 8 CI with Maven - -on: - push: - branches: [ develop, 3.1.x, 3.0.x ] - pull_request: - branches: [ develop, 3.1.x, 3.0.x ] - workflow_dispatch: - schedule: - - cron: 0 5 * * 1 - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 8 - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'adopt' - # Step that does that actual cache save and restore - - name: Cache - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Build with Maven - run: mvn -B package --file pom.xml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index fb36cb2..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,28 +0,0 @@ -# This workflow will build a Java project with Maven -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven - -name: Publish Release -on: - workflow_dispatch: - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Maven Central Repository - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'adopt' - server-id: sonatype-nexus-staging - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} - gpg-passphrase: MAVEN_GPG_PASSPHRASE - - name: Publish Release - run: mvn --batch-mode --no-transfer-progress deploy -DskipTests -DperformRelease -DcreateChecksum=true - env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..da0724b --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,83 @@ +# This workflow will build a Java project with Maven +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Java CI with Maven + +on: + push: + branches: [ develop, 3.2.x ] + pull_request: + branches: [ develop, 3.2.x ] + workflow_dispatch: + schedule: + - cron: 0 5 * * 1 + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + java-version: ['19', '21'] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK ${{matrix.java-version}} PR + uses: actions/setup-java@v4 + with: + java-version: ${{matrix.java-version}} + distribution: 'temurin' + # Step that does that actual cache save and restore + - name: Cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Build with Maven + run: mvn -B package --file pom.xml + + build-and-snapshot: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + java-version: ['17'] + steps: + - uses: actions/checkout@v4 + - name: Set up JDK ${{matrix.java-version}} PR + if: github.event_name == 'pull_request' + uses: actions/setup-java@v4 + with: + java-version: ${{matrix.java-version}} + distribution: 'temurin' + # Step that does that actual cache save and restore + - name: Set up JDK ${{matrix.java-version}} Branch + if: github.event_name != 'pull_request' + uses: actions/setup-java@v4 + with: + java-version: ${{matrix.java-version}} + distribution: 'temurin' + server-id: sonatype-nexus-snapshots + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + # Step that does that actual cache save and restore + - name: Cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Build with Maven + run: mvn -B package --file pom.xml + - name: Publish Snapshot + if: github.event_name != 'pull_request' + run: mvn -B clean deploy -P all -DskipTests --file pom.xml + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}