From 8e86fa2a057241ee730fe79ac14947fca0c51059 Mon Sep 17 00:00:00 2001 From: json Date: Wed, 28 Aug 2024 22:12:23 +0800 Subject: [PATCH] [22321] Updated android ci workflow --- .github/workflows/android_ci.yml | 77 ++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/android_ci.yml diff --git a/.github/workflows/android_ci.yml b/.github/workflows/android_ci.yml new file mode 100644 index 000000000..832299600 --- /dev/null +++ b/.github/workflows/android_ci.yml @@ -0,0 +1,77 @@ +name: CI + +on: + pull_request: + branches: + - develop + - feature/** +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: true # This ensures submodules are also checked out + + - name: Update submodules + run: git submodule update --init --recursive + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: "temurin" + + - name: Cache Gradle packages + uses: actions/cache@v3 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build + + - name: Run unit tests + id: unit_tests + run: ./gradlew test + + - name: Archive test results + if: always() + uses: actions/upload-artifact@v3 + with: + name: test-results + path: build/test-results/test + + - name: Comment on Pull Request for Unit Test Failures + if: failure() && github.event_name == 'pull_request' && steps.unit_tests.outcome == 'failure' + uses: thollander/actions-comment-pull-request@v2.5.0 + with: + message: | + :x: Unit tests failed! + + @${{ github.event.pull_request.assignee.login || github.event.pull_request.user.login }}, please review and fix the issues in the unit tests. Let us know if you need any help. + + - name: Comment on Pull Request for General Workflow Failures + if: failure() && github.event_name == 'pull_request' && steps.unit_tests.outcome != 'failure' + uses: thollander/actions-comment-pull-request@v2.5.0 + with: + message: | + :x: Workflow execution failed! + + @${{ github.event.pull_request.assignee.login || github.event.pull_request.user.login }}, there was an issue with the workflow execution. Please check the logs and resolve the issue. + + - name: Comment on Pull Request on Success + if: success() && github.event_name == 'pull_request' + uses: thollander/actions-comment-pull-request@v2.5.0 + with: + message: | + :white_check_mark: Unit tests passed successfully! + + @${{ github.event.pull_request.requested_reviewers.*.login }}, the tests have passed. The code is ready for review.