Skip to content

Commit 2401f0c

Browse files
Merge pull request #121 from wh201906/ci
Add CI to build client
2 parents 23a1697 + 14c48f2 commit 2401f0c

1 file changed

Lines changed: 100 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- main
8+
paths-ignore:
9+
- 'README.md'
10+
- 'fastlane/**'
11+
- 'assets/**'
12+
- '.github/**/*.md'
13+
- '.github/FUNDING.yml'
14+
- '.github/ISSUE_TEMPLATE/**'
15+
push:
16+
branches:
17+
- main
18+
paths-ignore:
19+
- 'README.md'
20+
- 'fastlane/**'
21+
- 'assets/**'
22+
- '.github/**/*.md'
23+
- '.github/FUNDING.yml'
24+
- '.github/ISSUE_TEMPLATE/**'
25+
26+
jobs:
27+
build-client:
28+
runs-on: ubuntu-latest
29+
outputs:
30+
files: ${{ steps.step-output.outputs.files }}
31+
steps:
32+
- uses: actions/checkout@v3
33+
with:
34+
submodules: recursive
35+
36+
- uses: gradle/wrapper-validation-action@v1
37+
38+
- name: Create and checkout branch
39+
# push events already checked out the branch
40+
if: github.event_name == 'pull_request'
41+
env:
42+
BRANCH: ${{ github.head_ref }}
43+
run: git checkout -B "$BRANCH"
44+
45+
- name: Set up JDK 11
46+
uses: actions/setup-java@v3
47+
with:
48+
java-version: 11
49+
distribution: "temurin"
50+
cache: 'gradle'
51+
52+
- name: Build debug APK
53+
run: |
54+
cd PipePipeClient
55+
./gradlew assembleDebug lintDebug --stacktrace -DskipFormatKtlint
56+
57+
- name: Upload APKs
58+
uses: actions/upload-artifact@v3
59+
with:
60+
name: all-apks-in-one(intermediates)
61+
retention-days: 1
62+
path: PipePipeClient/app/build/outputs/apk/debug/*.apk
63+
64+
- name: Output filenames
65+
id: step-output
66+
run: |
67+
files=$(ls PipePipeClient/app/build/outputs/apk/debug)
68+
69+
json_array="["
70+
first_file=true
71+
for file in $files; do
72+
if [ "$first_file" = false ]; then
73+
json_array+=", \"$file\""
74+
else
75+
json_array+="\"$file\""
76+
first_file=false
77+
fi
78+
done
79+
json_array+="]"
80+
81+
echo "files=$json_array"
82+
echo "files=$json_array" >> "$GITHUB_OUTPUT"
83+
84+
upload-apk:
85+
runs-on: ubuntu-latest
86+
needs: build-client
87+
strategy:
88+
matrix:
89+
file: ${{ fromJson(needs.build-client.outputs.files) }}
90+
steps:
91+
- name: Download APKs
92+
uses: actions/download-artifact@v3
93+
with:
94+
name: all-apks-in-one(intermediates)
95+
96+
- name: Upload artifacts
97+
uses: actions/upload-artifact@v3
98+
with:
99+
name: ${{ matrix.file }}
100+
path: ${{ matrix.file }}

0 commit comments

Comments
 (0)