How to automatically make the test of gut hubs for Android and iOS automatically

by SkillAiNest

Gut Hub Actions is a CI/CD (constant integration and permanent deployment) tool that is made directly in Github. This allows developers to explain FlooseWhich are a series of dynamic steps through events such as Push Code, Opening Bridge Requests, or Release.

For flurry developers, gut hub action is a powerful way to automatically test, construct and deploy in multiple platforms.

This guide will run you through the establishment of Gut Hub Actions for a fluttering project, which will cover everything from the terms to a detailed explanation of the workflow.

The table of content

  1. Why use gut hub’s actions in the development of the flurry?

  2. Provisions

  3. Step 1: Create a new blowing plan

  4. Step 2: Push the project on the gut hub

  5. Step 3: Create a Gut Hub Action Workflow

  6. Step 4: Prepare a gut hub token and add

  7. Step 5: Understand the Work Flu

  8. Step 6: Press the workflow and make it worthwhile

  9. Final notes

Why use gut hub’s actions in the development of the flurry?

Gut hub action automated tests ensure that all code changes are verified with the unit and the integration test. Continuous integration automatically produces blowing apps to confirm that the new code is properly integrated.

The code can automatically run to enforce and enforce luntel styling and maintain code standards. Automatic release apps smooth the packaging and distribution process. Customs workflows can be prepared to meet the project requirements. Cooperation has also been improved as the developer can see the results of the workflow directly in the bridge requests.

By introducing the actions of the gut hub, the fluttering projects are more reliable, maintaining and efficient.

Provisions

Before setting gut hub actions for your flurry project, make sure you have:

  1. The fluttering is locally installed of the SD So you can create and test the project before moving the gut hub.

  2. The gut is installed Managing the version control and pushing your project to the gut hub.

  3. A gut hub account And a The new repository Made for your flurry project.

  4. The basic understanding of Yamal syntaxSince the workflose is defined .yml Files

  5. A gut hub personal access token (PAT) To release bloods, which will be stored as a reservoir.

Step 1: Create a new blowing plan

Make a new fluttering project and start navigating it:

flutter create gh_flutter
cd gh_flutter

Change gh_flutter With the name of your favorite project. The pre -default structure and dependence begins with a plans.

Step 2: Push the project on the gut hub

Start the gut inside your project and push it on the gut hub:

git init
git add .
git commit -m "Initial commit"
git remote add origin 
git push -u origin main

Change With the storage you have built on the Gut Hub. It connects your local fluttering project with a gut hub, which can allow gut hub actions to your storage.

Step 3: Create a Gut Hub Action Workflow

Within your project, create a workflow configuration file. Workflows should be kept in .github/workflows/. Create a file that has a name ci.yml:

name: CI

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  flutter_test:
    name: Run Flutter Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-java@v3
        with:
          distribution: 'temurin'
          java-version: '17'
      - uses: subosito/flutter-action@v2
        with:
          channel: 'stable'
      - run: flutter pub get
      - run: flutter --version
      - run: flutter analyze
      - run: flutter test

  build_iOSApp:
    name: Build Flutter App (iOS)
    needs: (flutter_test)
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-java@v3
        with:
          distribution: 'temurin'
          java-version: '17'
      - uses: subosito/flutter-action@v2
        with:
          flutter-version: '3.19.0'
          dart-verion: '3.3.4'
          channel: 'stable'
      - run: flutter pub get
      - run: flutter clean
      - run: |
          flutter build ios --no-codesign
          cd build/ios/iphoneos
          mkdir Payload
          cd Payload
          ln -s ../Runner.app
          cd ..
          zip -r app.ipa Payload

  build_androidApk:
    name: Build Flutter App (Android)
    needs: (flutter_test)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-java@v3
        with:
          distribution: 'temurin'
          java-version: '17'
      - uses: subosito/flutter-action@v2
        with:
          channel: 'stable'
      - run: flutter pub get
      - run: flutter clean
      - run: flutter build apk --debug
      - uses: ncipollo/release-action@v1
        with:
          artifacts: "build/app/outputs/apk/debug/*"
          tag: v1.0.${{ github.run_number}}
          token: ${{ secrets.TOKEN}}

