From 4eab08649f95e3e8028c6412dc9b4c3e404c0d0b Mon Sep 17 00:00:00 2001 From: Patrick Hobusch Date: Wed, 18 Oct 2023 18:00:59 +0800 Subject: [PATCH] Unify workflows for main push and pull requests --- .github/workflows/{ci_main.yaml => ci.yaml} | 9 +- .github/workflows/ci_pull_request.yaml | 115 -------------------- 2 files changed, 7 insertions(+), 117 deletions(-) rename .github/workflows/{ci_main.yaml => ci.yaml} (96%) delete mode 100644 .github/workflows/ci_pull_request.yaml diff --git a/.github/workflows/ci_main.yaml b/.github/workflows/ci.yaml similarity index 96% rename from .github/workflows/ci_main.yaml rename to .github/workflows/ci.yaml index 5dcf020..8dbc85c 100644 --- a/.github/workflows/ci_main.yaml +++ b/.github/workflows/ci.yaml @@ -1,9 +1,12 @@ -name: CI Main +name: CI on: push: branches: - 'main' + pull_request: + branches: + - 'main' jobs: package: @@ -87,6 +90,8 @@ jobs: deploy: needs: [unit-tests, integration-tests] + if: github.event_name == 'push' # to 'main' + runs-on: ubuntu-20.04 env: @@ -124,7 +129,7 @@ jobs: run: export GPG_TTY=$(tty) && ./mvnw -s .github/workflows/settings.xml -DskipTests deploy -B apcc: - needs: deploy + needs: package runs-on: ubuntu-20.04 diff --git a/.github/workflows/ci_pull_request.yaml b/.github/workflows/ci_pull_request.yaml deleted file mode 100644 index a14c086..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.4 - - - name: Copy APCC to current Directory - run: ./mvnw dependency:copy -Dartifact=de.aservo:atlassian-plugin-compatibility-check:0.0.4 -DoutputDirectory=. - - - name: Run APCC - run: java -jar atlassian-plugin-compatibility-check-0.0.4.jar "crowd.version"