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
Changes from 11 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
82 changes: 69 additions & 13 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,51 @@
name: PR Build

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

workflow_dispatch:
inputs:
flutter-variant:
validcube marked this conversation as resolved.
Show resolved Hide resolved
required: true
type: choice
description: Flutter variant
validcube marked this conversation as resolved.
Show resolved Hide resolved
default: 'stable'
options:
- stable
- beta
- dev
- master
app-variant:
required: true
type: choice
description: App variant
default: 'release'
options:
- release
- debug
- profile
validcube marked this conversation as resolved.
Show resolved Hide resolved
pr-number:
required: true
description: PR number (No hashtag)

permissions:
contents: read
pull-requests: write

jobs:
build:
name: Build
continue-on-error: true
validcube marked this conversation as resolved.
Show resolved Hide resolved
validcube marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
env:
GH_TOKEN: ${{ github.token }}
run: |
gh repo clone ReVanced/revanced-manager
gh pr checkout ${{ inputs.pr-number }}
validcube marked this conversation as resolved.
Show resolved Hide resolved
- name: Checkout
uses: actions/checkout@v4
with:
# Make sure the release step uses its own credentials:
# https://github.com/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:
Expand All @@ -28,7 +54,7 @@ jobs:
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
channel: ${{ inputs.flutter-variant }}
validcube marked this conversation as resolved.
Show resolved Hide resolved
cache: true
- name: Install Flutter dependencies
run: flutter pub get
Expand All @@ -37,9 +63,39 @@ jobs:
- name: Build with Flutter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: flutter build apk --debug
run: |
flutter build apk --${{ inputs.app-variant }};
- name: Set env
run: |
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: revanced-manager
name: revanced-manager-${{ env.COMMIT_HASH }}-${{ inputs.pr-number }}-${{ inputs.app-variant }}-${{ inputs.flutter-variant }}
validcube marked this conversation as resolved.
Show resolved Hide resolved
path: build/app/outputs/flutter-apk/app-debug.apk
validcube marked this conversation as resolved.
Show resolved Hide resolved

notify-pull-request:
name: Notify Pull Request
runs-on: ubuntu-latest
needs: build
steps:
- name: Set env
run: |
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
validcube marked this conversation as resolved.
Show resolved Hide resolved
if [[ "${{ needs.build.outputs.build_status }}" == "success" ]]; then
echo "MESSAGE=✅ Build succeeded!" >> $GITHUB_OUTPUT
else
echo "MESSAGE=🚫 Build failed!" >> $GITHUB_OUTPUT
fi
validcube marked this conversation as resolved.
Show resolved Hide resolved
- name: Comment to Pull Request #${{ inputs.pr-number }}
uses: thollander/actions-comment-pull-request@v2
with:
GITHUB_TOKEN: ${{ secrets.PULL_REQUESTS_WRITE }}
message: |
${{ env.MESSAGE }} @ ${{ env.COMMIT_HASH }}
validcube marked this conversation as resolved.
Show resolved Hide resolved

You can check the details [here](${{ github.event.workflow_run.html_url }}).
Ushie marked this conversation as resolved.
Show resolved Hide resolved

- PR: ${{ inputs.pr-number }}
validcube marked this conversation as resolved.
Show resolved Hide resolved
validcube marked this conversation as resolved.
Show resolved Hide resolved
- App variant: ${{ inputs.app-variant }}
- Flutter variant: ${{ inputs.flutter-variant }}
validcube marked this conversation as resolved.
Show resolved Hide resolved
validcube marked this conversation as resolved.
Show resolved Hide resolved