-
Notifications
You must be signed in to change notification settings - Fork 1
117 lines (92 loc) · 3.45 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
push:
branches: ["main"]
tags:
# must align with the tag-pattern configured on pub.dev, often just replace
- "v[0-9]+.[0-9]+.[0-9]+" # tag-pattern on pub.dev: 'v{{version}}'
pull_request:
branches: ["main"]
jobs:
test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
# Note: This workflow uses the latest stable version of the Dart SDK.
# You can specify other versions if desired, see documentation here:
# https://github.com/dart-lang/setup-dart/blob/main/README.md
# - uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603
- uses: dart-lang/setup-dart@v1
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.x
- run: flutter --version
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set up local.properties
run: bash .github/workflows/create_properties.sh
- name: Install dependencies
run: flutter pub get
- name: Verify formatting
run: dart format --output=none --set-exit-if-changed .
# Optionally remove '--fatal-infos' for less strict analysis.
- name: Analyze project source
run: dart analyze --fatal-infos
- name: Run library tests
run: flutter test
- name: Run example app tests
run: cd example && flutter test
- name: Run Android unit tests
run: cd example/android && gradle test
- name: Install Dependencies
run: cd example/ios && pod install
- name: Run iOS unit tests
run: |
cd example/ios && \
xcodebuild test \
-workspace Runner.xcworkspace \
-scheme Runner \
-configuration Debug \
-allowProvisioningUpdates \
-destination 'platform=iOS Simulator,name=iPhone 16,OS=18.2'
- name: Test docs generation
run: dart doc --dry-run
# dry run publish
- run: ./generate_example_md.sh > example/example.md
- run: cat example/example.md
- run: flutter pub publish --dry-run
publish:
# only run tags, after the tests have passed
if: startsWith(github.ref, 'refs/tags/v')
needs: [test]
permissions:
id-token: write # Required for authentication using OIDC
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# This creates the OIDC token that the publish step uses
- uses: dart-lang/setup-dart@v1
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.x
- run: flutter --version
- name: Install dependencies
run: flutter pub get
# create an example/example.md file with all of the example code
# otherwise pub.dev defaults to the contents of lib/main.md which is fairly unhelpful
- run: ./generate_example_md.sh > example/example.md
- name: Publish
# --force is required because otherwise it asks for a confirmation and times out waiting
run: flutter pub publish --force