-
-
Notifications
You must be signed in to change notification settings - Fork 59
68 lines (56 loc) · 1.75 KB
/
validate-gradle-build-test.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
# This actions validates the gradle files and runs a build test to ensure the app is not corrupted
# if succeeded and the source is a pull request, builds an evaluation apk
name: Validate gradle build test
on:
push:
branches:
- master
pull_request:
branches:
- master
# parameters
env:
VARIANT: evaluation
NAME: URLCheck_evaluation.apk
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Change wrapper permissions
# for some reason the gradle-build-action doesn't do this automatically
run: chmod +x ./gradlew
- name: Build & test with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: >
build
test
# the following steps will only run for PRs
- name: Generate apk
if: ${{ github.event_name == 'pull_request' }}
uses: gradle/gradle-build-action@v2
with:
arguments: >
assemble${{ env.VARIANT }}
- name: Upload apk as artifact
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v3
with:
path: ./app/build/outputs/apk/${{ env.VARIANT }}/app-${{ env.VARIANT }}.apk
name: ${{ env.NAME }}
retention-days: 14
- name: Upload PR id as artifact
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v3
with:
path: /dev/null
name: ${{ github.event.number }}
retention-days: 1