From a6485fcdee5ea483c9dcab444cce966140cd2fb5 Mon Sep 17 00:00:00 2001 From: Haotian Zhang <skyebefreeman@qq.com> Date: Wed, 5 Mar 2025 15:01:44 +0800 Subject: [PATCH] docs:simplify GitHub Actions. (#1514) --- .github/workflows/codecov_jdk17.yml | 34 --------- .github/workflows/codecov_jdk8.yml | 36 ---------- .github/workflows/junit.yml | 86 +++++++++++++++++++++++ .github/workflows/junit_test_jdk17-21.yml | 40 ----------- .github/workflows/junit_test_jdk8-21.yml | 43 ------------ .github/workflows/snapshot.yml | 78 ++++++++++++++++++++ .github/workflows/snapshot_jdk17.yml | 47 ------------- .github/workflows/snapshot_jdk8.yml | 48 ------------- CHANGELOG.md | 3 +- README.md | 2 +- 10 files changed, 167 insertions(+), 250 deletions(-) delete mode 100644 .github/workflows/codecov_jdk17.yml delete mode 100644 .github/workflows/codecov_jdk8.yml create mode 100644 .github/workflows/junit.yml delete mode 100644 .github/workflows/junit_test_jdk17-21.yml delete mode 100644 .github/workflows/junit_test_jdk8-21.yml create mode 100644 .github/workflows/snapshot.yml delete mode 100644 .github/workflows/snapshot_jdk17.yml delete mode 100644 .github/workflows/snapshot_jdk8.yml diff --git a/.github/workflows/codecov_jdk17.yml b/.github/workflows/codecov_jdk17.yml deleted file mode 100644 index 2a7216bbe..000000000 --- a/.github/workflows/codecov_jdk17.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Codecov with JDK 17 - -on: - push: - branches: - - 2024 - - 2023 - - 2022 - pull_request: - branches: - - 2024 - - 2023 - - 2022 - -jobs: - codecov: - runs-on: ubuntu-latest - - steps: - - name: Checkout codes - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 17 - - name: Test with Maven - run: mvn clean test -B -U -Psonatype - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: ${{ github.workspace }}/target/site/jacoco/jacoco.xml diff --git a/.github/workflows/codecov_jdk8.yml b/.github/workflows/codecov_jdk8.yml deleted file mode 100644 index bb7ba75a0..000000000 --- a/.github/workflows/codecov_jdk8.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Codecov with JDK 8 - -on: - push: - branches: - - 2021 - - 2020 - - hoxton - - greenwich - pull_request: - branches: - - 2021 - - 2020 - - hoxton - - greenwich - -jobs: - codecov: - runs-on: ubuntu-latest - - steps: - - name: Checkout codes - uses: actions/checkout@v4 - - name: Set up JDK 8 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 8 - - name: Test with Maven - run: mvn clean test -B -U -Psonatype - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: ${{ github.workspace }}/target/site/jacoco/jacoco.xml diff --git a/.github/workflows/junit.yml b/.github/workflows/junit.yml new file mode 100644 index 000000000..f3fd59429 --- /dev/null +++ b/.github/workflows/junit.yml @@ -0,0 +1,86 @@ +name: Junit Test + +on: + push: + branches: + - 2024 + - 2023 + - 2022 + - 2021 + - 2020 + - hoxton + - greenwich + pull_request: + branches: + - 2024 + - 2023 + - 2022 + - 2021 + - 2020 + - hoxton + - greenwich + +jobs: + set-jdks: + runs-on: ubuntu-latest + outputs: + jdks: ${{ steps.set-jdks.outputs.jdks }} + steps: + - name: Set JDK matrix based on branch + id: set-jdks + run: | + shopt -s nocasematch + branch_name=${{ github.ref_name }} + if [ -n "${{ github.base_ref }}" ]; then + branch_name=${{ github.base_ref }} + fi + echo $branch_name + if [[ "$branch_name" == "2024" ]]; then + echo "jdks=[17,21]" >> $GITHUB_OUTPUT + elif [[ "$branch_name" == "2023" ]]; then + echo "jdks=[17,21]" >> $GITHUB_OUTPUT + elif [[ "$branch_name" == "2022" ]]; then + echo "jdks=[17,21]" >> $GITHUB_OUTPUT + elif [[ "$branch_name" == "2021" ]]; then + echo "jdks=[8,11,17,21]" >> $GITHUB_OUTPUT + elif [[ "$branch_name" == "2020" ]]; then + echo "jdks=[8,11,17,21]" >> $GITHUB_OUTPUT + elif [[ "$branch_name" == "hoxton" ]]; then + echo "jdks=[8,11,17,21]" >> $GITHUB_OUTPUT + elif [[ "$branch_name" == "greenwich" ]]; then + echo "jdks=[8,11,17,21]" >> $GITHUB_OUTPUT + else + echo "jdks=[17]" >> $GITHUB_OUTPUT + fi + shopt -u nocasematch + junit: + strategy: + matrix: + java: ${{ fromJson(needs.set-jdks.outputs.jdks) }} + os: [ 'windows-latest', 'ubuntu-latest' ] + runs-on: ${{ matrix.os }} + needs: set-jdks + steps: + - name: Checkout codes + uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: ${{ matrix.java }} + - name: Cache local Maven repository + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Test with Maven + run: mvn clean test -B -U -Psonatype + - name: Upload coverage to Codecov + if: matrix.os == 'ubuntu-latest' && matrix.java == 17 + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: ${{ github.workspace }}/target/site/jacoco/jacoco.xml diff --git a/.github/workflows/junit_test_jdk17-21.yml b/.github/workflows/junit_test_jdk17-21.yml deleted file mode 100644 index 0d76c8bfb..000000000 --- a/.github/workflows/junit_test_jdk17-21.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Junit Test with JDK from 17 to 21 - -on: - push: - branches: - - 2024 - - 2023 - - 2022 - pull_request: - branches: - - 2024 - - 2023 - - 2022 - -jobs: - build: - strategy: - matrix: - java: [ 17, 21 ] - os: [ 'windows-latest', 'ubuntu-latest' ] - - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout codes - uses: actions/checkout@v4 - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: ${{ matrix.java }} - - name: Cache local Maven repository - uses: actions/cache@v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Test with Maven - run: mvn clean test -f pom.xml -B -P sonatype -U diff --git a/.github/workflows/junit_test_jdk8-21.yml b/.github/workflows/junit_test_jdk8-21.yml deleted file mode 100644 index 56af9ed31..000000000 --- a/.github/workflows/junit_test_jdk8-21.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Junit Test with JDK from 8 to 21 - -on: - push: - branches: - - 2021 - - 2020 - - hoxton - - greenwich - pull_request: - branches: - - 2021 - - 2020 - - hoxton - - greenwich - -jobs: - junit: - strategy: - matrix: - java: [ 8, 11, 17, 21 ] - os: [ 'windows-latest', 'ubuntu-latest' ] - - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout codes - uses: actions/checkout@v4 - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: ${{ matrix.java }} - - name: Cache local Maven repository - uses: actions/cache@v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Test with Maven - run: mvn clean test -B -U -Psonatype - diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml new file mode 100644 index 000000000..70b426b15 --- /dev/null +++ b/.github/workflows/snapshot.yml @@ -0,0 +1,78 @@ +name: Snapshot + +on: + push: + branches: + - 2024 + - 2023 + - 2022 + - 2021 + - 2020 + - hoxton + - greenwich + +jobs: + check-snapshot: + runs-on: ubuntu-latest + outputs: + IS_SNAPSHOT: ${{ steps.check-deploy-type.outputs.IS_SNAPSHOT }} + steps: + - name: Checkout codes + uses: actions/checkout@v4 + - name: Check deploy type + id: check-deploy-type + run: | + line="$(grep SNAPSHOT pom.xml || true)" + echo $line + if [ -n "$line" ]; then + echo "IS_SNAPSHOT=true" >> $GITHUB_OUTPUT + else + echo "IS_SNAPSHOT=false" >> $GITHUB_OUTPUT + fi + set-jdk: + runs-on: ubuntu-latest + outputs: + jdk: ${{ steps.set-jdk.outputs.jdk }} + steps: + - name: Set JDK based on branch + id: set-jdk + run: | + shopt -s nocasematch + if [[ "${{ github.ref_name }}" == "2024" ]]; then + echo "jdk=17" >> $GITHUB_OUTPUT + elif [[ "${{ github.ref_name }}" == "2023" ]]; then + echo "jdk=17" >> $GITHUB_OUTPUT + elif [[ "${{ github.ref_name }}" == "2022" ]]; then + echo "jdk=17" >> $GITHUB_OUTPUT + elif [[ "${{ github.ref_name }}" == "2021" ]]; then + echo "jdk=8" >> $GITHUB_OUTPUT + elif [[ "${{ github.ref_name }}" == "2020" ]]; then + echo "jdk=8" >> $GITHUB_OUTPUT + elif [[ "${{ github.ref_name }}" == "hoxton" ]]; then + echo "jdk=8" >> $GITHUB_OUTPUT + elif [[ "${{ github.ref_name }}" == "greenwich" ]]; then + echo "jdk=8" >> $GITHUB_OUTPUT + else + echo "jdk=17" >> $GITHUB_OUTPUT + fi + shopt -u nocasematch + snapshot: + runs-on: ubuntu-latest + needs: [ check-snapshot, set-jdk ] + if: ${{ needs.check-snapshot.outputs.IS_SNAPSHOT == 'true' }} + steps: + - name: Checkout codes + uses: actions/checkout@v4 + - name: Set up JDK ${{ needs.set-jdk.outputs.jdk }} + uses: actions/setup-java@v4 + with: + java-version: ${{ needs.set-jdk.outputs.jdk }} + distribution: 'temurin' + server-id: nexus-snapshots + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + - name: Publish package + run: mvn clean deploy -B -U -Psonatype + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/snapshot_jdk17.yml b/.github/workflows/snapshot_jdk17.yml deleted file mode 100644 index af766a65e..000000000 --- a/.github/workflows/snapshot_jdk17.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Snapshot with JDK 17 - -on: - push: - branches: - - 2024 - - 2023 - - 2022 - -jobs: - check-snapshot: - runs-on: ubuntu-latest - outputs: - IS_SNAPSHOT: ${{ steps.set_output_1.outputs.IS_SNAPSHOT }} - steps: - - name: Checkout codes - uses: actions/checkout@v4 - - name: Check deploy type - id: set_output_1 - run: | - line="$(grep SNAPSHOT pom.xml || true)" - echo $line - if [ -n "$line" ]; then - echo "IS_SNAPSHOT=true" >> $GITHUB_OUTPUT - else - echo "IS_SNAPSHOT=false" >> $GITHUB_OUTPUT - fi - snapshot: - runs-on: ubuntu-latest - needs: check-snapshot - if: ${{ needs.check-snapshot.outputs.IS_SNAPSHOT == 'true' }} - steps: - - name: Checkout codes - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - server-id: nexus-snapshots - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - - name: Publish package - run: mvn clean deploy -B -U -Psonatype - env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/snapshot_jdk8.yml b/.github/workflows/snapshot_jdk8.yml deleted file mode 100644 index c5fa346d2..000000000 --- a/.github/workflows/snapshot_jdk8.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Snapshot with JDK 8 - -on: - push: - branches: - - 2021 - - 2020 - - hoxton - - greenwich - -jobs: - check-snapshot: - runs-on: ubuntu-latest - outputs: - IS_SNAPSHOT: ${{ steps.set_output_1.outputs.IS_SNAPSHOT }} - steps: - - name: Checkout codes - uses: actions/checkout@v4 - - name: Check deploy type - id: set_output_1 - run: | - line="$(grep SNAPSHOT pom.xml || true)" - echo $line - if [ -n "$line" ]; then - echo "IS_SNAPSHOT=true" >> $GITHUB_OUTPUT - else - echo "IS_SNAPSHOT=false" >> $GITHUB_OUTPUT - fi - snapshot: - runs-on: ubuntu-latest - needs: check-snapshot - if: ${{ needs.check-snapshot.outputs.IS_SNAPSHOT == 'true' }} - steps: - - name: Checkout codes - uses: actions/checkout@v4 - - name: Set up JDK 8 - uses: actions/setup-java@v4 - with: - java-version: '8' - distribution: 'temurin' - server-id: nexus-snapshots - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - - name: Publish package - run: mvn clean deploy -B -U -Psonatype - env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ac8adace6..1ce657154 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,4 +9,5 @@ - [feat:support default instance circuit breaker rule.](https://github.com/Tencent/spring-cloud-tencent/pull/1499) - [fix: fix count circuit breaker in gateway & return 404 when context api does not match.](https://github.com/Tencent/spring-cloud-tencent/pull/1508) - [docs:update JDK version configuration in GitHub Actions.](https://github.com/Tencent/spring-cloud-tencent/pull/1510) -- [fix:fix watch tsf config, fix bean refresh with RefreshScope and ConfigurationProperties.](https://github.com/Tencent/spring-cloud-tencent/pull/1511) \ No newline at end of file +- [fix:fix watch tsf config, fix bean refresh with RefreshScope and ConfigurationProperties.](https://github.com/Tencent/spring-cloud-tencent/pull/1511) +- [docs:simplify GitHub Actions.](https://github.com/Tencent/spring-cloud-tencent/pull/1514) diff --git a/README.md b/README.md index 0d54ac05b..1ed6e557b 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [](https://github.com/Tencent/spring-cloud-tencent/graphs/contributors) [](https://opensource.org/licenses/BSD-3-Clause) -[](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml) +[](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit.yml) [](https://codecov.io/gh/Tencent/spring-cloud-tencent?branch=2021) English | [简体中文](./README-zh.md)