This workflow has been named CI And that means Continuous integration

Motivations

In the actions of the gut hub, Motivations Explain the events that cause workflower. This workflow, it, operates automatically when there are some incidents in the reservoir. Specifically, it hears:

  1. push: Whenever a new code is pushed main Branch, workflow will begin.

  2. pull_request: Whenever a bridge application is opened or updated that targets it main Branch, workflow will also start.

This ensures that the central branch is verified and examined directly through refreshments and bridges applications.

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

When this code operates the flu:

Jobs

There are 3 jobs in the workflow:

Job 1: flutter_test The unit runs tests and analysis.

jobs:
  flutter_test:
    runs-on: ubuntu-latest

It uses Ubinto As a runner.

The following steps are:

  1. Check -out code:

     - uses: actions/checkout@v3
    

    Downloads your repo in a runner.

  2. Compires Java (essential for Android Bloods while fluttering):

     - uses: actions/setup-java@v3
       with:
         distribution: 'temurin'
         java-version: '17'
    
  3. Setting SDK while fluttering:

     - uses: subosito/flutter-action@v2
       with:
         channel: 'stable'
    

    It installs a stable channel.

  4. Runs Commands:

    1. flutter pub get Installs dependent.

    2. flutter --version The checks installed the version.

    3. flutter analyze Analyzes the dart code for errors.

    4. flutter test Runs unit/widget tests.

If this work fails, jobs will not be run later.

Job 2: build_iOSApp makes iOS .ipa File

  build_iOSApp:
    needs: (flutter_test)
    runs-on: macos-latest

  steps:
  - uses: actions/checkout@v3

  - uses: subosito/flutter-action@v2
    with:
      flutter-version: '3.22.0'

  - name: Install CocoaPods dependencies
    run: |
      cd ios
      pod install

  - name: Build iOS App
    run: flutter build ipa --release --no-codesign

It just runs After flutter_test Successful and use Macos Runner (iOS is essential for bloods).

After installing the cocoopads dependent, the workflow comes into process flutter build ipa --release --no-codesign. These shell commands flutter to pack your iOS app in one .ipa File inside the runner’s blood directory. --no-codesign The flag allows the building without signing the credentials, which is easy for CI pipelines.

The following steps are:

  1. Sets the checkout repo + java (as before).

  2. Flutter but this time pins:

     flutter-version: '3.19.0'
     dart-verion: '3.3.4'   
     channel: 'stable'
    
  3. Runs Blood:

    1. flutter pub get Recover packages.

    2. flutter clean Cleans old construction.

    3. flutter build ios --no-codesign Makes the iOS app without signing.

    4. After the building:

      1. Goes in build/ios/iphoneos

      2. Creates a Payload Folder (essential for IPA structure).

      3. The harmony created Runner.app I Payload.

      4. Zip the folder app.ipa.

Result: A signed .ipa File

Job 3: build_androidApk Makes a debug Android .apk And uploads it as a release article.

  build_androidApk:
    needs: (flutter_test)
    runs-on: ubuntu-latest

  steps:
  - uses: actions/checkout@v3

  - uses: subosito/flutter-action@v2
    with:
      flutter-version: '3.22.0'

  - name: Build Android APK
    run: flutter build apk --release

It runs only after the test is passed.

For Android, after configuring the atmosphere of flurry, makes the workflow call flutter build apk --release. This command sets and packages the Android app in one .apk File is ready for distribution. The resulting file is placed inside build/app/outputs/flutter-apk Project Directory.

