Skip to content

Commit 2dd0a30

Browse files
committed
ci(workflow): add common workflows for Android and Python, including CI /CD revamp
1 parent a65a36b commit 2dd0a30

14 files changed

Lines changed: 287 additions & 250 deletions

.github/actions/android/action.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
- name: Setup Gradle
13+
uses: gradle/actions/setup-gradle@v3
14+

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

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

.github/workflows/gradle-dokka.yml

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

.github/workflows/gradle-wrapper-validation.yml

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

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

Lines changed: 2 additions & 1 deletion
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:
66
greeting:
7+
name: Greet new contributors
78
runs-on: ubuntu-latest
89
permissions:
910
issues: write

0 commit comments

Comments
 (0)