Skip to content

Commit 82bc1f9

Browse files
committed
feat: add CI/CD configuration for release and build workflows
1 parent 7bee6fb commit 82bc1f9

File tree

5 files changed

+260
-83
lines changed

5 files changed

+260
-83
lines changed

.github/workflows/Build.yaml

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

.github/workflows/CD.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 30
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up JDK 17
20+
uses: actions/setup-java@v4
21+
with:
22+
distribution: 'zulu'
23+
java-version: 17
24+
25+
- name: Validate Gradle Wrapper
26+
uses: gradle/wrapper-validation-action@v3
27+
28+
- name: Set release version
29+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
30+
31+
- name: Copy CI gradle.properties
32+
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
33+
34+
- name: chmod cache key
35+
run: chmod +x ./scripts/checksum.sh
36+
37+
- name: Generate cache key
38+
run: ./scripts/checksum.sh app checksum.txt
39+
40+
- name: Cache Gradle
41+
uses: actions/cache@v3
42+
with:
43+
path: |
44+
~/.gradle/caches/modules-*
45+
~/.gradle/caches/jars-*
46+
~/.gradle/caches/build-cache-*
47+
~/.gradle/wrapper/
48+
~/.gradle/caches/transforms-*
49+
key: gradle-${{ hashFiles('checksum.txt') }}
50+
restore-keys: |
51+
gradle-
52+
53+
- name: Setup Gradle
54+
uses: gradle/actions/setup-gradle@v3
55+
56+
- name: Build Release APK
57+
run: ./gradlew assembleRelease --no-daemon --stacktrace
58+
59+
- name: Prepare APK for Release
60+
run: |
61+
mkdir -p release
62+
cp app/build/outputs/apk/release/app-release.apk release/BreakingBad-${{ env.RELEASE_VERSION }}.apk
63+
64+
- name: Generate changelog
65+
id: changelog
66+
uses: metcalfc/[email protected]
67+
with:
68+
myToken: ${{ secrets.GITHUB_TOKEN }}
69+
70+
- name: Create GitHub Release
71+
uses: softprops/action-gh-release@v1
72+
with:
73+
files: release/BreakingBad-${{ env.RELEASE_VERSION }}.apk
74+
name: Release ${{ env.RELEASE_VERSION }}
75+
body: |
76+
${{ steps.changelog.outputs.changelog }}
77+
draft: false
78+
prerelease: false
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
82+
- name: Delete checksum.txt after build
83+
if: always()
84+
run: rm -f checksum.txt

