-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (43 loc) · 1.29 KB
/
on-pr-push-code-check.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
name: On PR & Push do code check
on:
push:
branches: [ main ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v1
with:
files:
- 'pubspec.yaml'
- 'tools/add_imports/pubspec.yaml'
- name: Early exit
if: steps.check_files.outputs.files_exists == 'false'
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup dart
uses: dart-lang/setup-dart@v1
- name: Get main dependencies
run: dart pub get
- name: Get add_imports dependencies
run: dart pub get
working-directory: tools/add_imports
- name: Run static code analysis
uses: invertase/github-action-dart-analyzer@v1
with:
fatal-infos: true
- name: Dart Code Metrics
uses: solid-software/dart-code-metrics-action@v5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fatal_warnings: true
fatal_style: true
- name: Check formatting
run: dart format . --set-exit-if-changed