From 5d9bdbeebdd58418ea4490e104b9e2f62acc5367 Mon Sep 17 00:00:00 2001 From: crossoverJie Date: Sun, 22 Sep 2024 17:05:21 +0800 Subject: [PATCH] upgrade-codecov --- .github/workflows/maven.yml | 20 +++--------------- .github/workflows/reusable_run_tests.yml | 27 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/reusable_run_tests.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index e1cc8b2f..26ac135c 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -16,20 +16,6 @@ on: jobs: build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - cache: maven - - name: Build with Maven - run: mvn -B package --file pom.xml - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.2.0 - env: - CODECOV_TOKEN: ${{ vars.CODECOV_TOKEN }} + uses: ./.github/workflows/reusable_run_tests.yml + secrets: + codecov_token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/reusable_run_tests.yml b/.github/workflows/reusable_run_tests.yml new file mode 100644 index 00000000..06e5ae20 --- /dev/null +++ b/.github/workflows/reusable_run_tests.yml @@ -0,0 +1,27 @@ +name: A reusable workflow to build and run the unit test suite + +on: + workflow_call: + secrets: + codecov_token: + required: true + +jobs: + build_and_test: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: mvn -B package --file pom.xml + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.2.0 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file