GitHub has released a CI/CD tool, GitHub Actions, that can be integrated directly into the GitHub repository. And it’s free for Public projects.

I tried using the Flutter project and found no other advantages compared to Travis – CI so far besides convenience (no need to jump out of github).

Existing Action: github.com/subosito/fl…

Run a screenshot

The configuration file

Test is triggered when pull_request occurs

.github/workflows/check.yml

name: F4LabCI
on: pull_request

jobs:
  check:
    name: Test on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-java@v1
        with:
          java-version: "12.x"
      - uses: subosito/flutter-action@v1
        with:
          # same with pubspec.yaml
          flutter-version: "1.9.1 + hotfix. 2"
      - run: flutter pub get
      - run: flutter test --no-pub test/
Copy the code

newrelease-v*Tag triggers packaging and uploads to release

.github/workflows/release.yml

name: F4LabCIRelease
on:
  push:
    tags:
      - "release-v*"

jobs:
  release-to-gitHub:
    name: release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-java@v1
        with:
          java-version: "12.x"
      - uses: subosito/flutter-action@v1
        with:
          # same with pubspec.yaml
          flutter-version: "1.9.1 + hotfix. 2"
      - run: flutter pub get
      - run: flutter analyze --no-pub --no-current-package lib/ test/
      - run: flutter test --no-pub test/
      - run: flutter build apk
      - uses: softprops/action-gh-release@v1
        with:
          files: build/app/outputs/apk/release/app-release.apk
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy the code

conclusion

  • The overall construction idea is similar to gitlab-CI and Travis-CI. Just the keywords might be different
  • Open source is convenient and powerful. Easy to reuse actions provided by others
  • Some functions are still not as convenient as Travis-CI and Gitlab-CI
  • Warehouse for this experiment: github.com/stefanJi/Fl…