docs:support Codecov. #133
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Testing | |
| on: | |
| push: | |
| branches: | |
| - dubbo-3.2.x | |
| - dubbo-2.x | |
| - release/* | |
| paths-ignore: | |
| - '**.md' | |
| pull_request: | |
| branches: | |
| - dubbo-3.2.x | |
| - dubbo-2.x | |
| - release/* | |
| paths-ignore: | |
| - '**.md' | |
| 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" == "dubbo-3.2.x" ]]; then | |
| echo "jdks=[8,17]" >> $GITHUB_OUTPUT | |
| elif [[ "$branch_name" == "dubbo-2.x" ]]; then | |
| echo "jdks=[8]" >> $GITHUB_OUTPUT | |
| else | |
| echo "jdks=[8]" >> $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 --file pom.xml | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v4 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |