-
Notifications
You must be signed in to change notification settings - Fork 1
149 lines (146 loc) Β· 4.84 KB
/
pr.yaml
File metadata and controls
149 lines (146 loc) Β· 4.84 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
name: CI
on:
pull_request:
types:
- opened
- synchronize
- edited
branches:
- main
permissions:
checks: write
pull-requests: write
jobs:
analyse:
name: Analysis π
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: π Checkout code
uses: actions/checkout@v2
- name: π Extract flutter version
id: fvmrc
# get flutter key from .fvmrc file (file is in json format)
run: echo "FLUTTER_VERSION=$(jq -r '.flutter' .fvmrc)" >> $GITHUB_OUTPUT
- name: π Set up Flutter
uses: subosito/flutter-action@v1
with:
flutter-version: ${{ steps.fvmrc.outputs.FLUTTER_VERSION }}
- name: π¦ Get dependencies
run: flutter pub get
- name: π Analyze code
continue-on-error: true
run: flutter analyze --no-pub >> analysis.txt
- name: π Set up Python
uses: actions/setup-python@v4.7.1
with:
python-version: '3.10'
- name: π Construct analysis comment
run: python .github/workflows/construct_analysis_comment.py analysis.txt ${{ github.event.pull_request.head.sha }} ${{ github.event.number }} comment.txt
- name: π€ Create GitHub App Token
uses: actions/create-github-app-token@v1.11.5
id: token
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_PRIVATE_KEY }}
- name: π¬ Post analysis comment
uses: peter-evans/create-or-update-comment@v3.1.0
with:
body-path: comment.txt
issue-number: ${{ github.event.pull_request.number }}
token: ${{ steps.token.outputs.token }}
- name: β
Annotate analysis results
uses: invertase/github-action-dart-analyzer@v3
test:
name: Testing π§ͺ
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: π Checkout code
uses: actions/checkout@v2
- name: π Extract flutter version
id: fvmrc
# get flutter key from .fvmrc file (file is in json format)
run: echo "FLUTTER_VERSION=$(jq -r '.flutter' .fvmrc)" >> $GITHUB_OUTPUT
- name: π Set up Flutter
uses: subosito/flutter-action@v1
with:
flutter-version: ${{ steps.fvmrc.outputs.FLUTTER_VERSION }}
- name: π Set up Python
uses: actions/setup-python@v4.7.1
with:
python-version: '3.10'
- name: π¦ Get dependencies
run: flutter pub get
- name: π οΈ Start Moodle mock server
uses: mockoon/cli-action@v1
with:
data-file: test/mockoon/moodle.json
port: 6000
- name: π Start public API mock server
uses: mockoon/cli-action@v1
with:
data-file: test/mockoon/public_api.json
port: 6008
- name: π§ͺ Start unit tests mock server
uses: mockoon/cli-action@v1
with:
data-file: test/mockoon/unit_tests.json
port: 3000
- name: ποΈ Start files mock server
uses: mockoon/cli-action@v1
with:
data-file: test/mockoon/files.json
port: 5000
- name: π Run tests
continue-on-error: true
run: flutter test --machine > test-results.json
- name: π€ Create GitHub App Token
uses: actions/create-github-app-token@v1.11.5
id: token
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_PRIVATE_KEY }}
- name: π Annotate test results
uses: dorny/test-reporter@v1.9.1
id: reporter
with:
name: Test Results
path: test-results.json
reporter: dart-json
token: ${{ steps.token.outputs.token }}
- run: pip install requests
- name: π Construct test comment
run: python .github/workflows/construct_unit_test_comment.py ${{ steps.reporter.outputs.url }} ${{ github.event.pull_request.head.sha }} comment.txt
- name: π¬ Post test comment
uses: peter-evans/create-or-update-comment@v3.1.0
with:
body-path: comment.txt
issue-number: ${{ github.event.pull_request.number }}
token: ${{ steps.token.outputs.token }}
validate-title:
name: Validate PR title
runs-on: ubuntu-latest
permissions:
pull-requests: read
statuses: write
steps:
- uses: amannn/action-semantic-pull-request@505e44b4f33b4c801f063838b3f053990ee46ea7 # v4.6.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
build
chore
ci
docs
feat
fix
perf
refactor
revert
style
test
subjectPattern: ^[A-Z].+$
subjectPatternError: |
The subject of the PR must begin with an uppercase letter.