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

chore: configure comment and release pipelines #1154

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

AsCress
Copy link
Contributor

@AsCress AsCress commented Jan 13, 2025

#1153 should be merged before this!

Adds the following pipelines to our repository:

  1. pull_request_comment.yml: See chore: updated pull request pipeline to configure comments pslab-android#2487 for more info. A pipeline which checks for a successful build and then supplies the Android debug APK for testing through a comment in the PR.
  2. release.yml: Responsible for updating changelogs based on the release body, fetching screenshots and promoting the APK to the production track on every release.

Summary by Sourcery

Add CI workflows for commenting on pull requests with APK download links upon successful builds, and for automating releases by updating changelogs, fetching screenshots, and promoting the APK to production.

CI:

  • Add a pull request comment workflow to provide the debug APK download link on PRs.
  • Add a release workflow to automate the release process, including changelog updates, screenshot fetching, and production promotion.

Tests:

  • Store the pull request number as an artifact to be used in the comment workflow.

Copy link
Contributor

sourcery-ai bot commented Jan 13, 2025

Reviewer's Guide by Sourcery

This PR configures two new GitHub Actions workflows: one for commenting on pull requests with the debug APK, and another for automating releases.

Sequence diagram for PR comment workflow

sequenceDiagram
    participant PR as Pull Request
    participant CI as Badge Magic PR CI
    participant Comment as Comment Workflow
    participant GH as GitHub API

    PR->>CI: PR Created/Updated
    CI->>CI: Build APK
    CI->>CI: Save PR number
    CI->>CI: Upload artifacts
    CI-->>Comment: Workflow completed
    Comment->>GH: Download PR number artifact
    alt Build Success
        Comment->>GH: Download APK artifact
        Comment->>GH: Check existing comments
        alt Existing bot comment
            Comment->>GH: Update comment with APK link
        else No existing comment
            Comment->>GH: Create new comment with APK link
        end
    else Build Failure
        Comment->>GH: Check existing comments
        alt Existing bot comment
            Comment->>GH: Update comment with failure
        else No existing comment
            Comment->>GH: Create new comment with failure
        end
    end
Loading

Sequence diagram for release workflow

sequenceDiagram
    participant GH as GitHub Release
    participant Release as Release Workflow
    participant Fastlane as Fastlane Branch
    participant Play as Play Store

    GH->>Release: Release Published
    Release->>Release: Download release assets
    Release->>Release: Generate screenshots
    Release->>Fastlane: Update metadata & changelogs
    Release->>Fastlane: Update screenshots
    Release->>Fastlane: Force push changes
    Release->>Play: Promote version to production
Loading

File-Level Changes

Change Details Files
Adds a pull request comment workflow
  • This workflow is triggered when the "Badge Magic PR CI" workflow completes.
  • It checks the status of the "Badge Magic PR CI" workflow.
  • If successful, it retrieves the debug APK and posts a comment on the PR with a link to download the APK.
  • If the build fails, it posts a comment indicating the failure.
.github/workflows/pull_request_comment.yml
Adds a release workflow
  • This workflow is triggered when a release is published.
  • It updates the changelog with the release body.
  • It fetches screenshots and uploads them to the release.
  • It promotes the release APK to the production track.
.github/workflows/release.yml
Modifies the pull request workflow
  • Saves the pull request number to a file.
  • Uploads the pull request number as an artifact.
.github/workflows/pull_request.yml
Modifies the Android build action
  • Builds a debug APK.
  • Uploads the debug APK as an artifact.
.github/actions/android/action.yml
Modifies the push workflow
  • Runs the release-drafter action to generate release notes.
  • Uploads the release APK and version code as assets.
.github/workflows/push.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@AsCress AsCress requested a review from adityastic January 13, 2025 04:51
@AsCress AsCress added the chore label Jan 13, 2025
@AsCress AsCress self-assigned this Jan 13, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @AsCress - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

.github/workflows/release.yml Show resolved Hide resolved
- name: Download repository
uses: actions/checkout@v4

- name: Prepare Build Keys
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to prepare keys?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was exactly the question which came to my mind as well. I think we don't, do we ? For some reason it's there in pslab.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it.

@adityastic adityastic enabled auto-merge (squash) January 13, 2025 09:28
auto-merge was automatically disabled January 13, 2025 09:36

Head branch was pushed to by a user without write access

@AsCress AsCress requested a review from adityastic January 13, 2025 09:37
@adityastic adityastic merged commit 49e823b into fossasia:flutter_app Jan 13, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants