Skip to content

Commit f9bd7f4

Browse files
committed
ci: split test and build example app
Signed-off-by: Shengqi Chen <[email protected]>
1 parent 9130224 commit f9bd7f4

File tree

3 files changed

+67
-38
lines changed

3 files changed

+67
-38
lines changed

.github/workflows/example-app.yml

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,63 +8,55 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-latest
1211
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
1312

1413
strategy:
1514
fail-fast: false
1615
matrix:
1716
variant: [debug, release]
17+
target: [apk, ios]
18+
include:
19+
- target: apk
20+
os: ubuntu-latest
21+
pre-build-script: ""
22+
build-args: ""
23+
debug-artifact-path: build/app/outputs/flutter-apk/app-debug.apk
24+
release-artifact-path: build/app/outputs/flutter-apk/app-release.apk
25+
- target: ios
26+
os: macos-latest
27+
pre-build-script: ""
28+
build-args: "--no-codesign"
29+
artifact-path: |
30+
build/ios/iphoneos/Runner.app
31+
32+
runs-on: ${{ matrix.os }}
33+
name: ${{ matrix.target }}-${{ matrix.variant }}
1834

1935
steps:
2036
- uses: actions/checkout@v6
2137
- uses: actions/setup-java@v5
38+
if: ${{ matrix.target == 'apk' }}
2239
with:
2340
distribution: 'temurin'
2441
java-version: '21'
2542
- uses: subosito/flutter-action@v2
2643
with:
2744
channel: 'stable'
2845
cache: true
29-
- run: dart pub get
30-
- run: dart format --output=none --set-exit-if-changed .
31-
- run: dart analyze
46+
47+
- name: pre-build-script script for ${{ matrix.target }}
48+
run: ${{ matrix.pre-build-script }}
49+
3250
- run: flutter pub get
3351
working-directory: example/
34-
#- run: flutter test
35-
- run: dart doc
36-
- name: Upload generated dartdoc
37-
uses: actions/upload-artifact@v4
38-
with:
39-
name: docs
40-
path: doc/
41-
- name: Evaluate score with pana
42-
run: |
43-
dart pub global activate pana
44-
dart pub global run pana .
45-
- run: flutter build apk --${{ matrix.variant }} --verbose
52+
53+
- name: Run flutter ${{ matrix.variant }} build on ${{ matrix.target }}
54+
run: flutter build ${{ matrix.target }} --${{ matrix.variant }} ${{ matrix.build-args }} --verbose
4655
working-directory: example/
56+
4757
- uses: actions/upload-artifact@v5
4858
with:
49-
name: example-apk-${{ matrix.variant }}
59+
name: example-${{ matrix.target }}-${{ matrix.variant }}
5060
path: |
51-
example/build/app/outputs/flutter-apk/app-${{ matrix.variant }}.apk
52-
example/build/reports/*
53-
54-
build-ios:
55-
runs-on: macos-latest
56-
strategy:
57-
fail-fast: false
58-
matrix:
59-
variant: [debug, release]
60-
61-
steps:
62-
- uses: actions/checkout@v5
63-
- uses: subosito/flutter-action@v2
64-
with:
65-
channel: 'stable'
66-
cache: true
67-
- run: flutter pub get
68-
working-directory: example/
69-
- run: flutter build ios --${{ matrix.variant }} --verbose --no-codesign
70-
working-directory: example/
61+
example/${{ matrix.debug-artifact-path }}
62+
example/${{ matrix.release-artifact-path }}

.github/workflows/test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [master, develop]
6+
pull_request:
7+
branches: [master, develop]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
13+
strategy:
14+
matrix:
15+
channel: [stable, beta]
16+
17+
steps:
18+
- uses: actions/checkout@v6
19+
- uses: subosito/flutter-action@v2
20+
with:
21+
channel: ${{ matrix.channel }}
22+
cache: true
23+
- run: dart pub get
24+
- run: dart format --output=none --set-exit-if-changed lib/
25+
- run: dart analyze
26+
# - run: dart test
27+
- run: dart doc
28+
- name: Upload generated dartdoc
29+
uses: actions/upload-artifact@v5
30+
with:
31+
name: docs-${{ matrix.channel }}
32+
path: doc/
33+
- name: Evaluate score with pana
34+
run: |
35+
dart pub global activate pana
36+
dart pub global run pana .

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Flutter NFC Kit
22

33
[![pub version](https://img.shields.io/pub/v/flutter_nfc_kit)](https://pub.dev/packages/flutter_nfc_kit)
4-
![Build Example App](https://github.com/nfcim/flutter_nfc_kit/workflows/Build%20Example%20App/badge.svg)
4+
[![Test](https://github.com/nfcim/flutter_nfc_kit/actions/workflows/test.yml/badge.svg)](https://github.com/nfcim/flutter_nfc_kit/actions/workflows/test.yml)
5+
[![Build Example App](https://github.com/nfcim/flutter_nfc_kit/actions/workflows/example-app.yml/badge.svg)](https://github.com/nfcim/flutter_nfc_kit/actions/workflows/example-app.yml)
56

67
Yet another plugin to provide NFC functionality on Android, iOS and browsers (by WebUSB, see below).
78

0 commit comments

Comments
 (0)