Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add deploy & test,build workflow #1

Merged
merged 2 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

## :bug: Describe the bug
A clear and concise description of what the bug is.

## :runner: Steps To Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

## :white_check_mark: Expected behavior
A clear and concise description of what you expected to happen.

## :framed_picture: Screenshots
If applicable, add screenshots to help explain your problem.

## :iphone: Devices (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Version [e.g. 22]

## :construction: Additional context
Add any other context about the problem here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---

## :bulb: Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

## :white_check_mark: Describe the solution you'd like
A clear and concise description of what you want to happen.

## :part_alternation_mark: Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

## :construction: Additional context
Add any other context or screenshots about the feature request here.
15 changes: 15 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## :rocket: Summary
Describe things you did in this Pull Request


## :recycle: Changes
Describe your changes more detailed (Bullet points are preferred)


## :framed_picture: Screenshots:
Provide screenshots to make it visible to reviewer if possible (Optional)
Ex:

| Before | After |
| :---: | :---: |
| Screenshot 1 | Screenshot 2 |
36 changes: 36 additions & 0 deletions .github/scripts/gradlew_recursive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -xe

# Default Gradle settings are not optimal for Android builds, override them
# here to make the most out of the GitHub Actions build servers
GRADLE_OPTS="$GRADLE_OPTS -Xms4g -Xmx4g"
GRADLE_OPTS="$GRADLE_OPTS -XX:+HeapDumpOnOutOfMemoryError"
GRADLE_OPTS="$GRADLE_OPTS -Dorg.gradle.daemon=false"
GRADLE_OPTS="$GRADLE_OPTS -Dorg.gradle.workers.max=2"
GRADLE_OPTS="$GRADLE_OPTS -Dkotlin.incremental=false"
GRADLE_OPTS="$GRADLE_OPTS -Dkotlin.compiler.execution.strategy=in-process"
GRADLE_OPTS="$GRADLE_OPTS -Dfile.encoding=UTF-8"
export GRADLE_OPTS

# Crawl all gradlew files which indicate an Android project
# You may edit this if your repo has a different project structure
for GRADLEW in `find . -name "gradlew"` ; do
SAMPLE=$(dirname "${GRADLEW}")
# Tell Gradle that this is a CI environment and disable parallel compilation
bash "$GRADLEW" -p "$SAMPLE" -Pci --no-parallel --stacktrace $@
done
60 changes: 60 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deploy
on:
push:
branches: [ master ]

permissions:
contents: write

jobs:
build:
name: Build & Deploy Artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Set up environment variables
run: |
echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 -d > app/keystore.jks
echo "ANDROID_KEYSTORE_PASSWORD=${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" >> $GITHUB_ENV
echo "ANDROID_KEY_ALIAS=${{ secrets.ANDROID_KEY_ALIAS }}" >> $GITHUB_ENV
echo "ANDROID_KEY_PASSWORD=${{ secrets.ANDROID_KEY_PASSWORD }}" >> $GITHUB_ENV
- name: Build AAB
run: |
./gradlew :app:bundleRelease --no-daemon
- name: Build APK
run: |
./gradlew :app:assembleRelease --no-daemon
- name: Move files
run: |
mv app/build/outputs/apk/release/app-release.apk app/build/app-release-unsigned.apk
mv app/build/outputs/bundle/release/app-release.aab app/build/app-release.aab
- name: Upload AAB
uses: actions/upload-artifact@v4
with:
name: AABs
path: app/build/app-release.aab
- name: Sign APK
run: |
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 \
-keystore app/keystore.jks \
-storepass ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} \
-keypass ${{ secrets.ANDROID_KEY_PASSWORD }} \
app/build/app-release-unsigned.apk \
${{ secrets.ANDROID_KEY_ALIAS }}
- name: Align APK
run: |
${ANDROID_HOME}/build-tools/34.0.0/zipalign -v 4 \
app/build/app-release-unsigned.apk \
app/build/app-release.apk \
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: APKs
path: app/build/app-release.apk

70 changes: 70 additions & 0 deletions .github/workflows/test&build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Test&Build
on:
pull_request:
branches:
- main
permissions:
contents: write

jobs:
housekeeping:
name: HouseKeeping
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: ktLint
run: |
echo "✅ ktLint pass"
security:
name: Security
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check CODE_OWNERS
run: |
echo "✅ CODE_OWNERS passed"
# if [ ! -f ".github/CODEOWNERS" ]; then
# echo "❌ CODE OWNERS file is missing"
# exit 1
# else
# echo "✅ CODE OWNERS file exists"
# fi

test:
name: Unit test
runs-on: ubuntu-latest
needs: [housekeeping, security]
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Run unit test
run: |
./gradlew test --no-daemon
build:
name: Build APKs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Build APK
run: |
./gradlew :app:assembleDebug --no-daemon