-
Notifications
You must be signed in to change notification settings - Fork 4
93 lines (74 loc) · 3.87 KB
/
android_ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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: Run unit tests
id: unit_tests
run: ./gradlew test -x :TripKitSamples:test --stacktrace
- name: Archive test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: ./*/build/test-results/**/test*UnitTest
- name: Comment on Pull Request for Unit Test Failures
if: failure() && github.event_name == 'pull_request' && steps.unit_tests.outcome == 'failure'
uses: thollander/[email protected]
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.
Test results are available under the "Artifacts" section of this run in [GitHub Actions](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
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/[email protected]
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 (With Reviewers)
if: success() && github.event_name == 'pull_request'
uses: thollander/[email protected]
with:
message: |
:white_check_mark: Unit tests passed successfully!
Test results are available under the "Artifacts" section of this run in [GitHub Actions](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
Please ensure the code is reviewed before proceeding with the merge.
# - name: Comment on Pull Request
# run: |
# if [[ "${{ github.event.pull_request.requested_reviewers[2].login }}" != "" ]]; then
# REVIEWERS="@${{ github.event.pull_request.requested_reviewers[0].login }}, @${{ github.event.pull_request.requested_reviewers[1].login }}, @${{ github.event.pull_request.requested_reviewers[2].login }}"
# elif [[ "${{ github.event.pull_request.requested_reviewers[1].login }}" != "" ]]; then
# REVIEWERS="@${{ github.event.pull_request.requested_reviewers[0].login }}, @${{ github.event.pull_request.requested_reviewers[1].login }}"
# else
# REVIEWERS="@${{ github.event.pull_request.requested_reviewers[0].login || github.event.pull_request.user.login }}"
# fi
#
# echo "The code is ready for review." | gh pr comment ${{ github.event.pull_request.number }} --body "${REVIEWERS}, the tests have passed. The code is ready for review."