Skip to content

Commit

Permalink
ci: Build for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Jun 8, 2024
1 parent 05e799a commit 45caff3
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 8 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build PR

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on: [pull_request]

jobs:
build:
name: Build app
runs-on: ubuntu-latest

steps:
- name: Clone repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Android SDK
run: |
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.3"
- name: Setup Gradle
uses: null2264/actions/gradle-setup@c63d62af63686cb442114b979d4bedb96a514881
with:
java: 17
distro: adopt

- name: Copy CI gradle.properties
run: |
mkdir -p ~/.gradle
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
- name: Build and run tests
if: startsWith(env.VERSION_TAG, 'r') != true && startsWith(env.VERSION_TAG, 'v') != true
run: ./gradlew assembleDevDebug testDevDebugUnitTest

- name: Publish test report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
include_passed: true
detailed_summary: true
report_paths: '**/build/test-results/test*/TEST-*.xml'

- name: Upload APK to artifact
uses: actions/upload-artifact@v4
with:
path: app/build/outputs/apk/dev/debug/*.apk
16 changes: 8 additions & 8 deletions .github/workflows/build_push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Build release
on:
push:
branches:
Expand Down Expand Up @@ -99,8 +99,8 @@ jobs:
report_paths: '**/build/test-results/test*/TEST-*.xml'

- name: Sign APK
if: env.VERSION_TAG != ''
uses: null2264/actions/android-signer@c63d62af63686cb442114b979d4bedb96a514881
if: env.VERSION_TAG != ''
with:
releaseDir: app/build/outputs/apk/standard/${{ startsWith(env.VERSION_TAG, 'v') && 'release' || 'nightly' }}
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
Expand All @@ -109,6 +109,12 @@ jobs:
keyPassword: ${{ secrets.KEY_PASSWORD }}
summarise: true

- name: Upload APK to artifact
uses: actions/upload-artifact@v4
if: startsWith(env.VERSION_TAG, 'r') != true && startsWith(env.VERSION_TAG, 'v') != true
with:
path: app/build/outputs/apk/standard/debug/*.apk

- name: Clean up build artifacts
if: env.VERSION_TAG != ''
run: |
Expand Down Expand Up @@ -213,9 +219,3 @@ jobs:
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.NIGHTLY_PAT }}

# - name: Delete Old Nightly
# if: startsWith(env.VERSION_TAG, 'r') && env.PREV_TAG != ''
# run: gh release delete ${{ env.PREV_TAG }} --cleanup-tag
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 45caff3

Please sign in to comment.