-
Notifications
You must be signed in to change notification settings - Fork 449
150 lines (120 loc) · 5.11 KB
/
check.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# This workflow will build the project with Gradle, run integration tests, and release.
# Because secrets are not available on external forks, this job is expected to fail
# on external pull requests.
name: Build, Check, Publish
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'zulu'
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.9.14'
- run: python -m pip install ply && pip install six
- name: Grant execute permissions
run: chmod +x gradlew
&& chmod +x update-submodules
&& chmod +x generate-ci-auth-file
&& chmod +x scripts/check-clean-git-status
- name: Set up submodules
run: ./update-submodules
- name: Generate Stone
run: ./gradlew :core:generateStone
- name: Ensure no changes in Generated Code
run: ./scripts/check-clean-git-status
- name: Obtain oauth access token for integration tests
env:
APP_KEY: ${{ secrets.APP_KEY }}
APP_SECRET: ${{ secrets.APP_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
run: ./generate-ci-auth-file
- name: Ensure Binary Compatibility
run: ./gradlew :core:apiCheck :android:apiCheck
- name: Dependency Guard
run: ./gradlew dependencyGuard
- name: Check
run: ./gradlew check
- name: Run Integration Tests for Examples
run: ./gradlew :examples:examples:test :examples:java:test -Pci=true --info
- name: Run Integration Tests - OkHttpRequestor
run: ./gradlew -Pcom.dropbox.test.httpRequestor=OkHttpRequestor -Pcom.dropbox.test.authInfoFile=../auth_output integrationTest &&
./gradlew -Pcom.dropbox.test.httpRequestor=OkHttpRequestor -Pcom.dropbox.test.authInfoFile=../auth_output proguardTest
- name: Run Integration Tests - OkHttp3Requestor
run: ./gradlew -Pcom.dropbox.test.httpRequestor=OkHttp3Requestor -Pcom.dropbox.test.authInfoFile=../auth_output integrationTest &&
./gradlew -Pcom.dropbox.test.httpRequestor=OkHttp3Requestor -Pcom.dropbox.test.authInfoFile=../auth_output proguardTest
- name: Run Integration Tests - StandardHttpRequestor
run: ./gradlew -Pcom.dropbox.test.httpRequestor=StandardHttpRequestor -Pcom.dropbox.test.authInfoFile=../auth_output integrationTest &&
./gradlew -Pcom.dropbox.test.httpRequestor=StandardHttpRequestor -Pcom.dropbox.test.authInfoFile=../auth_output proguardTest
publish:
runs-on: ubuntu-latest
if: github.repository == 'dropbox/dropbox-sdk-java' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v3
- name: Install JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.9.14'
- run: python -m pip install ply && pip install six
- name: Grant execute permissions
run: chmod +x gradlew && chmod +x update-submodules
- name: Update submodules
run: ./update-submodules
- name: Upload Artifacts
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel --no-configuration-cache --stacktrace
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
- name: Retrieve version
run: |
echo "VERSION_NAME=$(cat gradle.properties | grep -w "VERSION_NAME" | cut -d'=' -f2)" >> $GITHUB_ENV
- name: Publish Release to Maven Central
run: ./gradlew closeAndReleaseRepository --no-daemon --no-parallel
if: "!endsWith(env.VERSION_NAME, '-SNAPSHOT')"
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
- name: Upload Test Reports
uses: actions/upload-artifact@v3
with:
name: TestReports
path: |
core/build/reports/
android/build/reports/
- name: Upload JavaDocs
uses: actions/upload-artifact@v3
with:
name: JavaDocs
path: |
core/build/docs/javadoc/
android/build/docs/javadoc/
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: BuildArtifacts
path: |
core/build/distributions/
android/build/distributions/