-
-
Notifications
You must be signed in to change notification settings - Fork 48
128 lines (102 loc) Β· 3.21 KB
/
review.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
name: PR Review
on:
pull_request:
branches:
- dev
- test
- stage
- master
types:
- opened
- synchronize
workflow_dispatch:
concurrency:
group: review-${{ github.base_ref }}-${{ github.head_ref }}
cancel-in-progress: true
permissions:
contents: read
actions: read
checks: write
jobs:
branch-naming-check:
name: Branch Naming Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check branch naming
run: |
branch_name="${{ github.event.pull_request.head.ref }}"
regex="^(feature|bugfix|hotfix|chore|merge|MERGE)\/[a-zA-Z0-9\-]+$"
if [[ ! $branch_name =~ $regex && "$branch_name" != "master" && "$branch_name" != "dev" && ! "$branch_name" =~ ^dependabot/ ]]; then
echo "error: Branch name does not follow naming convention"
echo "Please follow the correct format: <category>/<description-in-kebab-case>"
echo "Example: feature/sc-3000-create-new-button-component or chore/my-feature"
exit 1
fi
review:
name: Review Flutter PR
runs-on: ubuntu-latest
needs: [branch-naming-check]
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.10.0"
channel: "stable"
cache: true
- name: Flutter Version
run: flutter --version
- name: Update Firebase CLI
run: npm install -g firebase-tools
- name: Debug Firebase CLI
run: firebase --version
- uses: w9jds/setup-firebase@main
with:
tools-version: 11.21.0
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
- name: Prepare firebase
run: |
dart pub global activate flutterfire_cli
- name: Print firebase cli logs
run: cat firebase-debug.log
if: failure()
- name: Install dependencies
run: flutter pub get
- name: Check format lib
run: dart format .
- name: Generate
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Analyze
run: flutter analyze
- name: Run tests
run: |
mkdir reports
flutter test --reporter=json > reports/test-results.json
if: success() || failure()
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: "Unit Tests"
reporter: 'flutter-json'
path: 'reports/test-results.json'
- name: Check genhtml installation
run: |
if ! command -v genhtml &> /dev/null; then
echo "genhtml not found. Installing lcov package..."
sudo apt-get update
sudo apt-get install lcov
fi
continue-on-error: true
- name: Check sed installation
run: |
if ! command -v sed &> /dev/null; then
echo "sed not found. Installing sed..."
sudo apt-get update
sudo apt-get install sed
fi
continue-on-error: true