-
Notifications
You must be signed in to change notification settings - Fork 31
172 lines (149 loc) · 6.41 KB
/
polygonid_flutter_sdk.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: polygonid_flutter_sdk
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
# 4 jobs are configured:
# 1. common: runs setup, clean, generate, format, analyze, test and reports
# 2. ios: runs tests on iOS devices
# 3. android: runs tests on Android devices
# 4. publish: publishes the package to pub.dev (only dry run)
jobs:
common:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.4'
channel: 'stable'
cache: true
# instead of "channel: stable", you could be more precise by specifying the exact version of Flutter you're using:
# flutter-version: '<FLUTTER_VERSION>'
- name: Verify Flutter version
run: flutter --version
- name: Clean, dependencies and generate for SDK
run: flutter clean&&flutter pub get&&dart run build_runner build --delete-conflicting-outputs
- name: Clean, dependencies and generate for Example
env:
ENV_POLYGON_MUMBAI: ${{ secrets.ENV_POLYGON_MUMBAI }}
ENV_POLYGON_MAINNET: ${{ secrets.ENV_POLYGON_MUMBAI }}
run: cd example&&flutter clean&&flutter pub get&&dart run build_runner build --delete-conflicting-outputs
- name: Format
run: dart format --set-exit-if-changed lib test example
- name: Analyze
run: flutter analyze lib test example
- name: Run tests
run: flutter test --coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
# job responsible for running Flutter tests on iOS devices
ios:
# needs: common
# Creates a build matrix for your jobs. You can define different variations of an environment to run each job
strategy:
matrix:
device:
# The available simulators are listed by the "xcrun xctrace list devices" command
- "iPhone 13 Pro Max Simulator (16.2)" # the name of the simulator could be different depending on the macos version you are using
# if one of the jobs in the matrix expansion fails, the rest of the jobs will be cancelled
fail-fast: true
runs-on: macos-latest # or macos-latest if you prefer, but be aware that the available simulators could be different if you run a different version
steps:
- name: checkout
uses: actions/checkout@v3
- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.4'
channel: 'stable'
cache: true
# instead of "channel: stable", you could be more precise by specifying the exact version of Flutter you're using:
# flutter-version: '<FLUTTER_VERSION>'
- name: Verify Flutter version
run: flutter --version
- name: Clean, dependencies and generate for SDK
run: flutter clean&&flutter pub get&&dart run build_runner build --delete-conflicting-outputs
- name: Clean, dependencies and generate for Example
env:
ENV_POLYGON_MUMBAI: ${{ secrets.ENV_POLYGON_MUMBAI }}
ENV_POLYGON_MAINNET: ${{ secrets.ENV_POLYGON_MUMBAI }}
run: cd example&&flutter clean&&flutter pub get&&dart run build_runner build --delete-conflicting-outputs
- name: "List all simulators"
run: "xcrun xctrace list devices"
- name: "Start Simulator"
# the command "xcrun simctl boot" expects a device identifier
# the assignment of the UDID variable consists of retrieving the ID of the simulator
# by extracting it from the command "xcrun xctrace list devices"
run: |
UDID=$(xcrun xctrace list devices | grep "^${{ matrix.device }}" | awk '{gsub(/[()]/,""); print $NF}')
echo $UDID
xcrun simctl boot "${UDID:?No Simulator with this name found}"
#- name: Run integration tests
# run: cd example&&flutter test integration_test/libpolygonid_test.dart --verbose
# job responsible for running Flutter tests on Android devices
# android:
# needs: common
# runs-on: macos-latest
# strategy:
# matrix:
# api-level: [ 32 ] #[ 21, 23, 29, 32 ]
# target: [ google_apis ] #[ default, google_apis ]
# if one of the jobs in the matrix expansion fails, the rest of the jobs will be cancelled
# fail-fast: true
# steps:
# - name: Setup Java
# uses: actions/setup-java@v3
# with:
# distribution: 'zulu'
# java-version: "12.x"
# cache: 'gradle'
# - name: Gradle cache
# uses: gradle/gradle-build-action@v2
# - name: AVD cache
# uses: actions/cache@v3
# id: avd-cache
# with:
# path: |
# ~/.android/avd/*
# ~/.android/adb*
# key: avd-${{ matrix.api-level }}
# - name: create AVD and generate snapshot for caching
# if: (github.base_ref == 'develop' || github.base_ref == 'main') && steps.avd-cache.outputs.cache-hit != 'true'
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: ${{ matrix.api-level }}
# target: ${{ matrix.target }}
# force-avd-creation: false
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: false
# arch: x86_64
# profile: Nexus 6
# script: echo "Generated AVD snapshot for caching."
#- name: Run integration tests
# if: github.base_ref == 'develop' || github.base_ref == 'main'
# more info on https://github.com/ReactiveCircus/android-emulator-runner
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: ${{ matrix.api-level }}
# target: ${{ matrix.target }}
# force-avd-creation: false
# emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: true
# arch: x86_64
# profile: Nexus 6
# script: cd example&&flutter test integration_test/libpolygonid_test.dart --verbose
# job responsible for publishing the package to pub.dev
publish:
needs: [ common ] #, ios , android ]
runs-on: ubuntu-latest
steps:
- name: Publish dry run
if: github.base_ref == 'main'
run: flutter pub publish --dry-run