Skip to content

Commit cd8abb3

Browse files
committed
Revised GitHub CI
Separate quality check Publish requires Flutter Integration Test and Code Quality to be passed Flutter integration test now runs on every push
1 parent 1ba579b commit cd8abb3

3 files changed

Lines changed: 41 additions & 32 deletions

File tree

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,18 @@
11
name: Flutter Integration Test
22

33
on:
4-
pull_request:
5-
branches: [ main ]
64
push:
7-
branches: [ main ]
85

96
jobs:
107
integration:
11-
runs-on: macos-latest
12-
8+
runs-on: ubuntu-latest
139
steps:
14-
- uses: actions/checkout@v4
15-
16-
- name: Set up Flutter
17-
uses: subosito/flutter-action@v2
18-
with:
19-
flutter-version: 'stable'
20-
21-
- name: Run Flutter doctor
22-
run: flutter doctor -v
23-
24-
- name: Test Flutter integration
25-
run: |
26-
cd example
27-
flutter pub get
28-
flutter test integration_test
10+
- uses: actions/checkout@v4
11+
- name: Set up Flutter
12+
uses: subosito/flutter-action@v2
13+
with:
14+
channel: stable
15+
flutter-version-file: pubspec.yaml
16+
- name: Flutter integration test
17+
working-directory: ./example
18+
run: flutter test integration_test

.github/workflows/publish.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
name: Publish Flutter Plugin
22

33
on:
4-
push:
5-
tags:
6-
- 'v*'
4+
workflow_run:
5+
workflows:
6+
- "Code Quality"
7+
- "Flutter Integration Test"
8+
types:
9+
- completed
710

811
jobs:
912
publish:
13+
if: startsWith(github.event.workflow_run.head_ref, 'refs/tags/v')
1014
runs-on: ubuntu-latest
1115
steps:
1216
- name: Checkout code
1317
uses: actions/checkout@v4
1418
with:
1519
fetch-depth: 0
16-
1720
- name: Set up Flutter
1821
uses: subosito/flutter-action@v2
1922
with:
20-
flutter-version: '3.16.0' # or specify latest stable
21-
23+
channel: stable
24+
flutter-version-file: pubspec.yaml
2225
- name: Install dependencies
2326
run: flutter pub get
24-
2527
- name: Analyze code
2628
run: flutter analyze
27-
2829
- name: Format code
2930
run: dart format --output=none --set-exit-if-changed .
30-
3131
- name: Update version
3232
run: |
3333
LATEST_TAG=$(git describe --tags --abbrev=0)
@@ -38,12 +38,10 @@ jobs:
3838
git add pubspec.yaml
3939
git commit -m "chore: update version to $VERSION"
4040
git push
41-
4241
- name: Run tests
4342
run: flutter test
44-
4543
- name: Publish plugin
4644
run: flutter pub publish --force
4745
env:
4846
PUB_HOSTED_URL: https://pub.dartlang.org
49-
PUB_TOKEN: ${{ secrets.PUB_TOKEN }}
47+
PUB_TOKEN: ${{ secrets.PUB_TOKEN }}

.github/workflows/quality.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Code Quality
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
integration:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Set up Flutter
12+
uses: subosito/flutter-action@v2
13+
with:
14+
channel: stable
15+
flutter-version-file: pubspec.yaml
16+
- name: Install dependencies
17+
run: flutter pub get
18+
- name: Analyze code
19+
run: flutter analyze
20+
- name: Format code
21+
run: dart format --output=none --set-exit-if-changed .

0 commit comments

Comments
 (0)