.github/workflows/CI.yaml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
8+
concurrency:
9+
group: build-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
spotless:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 10
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Validate Gradle Wrapper
21+
uses: gradle/wrapper-validation-action@v3
22+
23+
- name: Copy CI gradle.properties
24+
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
25+
26+
- name: Set up JDK 17
27+
uses: actions/setup-java@v4
28+
with:
29+
distribution: 'zulu'
30+
java-version: 17
31+
32+
- name: chmod cache key
33+
run: chmod +x ./scripts/checksum.sh
34+
35+
- name: Generate cache key
36+
run: ./scripts/checksum.sh app checksum.txt
37+
38+
- uses: actions/cache@v3
39+
with:
40+
path: |
41+
~/.gradle/caches/modules-*
42+
~/.gradle/caches/jars-*
43+
~/.gradle/caches/build-cache-*
44+
~/.gradle/wrapper/
45+
~/.gradle/caches/transforms-*
46+
key: gradle-${{ hashFiles('checksum.txt') }}
47+
restore-keys: |
48+
gradle-
49+
50+
- name: Setup Gradle
51+
uses: gradle/actions/setup-gradle@v3
52+
53+
- name: Check Spotless
54+
run: ./gradlew spotlessCheck --init-script gradle/init.gradle.kts --no-configuration-cache --no-daemon --stacktrace
55+
56+
tests:
57+
runs-on: ubuntu-latest
58+
timeout-minutes: 20
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v4
62+
63+
- name: Set up JDK 17
64+
uses: actions/setup-java@v4
65+
with:
66+
distribution: 'zulu'
67+
java-version: 17
68+
69+
- name: chmod cache key
70+
run: chmod +x ./scripts/checksum.sh
71+
72+
- name: Generate cache key
73+
run: ./scripts/checksum.sh app checksum.txt
74+
75+
- uses: actions/cache@v3
76+
with:
77+
path: |
78+
~/.gradle/caches/modules-*
79+
~/.gradle/caches/jars-*
80+
~/.gradle/caches/build-cache-*
81+
~/.gradle/wrapper/
82+
~/.gradle/caches/transforms-*
83+
key: gradle-${{ hashFiles('checksum.txt') }}
84+
restore-keys: |
85+
gradle-
86+
87+
- name: Copy CI gradle.properties
88+
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
89+
90+
- name: Setup Gradle
91+
uses: gradle/actions/setup-gradle@v3
92+
93+
- name: UnitTest
94+
run: ./gradlew testDebugUnitTest --no-daemon --stacktrace
95+
96+
- name: Check Kover
97+
run: ./gradlew koverXmlReportDebug --no-daemon
98+
99+
- name: Display local test coverage
100+
uses: madrapps/[email protected]
101+
with:
102+
title: test coverage report
103+
min-coverage-overall: 40
104+
min-coverage-changed-files: 60
105+
update-comment: true
106+
skip-if-no-changes: true
107+
continue-on-error: false
108+
paths: |
109+
${{ github.workspace }}/feature/**/build/reports/kover/reportDebug.xml
110+
token: ${{ secrets.GITHUB_TOKEN }}
111+
112+
build:
113+
runs-on: ubuntu-latest
114+
timeout-minutes: 15
115+
needs: [spotless, tests]
116+
steps:
117+
- name: Checkout
118+
uses: actions/checkout@v4
119+
120+
- name: Set up JDK 17
121+
uses: actions/setup-java@v4
122+
with:
123+
distribution: 'zulu'
124+
java-version: 17
125+
126+
- name: chmod cache key
127+
run: chmod +x ./scripts/checksum.sh
128+
129+
- name: Generate cache key
130+
run: ./scripts/checksum.sh app checksum.txt
131+
132+
- uses: actions/cache@v3
133+
with:
134+
path: |
135+
~/.gradle/caches/modules-*
136+
~/.gradle/caches/jars-*
137+
~/.gradle/caches/build-cache-*
138+
~/.gradle/wrapper/
139+
~/.gradle/caches/transforms-*
140+
key: gradle-${{ hashFiles('checksum.txt') }}
141+
restore-keys: |
142+
gradle-
143+
144+
- name: Copy CI gradle.properties
145+
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
146+
147+
- name: Setup Gradle
148+
uses: gradle/actions/setup-gradle@v3
149+
150+
- name: Build Debug APK
151+
run: ./gradlew assembleDebug --no-daemon
152+
153+
- name: Upload build reports
154+
if: always()
155+
uses: actions/upload-artifact@v3
156+
with:
157+
name: build-reports
158+
path: app/build/reports
159+

core/network/src/main/kotlin/io/github/shinhyo/brba/core/network/LocalDataSource.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2025 shinhyo
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package io.github.shinhyo.brba.core.network
217

318
import android.content.Context
@@ -46,4 +61,4 @@ class LocalDataSource @Inject constructor(
4661
emptyList()
4762
}
4863
}
49-
}
64+
}

core/network/src/main/kotlin/io/github/shinhyo/brba/core/network/di/NetworkModule.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,4 @@ interface NetworkModule {
4141
fun bindNetworkDataSource(
4242
network: LocalDataSource,
4343
): NetworkDataSource
44-
45-
}
46-
44+
}

0 commit comments

Comments
 (0)