-
Notifications
You must be signed in to change notification settings - Fork 9
216 lines (181 loc) · 6.01 KB
/
build.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
check:
runs-on: ubuntu-latest
name: Verify API
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup gradle
uses: gradle/gradle-build-action@v2
- name: Check api
run: ./gradlew apiCheck
build:
strategy:
matrix:
config: [
{ target: android, os: ubuntu-latest, tasks: testDebugUnitTest testReleaseUnitTest },
{ target: ios, os: macos-latest, tasks: iosX64Test iosSimulatorArm64Test },
{ target: js, os: ubuntu-latest, tasks: jsTest },
{ target: desktop, os: ubuntu-latest, tasks: desktopTest },
]
runs-on: ${{ matrix.config.os }}
name: Build ${{ matrix.config.target }}
needs: check
steps:
- uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup gradle
uses: gradle/gradle-build-action@v2
- name: Test ${{ matrix.config.target }} targets
run: ./gradlew ${{ matrix.config.tasks }}
test:
name: Test on Android
runs-on: ubuntu-latest
timeout-minutes: 60
needs: check
strategy:
fail-fast: true
matrix:
api-level: [ 25, 33, 34 ]
steps:
- uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# API 30+ emulators only have x86_64 system images.
- name: Get AVD info
uses: ./.github/actions/get-avd-info
id: avd-info
with:
api-level: ${{ matrix.api-level }}
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: ${{ steps.avd-info.outputs.arch }}
target: ${{ steps.avd-info.outputs.target }}
script: ./gradlew connectedDebugAndroidTest
release:
name: Release to sonatype
if: ${{ github.event_name != 'pull_request' }}
runs-on: macos-latest
needs:
- build
- test
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup gradle
uses: gradle/gradle-build-action@v2
- name: Write secrets to local.properties
if: ${{ github.event_name != 'pull_request' }}
run: |
echo sonatypeUsername="${SONATYPE_USERNAME}" >> "local.properties"
echo sonatypePassword="${SONATYPE_PASSWORD}" >> "local.properties"
echo gpgKeyPassword="${GPG_KEY_PASSWORD}" >> "local.properties"
echo gpgKeySecret="${GPG_KEY_SECRET}" >> "local.properties"
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
GPG_KEY_SECRET: ${{ secrets.GPG_KEY_SECRET }}
- name: Release to sonatype
run: ./gradlew publishAllPublicationsToMavenRepository
documentation:
name: Publish documentation
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
needs:
- build
- test
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup gradle
uses: gradle/gradle-build-action@v2
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Generate api docs with dokka
run: ./gradlew dokkaHtmlMultiModule
- name: Build Writerside docs using Docker
uses: JetBrains/writerside-github-action@v4
with:
instance: docs/decompose-router
artifact: webHelpDECOMPOSE-ROUTER2-all.zip
docker-version: 232.10275
- name: Upload documentation
uses: actions/upload-artifact@v3
with:
name: docs
path: |
artifacts/webHelpDECOMPOSE-ROUTER2-all.zip
artifacts/report.json
retention-days: 7
- name: Unzip artifact
uses: montudor/action-zip@v1
with:
args: unzip -qq artifacts/webHelpDECOMPOSE-ROUTER2-all.zip -d build/docs
- name: Move dokka api-doc to docs/api
run: |
sudo mkdir -p build/docs/api
sudo mv build/dokka/htmlMultiModule/* build/docs/api
- name: Upload pages
uses: actions/upload-pages-artifact@v1
with:
path: ${{ github.workspace }}/build/docs
- name: Release to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1