okaryo.log

Building a Workflow to Run Flutter Test and Lint with CircleCI | okaryo.log

Building a Workflow to Run Flutter Test and Lint with CircleCI

    #Flutter#CircleCI#CI/CD

Introduction

I had been using GitHub Actions to build my CI, but to save usage limits, I decided to switch to CircleCI for running tests and linting in my Flutter project.

Here is the workflow I implemented.

Workflow

Here’s the workflow I set up:

version: 2.1

orbs:
  flutter: circleci/flutter@2

executors:
  flutter:
    machine:
      image: ubuntu-2004:current
      resource_class: medium

parameters:
  flutter_version:
    type: string
    default: "3.22.3"

jobs:
  test:
    executor:
      name: flutter
    steps:
      - checkout
      - flutter/install_sdk_and_pub:
          version: << pipeline.parameters.flutter_version >>
      - run:
          name: Run Test
          command: flutter test

  lint:
    executor:
      name: flutter
    steps:
      - checkout
      - flutter/install_sdk_and_pub:
          version: << pipeline.parameters.flutter_version >>
      - run:
          name: Run Lint
          command: flutter analyze

workflows:
  ci:
    jobs:
      - test
      - lint

CircleCI provides an official Flutter Orb, which makes setting up the environment and running test and lint commands easy.

You can find more details here:

Conclusion

Using CircleCI’s official Flutter Orb made the CI/CD setup process feel much easier. I hope this serves as a helpful reference for building your own Flutter CI/CD workflow.


Related Posts
Related Posts
Promotion

This site uses Google Analytics.