The following steps are:

  1. The repo checks, sets Java, and flushes.

  2. Runs:

    1. flutter pub get

    2. flutter clean

    3. flutter build apk --debug Makes a debug app.

  3. Upload APK using ncipollo/release-action@v1:

     artifacts: "build/app/outputs/apk/debug/*"
     tag: v1.0.${{ github.run_number }}
     token: ${{ secrets.TOKEN }}
    
    1. Uploads all debugs as a release sample.

    2. As the issuance of tags v1.0. (Like, v1.0.5,

    3. A gut hub uses Personal access token For,,,,,,,,,, for,, for,,,, for,,,, for,,, for,,,, for,,,, for,,,, for,,, for,,, for,,, for,,, for,,,, for,,, for,,, for,,,, for,,, for,,,, for,,, for,,, for,,,, for,,, for,,, for,,,, for,,, for,,,, for,,, for,,,, for,,, for,,,, for,,, for,,,, for,,,, for,,,, for,,,, for,,,, for,,,, for,,,, for,,, for,,, for,,, for,,, for,,,,, for,,,, for,,,, for,,,, for,, for,.TOKEN) Repo is safe in secrets.

Step 4: Prepare a gut hub token and add

Android Blood Job issued using APKS release-action. To verify you, you need to provide a gut hub personal access token. To do this, go Gut Hub Settings → Developer Settings → Personal Access token.

Prepare a new token with repo Copy permission and token immediately. Then go to your reservoir → Settings – Secrets – New Storage Secrets. Add the token with the name TOKEN.

Can now use the workflow ${{ secrets.TOKEN }} Safely

Step 5: Understand the Work Flu

This workflow is stimulated when the code is forwarded main Branch or when a bridge application is opened against it. Let’s break it:

The hiring of the trapped test

  • Environment: Moves ubuntu-latest.

Steps:

  1. actions/checkout@v3 Source code brings.

  2. actions/setup-java@v3 Installs Java, some are essential for the tools.

  3. subosito/flutter-action@v2 Running on the runner.

  4. flutter pub get Installs dependent.

  5. flutter analyze Code issues check.

  6. flutter test Test matters run.

This task compiles your code, passes the lining, and there is no failed test.

iOS app construction work

Steps: Similar setups like before, but after clearing old construction flutter cleanIt runs flutter build ios --no-codesign To create an iOS app without the need for a signature certificate. Shell packaged the app in a .ipa File

Android APK construction job

Steps:

  1. They flutter.

  2. Moves flutter clean And then makes Android APK.

  3. Use ncipollo/release-action@v1 To upload APK as the Gut Hub release, as is automatically tagged with version v1.0..

Step 6: Press the workflow and make it worthwhile

Save your file as .github/workflows/ci.yml And press the changes:

git add .
git commit -m "Add GitHub Actions workflow"
git push

When you push your changes to the gut hub, the workflow file is lifted automatically. To confirm that it is running, open your storage on the gut hub and click on Actions Tab in the upper part of the page. You will see a list of workflowers, each one has linked to the covenant that has mobilized them.

Click the current run to increase the details. In, you will get separate jobs Android And iOS Construction will show its status in every task in real time:

  1. A Yellow dot The “progress” indicates that the job is still going on.

  2. A Green Check Mark “Success” means the work ended successfully.

  3. A Red Cross Being “failed” means something went wrong.

That way, you can immediately tell if your Android and iOS construction has passed or if any of them need attention.

Running for a thunderous test

Build for iOS

Building for Android

Jobs were completed

Exhibit 2 app releases with the right hand side with the version

Detailed app Release version showcase

Final notes

With this setup, now you have:

  • Whenever you push or open the bridge application, automatic testing.

  • Automatic iOS builds on Macos Runners.

  • Automatic Android Gut Hub makes with the released app.

This ensures that every change is tested and that construction is permanently developed without manual measures.

For more details, see Gut Hub’s official action documents: https://docs.github.com/en/ACTIONS.

You may also like

Leave a Comment

At Skillainest, we believe the future belongs to those who embrace AI, upgrade their skills, and stay ahead of the curve.

Get latest news

Subscribe my Newsletter for new blog posts, tips & new photos. Let's stay updated!

@2025 Skillainest.Designed and Developed by Pro