From 81c771926ccb2d2eb1ec437d4d4d8428ccbc3d25 Mon Sep 17 00:00:00 2001 From: Patrick Hobusch Date: Mon, 18 Mar 2024 18:52:47 +0800 Subject: [PATCH] Unify GitHub action workflows, upgrade versions --- .github/workflows/{ci_main.yaml => ci.yaml} | 62 ++++++----- .github/workflows/ci_pull_request.yaml | 115 -------------------- README.md | 2 +- 3 files changed, 37 insertions(+), 142 deletions(-) rename .github/workflows/{ci_main.yaml => ci.yaml} (75%) delete mode 100644 .github/workflows/ci_pull_request.yaml diff --git a/.github/workflows/ci_main.yaml b/.github/workflows/ci.yaml similarity index 75% rename from .github/workflows/ci_main.yaml rename to .github/workflows/ci.yaml index 0ff3d16..d1756bf 100644 --- a/.github/workflows/ci_main.yaml +++ b/.github/workflows/ci.yaml @@ -1,26 +1,30 @@ -name: CI Main +name: CI on: push: branches: - 'main' + pull_request: + branches: + - 'main' jobs: package: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - name: Set up JDK 11 - uses: actions/setup-java@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v4 with: - java-version: 11 + java-version: 17 + distribution: temurin - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache Maven packages - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2 key: confapi-plugin-${{ hashFiles('**/pom.xml') }} @@ -35,23 +39,24 @@ jobs: unit-tests: needs: package - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} steps: - - name: Set up JDK 11 - uses: actions/setup-java@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v4 with: - java-version: 11 + java-version: 17 + distribution: temurin - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache Maven package - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2 key: confapi-plugin-${{ hashFiles('**/pom.xml') }} @@ -63,19 +68,21 @@ jobs: integration-tests: needs: package - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + # The integration test is not compatible with Java 17 java-version: 11 + distribution: temurin - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache Maven package - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2 key: confapi-plugin-${{ hashFiles('**/pom.xml') }} @@ -87,7 +94,9 @@ jobs: deploy: needs: [unit-tests, integration-tests] - runs-on: ubuntu-20.04 + if: github.event_name == 'push' # to 'main' + + runs-on: ubuntu-22.04 env: GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} @@ -99,16 +108,17 @@ jobs: SIGN_ASC_IV: ${{ secrets.SIGN_ASC_IV }} steps: - - name: Set up JDK 11 - uses: actions/setup-java@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v4 with: - java-version: 11 + java-version: 17 + distribution: temurin - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache Maven package - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2 key: confapi-plugin-${{ hashFiles('**/pom.xml') }} @@ -126,7 +136,7 @@ jobs: apcc: needs: deploy - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Set up JDK 11 @@ -135,10 +145,10 @@ jobs: java-version: 11 - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache Maven package - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2 key: confapi-plugin-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/ci_pull_request.yaml b/.github/workflows/ci_pull_request.yaml deleted file mode 100644 index 1d81c1d..0000000 --- a/.github/workflows/ci_pull_request.yaml +++ /dev/null @@ -1,115 +0,0 @@ -name: CI Pull Requests - -on: - pull_request: - branches: - - 'main' - -jobs: - package: - - runs-on: ubuntu-20.04 - - steps: - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - - name: Checkout Code - uses: actions/checkout@v2 - - - name: Cache Maven packages - uses: actions/cache@v2 - with: - path: ~/.m2 - key: confapi-plugin-${{ hashFiles('**/pom.xml') }} - restore-keys: confapi-plugin - - - name: Download Dependencies - run: ./mvnw dependency:go-offline -U -B - - - name: Build with Maven - run: ./mvnw package -DskipUnitTests -B - - unit-tests: - needs: package - - runs-on: ubuntu-20.04 - - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - steps: - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - - name: Checkout Code - uses: actions/checkout@v2 - - - name: Cache Maven package - uses: actions/cache@v2 - with: - path: ~/.m2 - key: confapi-plugin-${{ hashFiles('**/pom.xml') }} - restore-keys: confapi-plugin - - - name: Run Unit Tests and analyze on SonarCloud - run: ./mvnw test sonar:sonar -B - - integration-tests: - needs: package - - runs-on: ubuntu-20.04 - - steps: - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - - name: Checkout Code - uses: actions/checkout@v2 - - - name: Cache Maven package - uses: actions/cache@v2 - with: - path: ~/.m2 - key: confapi-plugin-${{ hashFiles('**/pom.xml') }} - restore-keys: confapi-plugin - - - name: Run Integration Tests - run: ./mvnw integration-test -DskipUnitTests -B - - apcc: - needs: package - - runs-on: ubuntu-20.04 - - steps: - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - - name: Checkout Code - uses: actions/checkout@v2 - - - name: Cache Maven package - uses: actions/cache@v2 - with: - path: ~/.m2 - key: confapi-plugin-${{ hashFiles('**/pom.xml') }} - restore-keys: confapi-plugin - - - name: Download APCC - run: ./mvnw dependency:get -DgroupId=de.aservo -DartifactId=atlassian-plugin-compatibility-check -Dversion=0.0.2 - - - name: Copy APCC to current Directory - run: ./mvnw dependency:copy -Dartifact=de.aservo:atlassian-plugin-compatibility-check:0.0.2 -DoutputDirectory=. - - - name: Run APCC - run: java -jar atlassian-plugin-compatibility-check-0.0.2.jar "jira.version" diff --git a/README.md b/README.md index a38c8ed..17b09d7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ConfAPI for Jira ================ [![Maven Central](https://maven-badges.herokuapp.com/maven-central/de.aservo.atlassian/confapi-jira-plugin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/de.aservo.atlassian/confapi-jira-plugin) -[![Build Status](https://github.com/aservo/confapi-jira-plugin/actions/workflows/ci_main.yaml/badge.svg)](https://github.com/aservo/confapi-jira-plugin/actions/workflows/ci_main.yaml) +[![Build Status](https://github.com/aservo/confapi-jira-plugin/actions/workflows/ci.yaml/badge.svg)](https://github.com/aservo/confapi-jira-plugin/actions/workflows/ci.yaml) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=aservo_confapi-jira-plugin&metric=coverage)](https://sonarcloud.io/dashboard?id=aservo_confapi-jira-plugin) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=aservo_confapi-jira-plugin&metric=alert_status)](https://sonarcloud.io/dashboard?id=aservo_confapi-jira-plugin) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)