Skip to content

docs:simplify GitHub Actions. #1514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .github/workflows/codecov_jdk17.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/codecov_jdk8.yml

This file was deleted.

86 changes: 86 additions & 0 deletions .github/workflows/junit.yml
Original file line number Diff line number Diff line change
@@ -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
40 changes: 0 additions & 40 deletions .github/workflows/junit_test_jdk17-21.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/junit_test_jdk8-21.yml

This file was deleted.

78 changes: 78 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -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 }}
47 changes: 0 additions & 47 deletions .github/workflows/snapshot_jdk17.yml

This file was deleted.

Loading