-
Notifications
You must be signed in to change notification settings - Fork 76
116 lines (101 loc) · 3.55 KB
/
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: rollbar-java CI
on:
workflow_call:
secrets:
RELEASE_GPG_PRIVATE_KEY:
required: true
RELEASE_GPG_PRIVATE_KEY_PASSPHRASE:
required: true
NEXUS_USERNAME:
required: true
NEXUS_PASSWORD:
required: true
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
validation:
name: Gradle wrapper validation
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3
build:
runs-on: ubuntu-20.04
name: Build with Java ${{ matrix.java }}
needs: [ validation ]
strategy:
fail-fast: false
matrix:
# Must upgrade Gradle before we can go past Java 15 here.
# https://docs.gradle.org/current/userguide/compatibility.html
java: [ 8, 11 ]
steps:
- uses: actions/checkout@v4
- name: Fetch git tags
run: ./.github/scripts/fetch_to_tag.sh
- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
cache: 'gradle'
# gradle/actions/setup-gradle@v3 might offer better caching and other benefits through better integration.
# https://github.com/gradle/actions/blob/main/docs/setup-gradle.md
- name: Environment info
run: |
./gradlew --version
echo JAVA_HOME: ${JAVA_HOME}
java -version
javac -version
echo ANDROID_HOME: ${ANDROID_HOME}
echo ANDROID_SDK_ROOT: ${ANDROID_SDK_ROOT}
- name: Build
run: ./gradlew clean build
- name: Upload build reports
if: always()
uses: actions/upload-artifact@v4
with:
name: java-${{ matrix.java }}-build-reports
path: |
**/build/reports/*
release:
runs-on: ubuntu-20.04
name: Release
# It would be nice to run this as part of the build job, since it would be
# faster and have less duplicated Yaml, it would not be possible to check
# for all matrix results before publishing if this were just another step
# in that job.
needs: [ build ]
steps:
- uses: actions/checkout@v4
- name: Set up Java 11 for the Android SDK Manager
uses: actions/setup-java@v1
with:
java-version: 11
- name: Install Android SDK
run: |
echo "Android SDK Manager version: `${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --version`"
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "platforms;android-27" "build-tools;28.0.3"
- name: Set up Java 8 for the build
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
cache: 'gradle'
- name: Release
env:
RELEASE_GPG_PRIVATE_KEY: ${{ secrets.RELEASE_GPG_PRIVATE_KEY }}
RELEASE_GPG_PRIVATE_KEY_PASSPHRASE: ${{ secrets.RELEASE_GPG_PRIVATE_KEY_PASSPHRASE }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
if test "$GITHUB_REPOSITORY" = "rollbar/rollbar-java" -a "$GITHUB_BASE_REF" = ""; then
openssl enc -aes-256-cbc -K "$SECRING_GPG_KEY" -iv "$SECRING_GPG_IV" -in "$ENCRYPTED_GPG_KEY_LOCATION" -out "$GPG_KEY_LOCATION" -d
fi &&
./.github/scripts/release.sh
- name: Cleanup Gradle cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties