forked from widgetbook/widgetbook
-
Notifications
You must be signed in to change notification settings - Fork 1
177 lines (141 loc) · 4.45 KB
/
_package.yml
File metadata and controls
177 lines (141 loc) · 4.45 KB
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
172
173
174
175
176
177
name: Package Workflow
on:
workflow_call:
inputs:
working_directory:
required: true
type: string
min_flutter_version:
required: true
type: string
jobs:
# Although pana is now checking for pub downgrade, but the check
# does not validate the backwards compatibility of Flutter itself,
# but only the compatibility of the dependencies.
# This job installs the minimum Flutter version and checks if the
# dependencies are compatible with it.
check-min-version:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ inputs.working_directory }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.min_flutter_version }}
cache: true
- name: Check Dependencies Compatibility
run: dart pub downgrade
- name: Check Analysis issues
run: dart analyze lib
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ inputs.working_directory }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Install Melos
run: dart pub global activate melos
- name: Bootstrap Package
run: |
PACKAGE_NAME=$(head -1 pubspec.yaml | cut -c7-)
melos bootstrap --scope=$PACKAGE_NAME --include-dependencies
- name: Run Tests
run: |
if grep -q "sdk: flutter" pubspec.yaml; then
flutter test
else
dart test
fi
lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ inputs.working_directory }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Install Melos
run: dart pub global activate melos
- name: Bootstrap Package
run: |
PACKAGE_NAME=$(head -1 pubspec.yaml | cut -c7-)
melos bootstrap --scope=$PACKAGE_NAME --include-dependencies
- name: Check Formatting
run: dart format --set-exit-if-changed .
- name: Analyze
run: dart analyze . --fatal-infos
pana:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ inputs.working_directory }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Install Melos
run: flutter pub global activate melos
- name: Bootstrap Package
run: |
PACKAGE_NAME=$(head -1 pubspec.yaml | cut -c7-)
melos bootstrap --scope=$PACKAGE_NAME --include-dependencies
# To speed up the pana checks, we will bypass the screenshots validation
# As it requires installing libwebp which can take up to 1.5 minute,
# and other seconds are spent in actually reading and checking the images.
# Since we are sure that our screenshots are valid, we can skip this step.
- name: Remove screenshots entry
run: yq eval 'del(.screenshots)' -i pubspec.yaml
- name: Install pana
run: dart pub global activate pana
- name: Check Package Score
run: pana . --no-warning --exit-code-threshold 0 --no-dartdoc
publish:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment: pub.dev
permissions:
id-token: write
defaults:
run:
working-directory: ${{ inputs.working_directory }}
steps:
- name: Checkout
uses: actions/checkout@v6
# Sets the GitHub-signed OIDC token
- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Install Melos
run: dart pub global activate melos
- name: Bootstrap Package
run: |
PACKAGE_NAME=$(head -1 pubspec.yaml | cut -c7-)
melos bootstrap --scope=$PACKAGE_NAME --include-dependencies
- name: Publish
run: dart pub publish --force