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): refresh #1521

Draft
wants to merge 16 commits into
base: dev
Choose a base branch
from
Draft
44 changes: 27 additions & 17 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: PR Build
on:
workflow_dispatch:
inputs:

# Flutter
flutter-branch:
description: Flutter branch
Expand All @@ -17,19 +18,25 @@ on:
description: Cache
type: boolean
default: true

# Application configuration
app-flavour:
app-flavor:
description: App flavour
default: 'release'
type: choice
options:
- release
- debug
- profile

# Pull Request
pr-number:
description: PR number (No hashtag)
description: PR number
required: true

# Additional
flutter-build-arguments:
description: Flutter build arguments

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

Expand All @@ -41,7 +48,7 @@ jobs:
contents: read
pull-requests: write
steps:
- name: Setup
- name: Setup the PR's repository
env:
GH_TOKEN: ${{ github.token }}
run: |
Expand All @@ -50,10 +57,10 @@ jobs:
gh repo set-default ${{ github.repository }}
gh pr checkout ${{ inputs.pr-number }}

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

- name: Checkout
- name: Checkout the repository
uses: actions/checkout@v4
with:
persist-credentials: false
Expand All @@ -76,14 +83,17 @@ jobs:

- name: Generate files with Builder
run: dart run build_runner build --delete-conflicting-outputs

- name: Dart static analysis
validcube marked this conversation as resolved.
Show resolved Hide resolved
uses: zgosalvez/github-actions-analyze-dart@v3

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

- name: Prepare to comment
run: |
Expand All @@ -93,6 +103,14 @@ jobs:
echo "MESSAGE=🚫 ReVanced Manager ${{ env.COMMIT_HASH }} build failed." >> $GITHUB_ENV
fi

- name: Upload build
uses: actions/upload-artifact@v3
with:
name: revanced-manager-(${{ env.COMMIT_HASH }}-${{ inputs.pr-number }}-${{ inputs.app-flavor }})-${{ inputs.flutter-branch }}
path: |
build/app/outputs/flutter-apk/app-${{ inputs.app-flavor }}.apk
build/app/outputs/flutter-apk/app-${{ inputs.app-flavor }}.apk.sha1

- name: "Comment to Pull Request #${{ inputs.pr-number }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this step comment as @revanced-bot?

Copy link
Member Author

@validcube validcube Dec 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this step comment as @revanced-bot?

This was mentioned in the initial pull request for ci(build), this suggestion depends on the repository manager which is out of my limit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repository manager being who? @oSumAtrIX can you look into this?

uses: thollander/actions-comment-pull-request@v2
with:
Expand All @@ -104,18 +122,10 @@ jobs:

${{ env.MESSAGE }}

You can see more details in run [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})!
Checkout the Dart static analyze check or download the artifact at [job summary](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).

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

- name: Upload build
uses: actions/upload-artifact@v3
with:
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