Skip to content

Gpac-LLC/patrol_build_flutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flutter Build Patrol

Test Version

This project is a Go-based utility for managing the installation and versioning of the Patrol CLI. It automates the process of checking if the Patrol CLI is installed, installing it if necessary, and verifying its version.

How to use this Step

Can be run directly with the Bitrise CLI, just git clone this repository, cd into it's folder in your Terminal/Command Line and call bitrise run test.

Check the bitrise.yml file for required inputs which have to be added to your .bitrise.secrets.yml file!

Step by step:

  1. Open up your Terminal / Command Line
  2. git clone the repository
  3. cd into the directory of the step (the one you just git cloned)
  4. Create a .bitrise.secrets.yml file in the same directory of bitrise.yml (the .bitrise.secrets.yml is a git ignored file, you can store your secrets in it)
  5. Check the bitrise.yml file for any secret you should set in .bitrise.secrets.yml
    • Best practice is to mark these options with something like # define these in your .bitrise.secrets.yml, in the app:envs section.
  6. Once you have all the required secret parameters in your .bitrise.secrets.yml you can just run this step with the bitrise CLI: bitrise run test

An example .bitrise.secrets.yml file:

envs:
- A_SECRET_PARAM_ONE: the value for secret one
- A_SECRET_PARAM_TWO: the value for secret two

How to create your own step

  1. Create a new git repository for your step (don't fork the step template, create a new repository)
  2. Copy the step template files into your repository
  3. Fill the step.sh with your functionality
  4. Wire out your inputs to step.yml (inputs section)
  5. Fill out the other parts of the step.yml too
  6. Provide test values for the inputs in the bitrise.yml
  7. Run your step with bitrise run test - if it works, you're ready

For Step development guidelines & best practices check this documentation: https://github.com/bitrise-io/bitrise/blob/master/_docs/step-development-guideline.md.

NOTE:

If you want to use your step in your project's bitrise.yml:

  1. git push the step into it's repository
  2. reference it in your bitrise.yml with the git::PUBLIC-GIT-CLONE-URL@BRANCH step reference style:
- git::https://github.com/user/my-step.git@branch:
   title: My step
   inputs:
   - my_input_1: "my value 1"
   - my_input_2: "my value 2"

You can find more examples of step reference styles in the bitrise CLI repository.

How to contribute to this Step

  1. Fork this repository
  2. git clone it
  3. Create a branch you'll work on
  4. To use/test the step just follow the How to use this Step section
  5. Do the changes you want to
  6. Run/test the step before sending your contribution
    • You can also test the step in your bitrise project, either on your Mac or on bitrise.io
    • You just have to replace the step ID in your project's bitrise.yml with either a relative path, or with a git URL format
    • (relative) path format: instead of - original-step-id: use - path::./relative/path/of/script/on/your/Mac:
    • direct git URL format: instead of - original-step-id: use - git::https://github.com/user/step.git@branch:
    • You can find more example of alternative step referencing at: https://github.com/bitrise-io/bitrise/blob/master/_examples/tutorials/steps-and-workflows/bitrise.yml
  7. Once you're done just commit your changes & create a Pull Request

Share your own Step

You can share your Step or step version with the bitrise CLI. If you use the bitrise.yml included in this repository, all you have to do is:

  1. In your Terminal / Command Line cd into this directory (where the bitrise.yml of the step is located)
  2. Run: bitrise run test to test the step
  3. Run: bitrise run audit-this-step to audit the step.yml
  4. Check the share-this-step workflow in the bitrise.yml, and fill out the envs if you haven't done so already (don't forget to bump the version number if this is an update of your step!)
  5. Then run: bitrise run share-this-step to share the step (version) you specified in the envs
  6. Send the Pull Request, as described in the logs of bitrise run share-this-step

Features

  • Automatically checks if the Patrol CLI is installed.
  • Installs the Patrol CLI if it is not present.
  • Retrieves and parses the Patrol CLI version using semantic versioning.
  • Provides compatibility checks for Patrol CLI, Flutter, and Patrol package versions.

Prerequisites

  • Go 1.24 or higher
  • Access to the dart and flutter commands in your terminal
  • Internet connection for downloading dependencies

Installation

  1. Install dependencies:
go mod tidy

2export CUSTOM_PATROL_VERSION=3.5.1. Build the project:

go build -o patrol-install

Usage

Run the project using the following command:

go run main.go

Alternatively, if you built the project, execute the binary:

./patrol-install

Environment Variables

You can set the following environment variable to customize the installation:

CUSTOM_PATROL_VERSION: Specify a custom version of the Patrol CLI to install. If not set, the latest version will be installed.

example:

export CUSTOM_PATROL_VERSION=3.5.1

Project Structure

  • commands/: Defines terminal commands used in the project.
  • steps/install/: Contains logic for installing and managing the Patrol CLI.
  • utils/: Utility functions for printing, executing commands, and managing environment variables.
  • constants/: Contains regex patterns and compatibility tables.

About

A Bitrise Step to build your Flutter application for Patrol UI tests. It's designed to seamlessly integrate into your CI/CD workflow, supporting both Android and iOS builds. This Step automates the entire setup process, activating the Patrol CLI, and running the build command, packaging your app and tests.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages