Skip to content

Commit 34d9817

Browse files
committed
Create shared Android CI workflow
1 parent 860edfd commit 34d9817

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.github/workflows/android-ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Android CI
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
api-check:
7+
description: 'Whether to run API checks'
8+
required: false
9+
type: boolean
10+
default: true
11+
12+
secrets:
13+
BUILD_CACHE_AWS_REGION:
14+
required: false
15+
BUILD_CACHE_AWS_BUCKET:
16+
required: false
17+
BUILD_CACHE_AWS_ACCESS_KEY_ID:
18+
required: false
19+
BUILD_CACHE_AWS_SECRET_KEY:
20+
required: false
21+
SONAR_TOKEN:
22+
required: false
23+
24+
env:
25+
BUILD_CACHE_AWS_REGION: ${{ secrets.BUILD_CACHE_AWS_REGION }}
26+
BUILD_CACHE_AWS_BUCKET: ${{ secrets.BUILD_CACHE_AWS_BUCKET }}
27+
BUILD_CACHE_AWS_ACCESS_KEY_ID: ${{ secrets.BUILD_CACHE_AWS_ACCESS_KEY_ID }}
28+
BUILD_CACHE_AWS_SECRET_KEY: ${{ secrets.BUILD_CACHE_AWS_SECRET_KEY }}
29+
30+
jobs:
31+
build:
32+
name: Build
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: GetStream/stream-build-conventions-android/.github/actions/setup-gradle@main
37+
- name: Build
38+
run: ./gradlew assembleDebug --scan
39+
40+
static-checks:
41+
name: Run static checks
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v4
45+
- uses: GetStream/stream-build-conventions-android/.github/actions/setup-gradle@main
46+
- name: Spotless
47+
run: ./gradlew spotlessCheck
48+
- name: Lint
49+
if: always()
50+
run: ./gradlew lint
51+
- name: API check
52+
if: always() && inputs.api-check == 'true'
53+
run: ./gradlew apiCheck
54+
55+
unit-test:
56+
name: Run unit tests
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v4
60+
- uses: GetStream/stream-build-conventions-android/.github/actions/setup-gradle@main
61+
- name: Run unit tests
62+
run: ./gradlew testCoverage --scan --stacktrace
63+
- name: Upload tests results
64+
uses: actions/upload-artifact@v4
65+
if: failure()
66+
with:
67+
name: unit-tests-results
68+
path: ./**/build/reports/tests/**
69+
- name: Sonar
70+
if: github.event.pull_request.head.repo.full_name == github.repository
71+
run: ./gradlew sonar
72+
env:
73+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
74+
- name: Sonar skipped if PR from fork
75+
if: github.event.pull_request.head.repo.full_name != github.repository
76+
run: echo "⚠️ Sonar skipped because the PR comes from a fork."
77+
78+
validate-workflows:
79+
name: Run actionlint
80+
runs-on: ubuntu-latest
81+
steps:
82+
- uses: actions/checkout@v4
83+
- uses: raven-actions/actionlint@v2.1.0

0 commit comments

Comments
 (0)