Skip to content

Commit 38fa0f8

Browse files
committed
ci(workflow): add common workflows for Android and Python, including CI /CD revamp (#422)
* ci(workflow): add common workflows for Android and Python, including CI /CD revamp * ci(workflow): ignore python CI workflow in push and pull request triggers * ci(actions): add caching for Gradle dependencies in Android workflow * ci(workflow): update python CI workflow to include additional paths and job names * ci(workflow): standardize workflow names to title case * ci(workflow): seperate lint job, format and type checks
1 parent a65a36b commit 38fa0f8

17 files changed

+351
-253
lines changed

.github/actions/android/action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: 'Common - Android'
2+
description: 'Common setup for Android workflows'
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Set up JDK
8+
uses: actions/setup-java@v5
9+
with:
10+
java-version-file: '.java-version'
11+
distribution: 'adopt'
12+
cache: 'gradle'
13+
cache-dependency-path: ./gradle/libs.versions.toml
14+
- name: Setup Gradle
15+
uses: gradle/actions/setup-gradle@v3

.github/actions/python/action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'Common - Python'
2+
description: 'Common setup for Python workflows'
3+
4+
inputs:
5+
workspace:
6+
description: 'The path to the Python project workspace'
7+
required: false
8+
default: ''
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Install poetry
14+
shell: bash
15+
run: pipx install poetry
16+
- name: Set up Python
17+
uses: actions/setup-python@v6
18+
with:
19+
python-version-file: '${{ inputs.workspace }}/.python-version'
20+
cache: 'poetry'
21+
- name: Configure Poetry
22+
shell: bash
23+
run: poetry config virtualenvs.create true
24+
- name: Install dependencies
25+
shell: bash
26+
run: cd ./scripts/emoji_generator && poetry install --no-interaction --no-ansi

.github/workflows/android-ci.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Android CI
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
paths-ignore:
8+
- ".github/actions/python/**"
9+
- ".github/workflows/python-ci.yml"
10+
- "app/src/main/**"
11+
- "scripts/emoji_generator/**"
12+
pull_request:
13+
branches:
14+
- develop
15+
paths-ignore:
16+
- ".github/actions/python/**"
17+
- ".github/workflows/python-ci.yml"
18+
- "app/src/main/**"
19+
- "scripts/emoji_generator/**"
20+
21+
env:
22+
CI: true
23+
24+
jobs:
25+
wrapper-validation:
26+
name: Wrapper Validation
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v5
30+
- uses: gradle/actions/wrapper-validation@v4
31+
32+
spotless:
33+
name: Spotless Check
34+
needs: wrapper-validation
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v5
39+
- name: Common setup
40+
uses: ./.github/actions/android
41+
- name: Run spotless check
42+
run: ./gradlew spotlessCheck
43+
44+
gradle-dokka:
45+
name: Generate and deploy docs
46+
needs: wrapper-validation
47+
if: github.event_name == 'push'
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/create-github-app-token@v2
51+
id: app-token
52+
with:
53+
app-id: ${{ secrets.APP_ID }}
54+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
55+
- name: Checkout repository
56+
uses: actions/checkout@v5
57+
- name: Common setup
58+
uses: ./.github/actions/android
59+
- name: Grant execute permission for gradlew
60+
run: chmod +x gradlew
61+
- name: Generate docs with dokka
62+
run: ./gradlew dokkaHtmlMultiModule
63+
- name: Deploy 🚀
64+
uses: JamesIves/[email protected]
65+
with:
66+
branch: docs # The branch the action should deploy to.
67+
folder: dokka-docs # The folder the action should deploy.
68+
token: ${{ steps.app-token.outputs.token }}
69+
70+
unit-test:
71+
name: Unit Tests
72+
needs: [wrapper-validation, spotless]
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/create-github-app-token@v2
76+
id: app-token
77+
with:
78+
app-id: ${{ secrets.APP_ID }}
79+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
80+
- name: Checkout repository
81+
uses: actions/checkout@v5
82+
- name: Common setup
83+
uses: ./.github/actions/android
84+
- name: Run tests
85+
run: |
86+
./gradlew emojify:preTest
87+
./gradlew emojify:test --stacktrace
88+
./gradlew emojify:postTest
89+
- name: Publish Test Report
90+
uses: mikepenz/action-junit-report@v5
91+
if: always()
92+
with:
93+
report_paths: '**/build/test-results/**/TEST-*.xml'
94+
token: ${{ steps.app-token.outputs.token }}
95+
96+
publish-artifact:
97+
name: Publish Artifact
98+
needs: unit-test
99+
if: github.event_name == 'push'
100+
runs-on: ubuntu-latest
101+
steps:
102+
- name: Checkout repository
103+
uses: actions/checkout@v5
104+
- name: Common setup
105+
uses: ./.github/actions/android
106+
- name: Run build
107+
run: |
108+
./gradlew emojify:preTest
109+
./gradlew clean build --stacktrace
110+
./gradlew emojify:postTest
111+
- name: Publish to Local Maven
112+
run: |
113+
./gradlew publishMavenPublicationToMavenLocal
114+
- name: Upload artifacts
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: publications
118+
path: ~/.m2/repository/io/wax911/emoji/

.github/workflows/android-publish-artifact.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/android-spotless.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/android-unit-test.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/auto-approve.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: auto-approve
1+
name: Auto Approve
22

33
on:
44
pull_request_target:

.github/workflows/emoji-generator-ci.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/first-time-contributer-greeting.yml renamed to .github/workflows/first-interaction.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
name: greeting-first-time-contributor
1+
name: Greeting
22

33
on: [ pull_request_target, issues ]
44

55
jobs:
6-
greeting:
6+
first-interaction:
7+
name: Greet new contributors
78
runs-on: ubuntu-latest
89
permissions:
910
issues: write

0 commit comments

Comments
 (0)