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

ci(build): Improve pull request build #1305

Merged
merged 35 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4e0ede4
ci(build): improve build
validcube Sep 23, 2023
9d24476
ci(build): checkout at pr
validcube Sep 23, 2023
9d7a8d4
ci(build): add token env
validcube Sep 23, 2023
c22ef84
ci(build): minify description for pr-number
validcube Sep 23, 2023
1c544a0
ci(build): short sha
validcube Sep 23, 2023
06285b4
ci(build): continue on error
validcube Sep 23, 2023
917b18c
ci(build-input): add flutter variant master
validcube Sep 23, 2023
7d4d331
ci(build): apply suggestions from code review
validcube Sep 25, 2023
9d40a31
ci(build): move to thollander/actions-comment-pull-request@v2
validcube Sep 25, 2023
36dfec2
ci(build-artefact): remove placeholder
validcube Sep 25, 2023
2d7ed97
ci(build): don't checkout all branches and tags
validcube Sep 25, 2023
f9eb354
ci: tons of fixes
validcube Sep 25, 2023
8d338eb
ci: apply suggested
validcube Sep 25, 2023
4108da4
ci: apply suggested
validcube Sep 25, 2023
d09a788
build: profile appname
validcube Sep 28, 2023
db70230
ci(build-inputs): reinstated profile variant
validcube Sep 28, 2023
cd55808
ci(build): reinstated JDK Gradle cache
validcube Sep 28, 2023
5011f95
ci(build): don't checkout multiple times
validcube Sep 28, 2023
945fb0a
ci(build): fix url pointing to PR
validcube Sep 28, 2023
323bcf3
What???? You need to checkout two times???
validcube Sep 28, 2023
41917d8
ci(build): rename flutter variant to branch
validcube Oct 4, 2023
cc7f4f5
ci(build): remove redundant information from notify
validcube Oct 4, 2023
539ca25
ci(build): don't continue on error
validcube Oct 8, 2023
7f07ea2
ci(build): output flutter provided sha1 file
validcube Oct 8, 2023
59cbdbb
ci(build): update format
validcube Oct 8, 2023
4261c6e
ci(build): now continue on error
validcube Oct 16, 2023
0feba1d
This will work, 100%, there's no way
validcube Oct 27, 2023
a687ade
ci: revamp
validcube Oct 27, 2023
1e5833d
Update pr-build.yml
validcube Oct 27, 2023
270be1e
I thought it doesn't work like that :sob:
validcube Oct 28, 2023
8a99858
Apply suggestions from code review
oSumAtrIX Oct 28, 2023
7d02239
ci(build): remove cache from summary
validcube Nov 10, 2023
5068f37
ci(build): apply suggestions from code review
validcube Nov 11, 2023
d0fd5a0
ci(build): migrate depreciated command
validcube Nov 11, 2023
2e0cfe3
Merge branch 'dev' into ci/better-build
oSumAtrIX Nov 19, 2023
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
111 changes: 94 additions & 17 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,122 @@
name: PR Build

on:
pull_request:
paths:
- ".github/workflows/pr-build.yml"
- "android/**"
- "assets/**"
- "lib/**"

workflow_dispatch:
inputs:
# Flutter
flutter-branch:
description: Flutter branch
type: choice
default: 'stable'
options:
- stable
- beta
- dev
- master
flutter-cache:
description: Cache
type: boolean
default: true
oSumAtrIX marked this conversation as resolved.
Show resolved Hide resolved
# Application configuration
app-flavour:
description: App flavour
default: 'release'
type: choice
options:
- release
- debug
- profile
# Pull Request
pr-number:
description: PR number (No hashtag)
required: true

run-name: "Build PR ${{ inputs.pr-number }}"

jobs:
build:
name: Build
name: Build the application
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Setup
env:
GH_TOKEN: ${{ github.token }}
run: |
gh repo clone ${{ github.repository }}
cd revanced-manager
gh repo set-default ${{ github.repository }}
gh pr checkout ${{ inputs.pr-number }}

echo "DATETIME=$( TZ='UTC+0' date --rfc-email )" >> $GITHUB_ENV
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v4
with:
# Make sure the release step uses its own credentials:
# https:/cycjimmy/semantic-release-action#private-packages
persist-credentials: false
validcube marked this conversation as resolved.
Show resolved Hide resolved
fetch-depth: 0

- name: Setup JDK
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'zulu'
cache: gradle

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
channel: ${{ inputs.flutter-branch }}
cache: ${{ inputs.flutter-cache }}

- name: Install Flutter dependencies
run: flutter pub get

- name: Generate files with Builder
run: flutter packages pub run build_runner build --delete-conflicting-outputs

- name: Build with Flutter
env:
continue-on-error: true
id: flutter-build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: flutter build apk --debug
run: |
flutter build apk --${{ inputs.app-flavour }};

- name: Prepare to comment
run: |
if [[ "${{ steps.flutter-build.outcome }}" == "success" ]]; then
echo "MESSAGE=✅ The CI has sucessfully built ReVanced Manager at ${{ env.COMMIT_HASH }}." >> $GITHUB_ENV
else
echo "MESSAGE=🚫 The CI has unable to build ReVanced Manager at ${{ env.COMMIT_HASH }}." >> $GITHUB_ENV
oSumAtrIX marked this conversation as resolved.
Show resolved Hide resolved
fi

- name: "Comment to Pull Request #${{ inputs.pr-number }}"
uses: thollander/actions-comment-pull-request@v2
with:
GITHUB_TOKEN: ${{ github.token }}
pr_number: ${{ inputs.pr-number }}
mode: recreate
message: |
## ⚒️ ReVanced PR Build workflow

${{ env.MESSAGE }}

You can check the details on run ID [${{ github.run_id }}](https:/${{ github.repository }}/actions/runs/${{ github.run_id }})!
oSumAtrIX marked this conversation as resolved.
Show resolved Hide resolved

### ⚙️ Overview
- App flavor: ${{ inputs.app-flavour }}
- Flutter branch: ${{ inputs.flutter-branch }}
- Flutter cache: ${{ inputs.flutter-cache }}
validcube marked this conversation as resolved.
Show resolved Hide resolved
validcube marked this conversation as resolved.
Show resolved Hide resolved
- Start time: ${{ env.DATETIME }}

- name: Upload build
uses: actions/upload-artifact@v3
with:
name: revanced-manager
path: build/app/outputs/flutter-apk/app-debug.apk
if-no-files-found: error
name: revanced-manager-(${{ env.COMMIT_HASH }}-${{ inputs.pr-number }}-${{ inputs.app-flavour }})-${{ inputs.flutter-branch }}
path: |
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk.sha1
10 changes: 10 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ android {
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
}
}
profile {
shrinkResources false
minifyEnabled false
resValue "string", "app_name", "ReVanced Manager Profile"
applicationIdSuffix ".profile"
signingConfig signingConfigs.debug
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
}
}
Ushie marked this conversation as resolved.
Show resolved Hide resolved
}

packagingOptions {
Expand Down