Skip to content

Commit

Permalink
[ci] Setup flutter-action based CI (#178)
Browse files Browse the repository at this point in the history
* [ci] Setup flutter-action based CI

With multiple platforms and coverage.

* [codecov] disable PR comments

* [readme] add codecov badge
  • Loading branch information
jpnurmi authored Mar 7, 2021
1 parent e975d40 commit 0a7a8dc
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 68 deletions.
104 changes: 59 additions & 45 deletions .github/workflows/all_plugins.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: all_plugins

env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'

on:
pull_request:
push:
Expand All @@ -16,110 +13,127 @@ jobs:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: 'Git Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Install Flutter'
run: ./.github/workflows/scripts/install-flutter.sh beta
uses: subosito/flutter-action@refs/pull/79/head
- name: 'Install Tools'
run: |
./.github/workflows/scripts/install-tools.sh
flutter pub global activate melos
flutter pub global activate tuneup
- name: 'Bootstrap Workspace'
run: melos bootstrap
- name: 'Dart Analyze'
run: |
melos exec -c 3 -- \
tuneup check
melos run analyze
- name: 'Pub Check'
run: |
melos exec -c 1 --no-private --ignore="*example*" -- \
pub publish --dry-run
melos run lint:pub
format:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v1
- name: 'Git Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Install Flutter'
run: ./.github/workflows/scripts/install-flutter.sh beta
uses: subosito/flutter-action@refs/pull/79/head
- name: 'Install Tools'
run: |
./.github/workflows/scripts/install-tools.sh
curl -sL https://github.com/google/google-java-format/releases/download/google-java-format-1.3/google-java-format-1.3-all-deps.jar -o $HOME/google-java-format.jar
flutter pub global activate melos
flutter pub global activate flutter_plugin_tools
- name: 'Bootstrap Workspace'
run: melos bootstrap
- name: 'Dart'
run: |
melos exec -c 1 -- \
flutter format .
./.github/workflows/scripts/validate-formatting.sh
- name: 'Objective-C'
if: ${{ success() || failure() }}
- name: 'Melos Format'
run: melos run format
- name: 'Validate Formatting'
run: |
melos exec -c 4 --ignore="*platform_interface*" --ignore="*web*" -- \
find . -maxdepth 3 -name "*.h" -o -name "*.m" -print0 \| xargs -0 clang-format -i --style=Google --verbose
./.github/workflows/scripts/validate-formatting.sh
- name: 'Java'
if: ${{ success() || failure() }}
run: |
melos exec -c 4 --ignore="*platform_interface*" --ignore="*web*" -- \
find . -maxdepth 12 -name "*.java" -print0 \| xargs -0 java -jar $HOME/google-java-format.jar --replace
./.github/workflows/scripts/validate-formatting.sh
build_examples_dart:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: 'Git Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Install Flutter'
run: ./.github/workflows/scripts/install-flutter.sh beta
uses: subosito/flutter-action@refs/pull/79/head
- name: 'Install Tools'
run: ./.github/workflows/scripts/install-tools.sh
run: flutter pub global activate melos
- name: 'Bootstrap Workspace'
run: melos bootstrap
- name: 'Build Example Snapshots'
run: |
melos exec -c 1 --scope="*example*" -- \
flutter build bundle
melos run build:examples:bundle
test:
runs-on: ubuntu-latest
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
continue-on-error: true
timeout-minutes: 15
steps:
- uses: actions/checkout@v1
- name: 'Git Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Install Flutter'
run: ./.github/workflows/scripts/install-flutter.sh beta
uses: subosito/flutter-action@refs/pull/79/head
- name: 'Install Tools'
run: ./.github/workflows/scripts/install-tools.sh
run: flutter pub global activate melos
- name: 'Bootstrap Workspace'
run: melos bootstrap
- name: 'Flutter Test'
run: |
melos exec -c 3 --dir-exists=test --ignore="*example*" --ignore="*web*" -- \
flutter test
melos run test
if: matrix.os != 'ubuntu-latest'
- name: 'Collect Coverage'
run: |
melos run coverage
if: matrix.os == 'ubuntu-latest'
- name: Upload Coverage
uses: codecov/codecov-action@v1
with:
token: ${{secrets.CODECOV_TOKEN}}
files: packages/*/coverage/lcov.info
if: matrix.os == 'ubuntu-latest'

integration_tests:
runs-on: ubuntu-latest
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest]
continue-on-error: true
timeout-minutes: 15
steps:
- uses: actions/checkout@v1
- name: 'Git Checkout'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Install Flutter'
run: |
./.github/workflows/scripts/install-flutter.sh dev --force
uses: subosito/flutter-action@refs/pull/79/head
with:
channel: dev
- name: 'Install Tools'
run: |
./.github/workflows/scripts/install-tools.sh
flutter pub global activate melos
flutter config --enable-linux-desktop
- name: 'Setup Linux'
run: |
sudo apt update
sudo apt install -y cmake dbus libblkid-dev libgtk-3-dev liblzma-dev ninja-build pkg-config xvfb
sudo apt install -y network-manager upower
if: matrix.os == 'ubuntu-latest'
- name: 'Bootstrap Workspace'
run: melos bootstrap
- name: 'Flutter Integration Test'
run: |
melos run test:e2e:linux
if: matrix.os == 'ubuntu-latest'
13 changes: 0 additions & 13 deletions .github/workflows/scripts/install-flutter.sh

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows/scripts/install-tools.sh

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ build/
/.fvm

.melos_tool/
**/*.env
**/*.env

lcov.info
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<a href="https://github.com/fluttercommunity/plus_plugins/actions?query=workflow%3Aall_plugins">
<img src="https://github.com/fluttercommunity/plus_plugins/workflows/all_plugins/badge.svg" alt="all_plugins GitHub Workflow Status"/>
</a>
<a href="https://codecov.io/gh/flutter_community/plus_plugins/">
<img src="https://codecov.io/gh/fluttercommunity/plus_plugins/graph/badge.svg" alt="all_plugins Coverage"/>
</a>
<a href="https://twitter.com/FlutterComm">
<img src="https://img.shields.io/twitter/follow/FlutterComm.svg?colorA=1da1f2&colorB=&label=Follow%20on%20Twitter" alt="Follow on Twitter">
</a>
Expand Down
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: false
16 changes: 13 additions & 3 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,24 @@ scripts:
# Analyze the project for Dart analysis issues.
# - Requires `pub global activate tuneup`.
analyze: >
melos exec -c 1 --fail-fast -- \
pub global run tuneup check
melos exec -c 3 -- \
tuneup check
# Formats the code of all packages (Java, Objective-C, and Dart).
# - Requires `flutter_plugin_tools` (`pub global activate flutter_plugin_tools`).
# - Requires `git`.
# - Requires `clang-format` (can be installed via Brew on MacOS).
format: pub global run flutter_plugin_tools format
format: flutter pub global run flutter_plugin_tools format

# Build iOS plugin example apps.
build:examples:ios: >
melos exec -c 1 --scope="*example*" --fail-fast -- \
flutter build ios --no-codesign

# Build example bundles.
build:examples:bundle: >
melos exec -c 1 --scope="*example*" --fail-fast -- \
flutter build bundle

# Build Android plugin example apps.
build:examples:android: >
melos exec -c 1 --scope="*example*" --fail-fast -- \
Expand All @@ -47,6 +52,11 @@ scripts:
melos exec -c 1 --fail-fast --dir-exists=test --scope="*web*" -- \
flutter test --platform=chrome

# Coverage
coverage: >
melos exec -c 1 --fail-fast --dir-exists=test --ignore="*example*" --ignore="*web*" -- \
flutter test --coverage
# Run all test driver e2e tests in the example apps, use this for mobile.
# Will target Android/iOS depending on what emulator/simulator you have running.
test:e2e: >
Expand Down

0 comments on commit 0a7a8dc

Please sign in to comment.