Skip to content

Commit 87c69b1

Browse files
author
Titouan Thibaud
committed
First attempt to create a CI
1 parent a6a6ff3 commit 87c69b1

3 files changed

Lines changed: 106 additions & 3 deletions

File tree

.github/workflows/android_ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Android CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: '17'
21+
distribution: 'temurin'
22+
cache: 'gradle'
23+
24+
- name: Grant execute permission for gradlew
25+
run: chmod +x gradlew
26+
27+
- name: Run ktlint
28+
run: ./gradlew ktlintCheck
29+
30+
# - name: Run detekt
31+
# run: ./gradlew detekt
32+
33+
- name: Run unit tests
34+
run: ./gradlew testDebugUnitTest
35+
36+
- name: Build debug APK
37+
run: ./gradlew assembleDebug
38+
39+
- name: Upload APK
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: debug-apk
43+
path: app/build/outputs/apk/debug/app-debug.apk

.github/workflows/release_apk.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build and Release APK
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v3
18+
with:
19+
java-version: '17'
20+
distribution: 'temurin'
21+
22+
- name: Decode Keystore
23+
env:
24+
KEYSTORE_FILE_BASE64: ${{ secrets.KEYSTORE_FILE_BASE64 }}
25+
run: |
26+
echo $KEYSTORE_FILE_BASE64 > keystore.jks.base64
27+
base64 -d keystore.jks.base64 > keystore.jks
28+
29+
- name: Grant execute permission for gradlew
30+
run: chmod +x gradlew
31+
32+
- name: Run unit tests
33+
run: ./gradlew testDebugUnitTest
34+
35+
- name: Build Release APK
36+
env:
37+
KEYSTORE_FILE: ${{ github.workspace }}/keystore.jks
38+
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
39+
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
40+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
41+
run: ./gradlew assembleRelease
42+
43+
- name: Create Release
44+
id: create_release
45+
uses: actions/create-release@v1
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
tag_name: ${{ github.ref }}
50+
release_name: Release ${{ github.ref }}
51+
draft: false
52+
prerelease: false
53+
54+
- name: Upload Release Asset
55+
uses: actions/upload-release-asset@v1
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
with:
59+
upload_url: ${{ steps.create_release.outputs.upload_url }}
60+
asset_path: app/build/outputs/apk/release/app-release.apk
61+
asset_name: app-release.apk
62+
asset_content_type: application/vnd.android.package-archive

app/build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ plugins {
99

1010
android {
1111
namespace = "org.mozilla.tryfox"
12-
compileSdk {
13-
version = release(36)
14-
}
12+
compileSdk = 36
1513

1614
defaultConfig {
1715
applicationId = "org.mozilla.tryfox"

0 commit comments

Comments
 (0)