generated from nimblehq/git-template
-
Notifications
You must be signed in to change notification settings - Fork 4
146 lines (122 loc) · 4.2 KB
/
test.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
name: CI
on:
# Trigger the workflow on push or pull request,
# but push action is only for the feature branch
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
test:
name: Template initializing scripts test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out
uses: actions/checkout@v3
- name: Set up Flutter environment
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.10.5'
- name: Generate new project
run: |
dart pub global activate mason_cli
mason get
mason make template -c mason-config.json
- name: Get Flutter dependencies
run: flutter pub get
- name: Run code generator
run: flutter packages pub run build_runner build --delete-conflicting-outputs
- name: Check for any formatting issues in the code
run: dart format --set-exit-if-changed .
- name: Statically analyze the Dart code for any errors
run: flutter analyze .
- name: Install Danger JS
run: npm install -g danger
- name: Activate Danger Dart
run: dart pub global activate danger_dart
- name: Run danger ci
run: danger_dart ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run widget tests, unit tests
run: flutter test --machine --coverage
generate_mason_bundle:
# The job generate_mason_bundle identify that the job test must complete successfully
# before this generate_mason_bundle job will run
needs: test
name: Generate Mason bundle
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Set up Flutter environment
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.10.5'
- name: Install Mason CLI
run: |
dart pub global activate mason_cli
mason get
- name: Generate Mason bundle
run: |
mason bundle bricks/permission_handler -t dart -o bricks/template/hooks/bundles
- id: changes
name: Check for changes in the Mason bricks
run: |
count=$(git status bricks --porcelain | wc -l)
echo "count=$count" >> $GITHUB_OUTPUT
- name: Commit & push the Mason bundle changes
if: steps.changes.outputs.count > 0
run: |
git config user.name team-nimblehq
git config user.email [email protected]
git add bricks
git commit -m "[Chore] Generate Mason bundle"
git push
generate_sample_project:
# The job generate_sample_project identify that the job generate_mason_bundle must complete successfully
# before this generate_sample_project job will run
needs: generate_mason_bundle
name: Generate the sample project
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Set up Flutter environment
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.10.5'
- name: Remove the old sample project
run: |
rm -rf sample
- name: Set the project name "sample"
uses: jossef/[email protected]
with:
file: mason-config.json
field: project_name
value: sample
- name: Generate the new "sample" project
run: |
dart pub global activate mason_cli
mason get
mason make template -c mason-config.json -o sample
- id: changes
name: Check for changes in the sample project
run: |
count=$(git status sample --porcelain | wc -l)
echo "count=$count" >> $GITHUB_OUTPUT
- name: Commit & push the sample project changes
if: steps.changes.outputs.count > 0
run: |
git config user.name team-nimblehq
git config user.email [email protected]
git add sample
git commit -m "[Chore] Generate & update sample project"
git push