-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (80 loc) · 2.46 KB
/
ci-pr.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
name: Continuous Integration Pull Request
on:
pull_request:
types:
- assigned
- unassigned
- opened
- edited
- synchronize
- reopened
- labeled
- unlabeled
- ready_for_review
workflow_dispatch:
concurrency:
group: ci-pr-${{ github.ref }}
cancel-in-progress: true
jobs:
dependencies:
name: 📦 Setup Dependencies
runs-on: ubuntu-latest
outputs:
fl-cache-key: ${{ steps.fl-setup.outputs.CACHE-KEY }}
fl-pub-cache-key: ${{ steps.fl-setup.outputs.PUB-CACHE-KEY }}
steps:
- name: 📚 Code Checkout
uses: actions/checkout@v4
- name: 🐦 Setup Flutter SDK
id: fl-setup
uses: subosito/flutter-action@v2
with:
flutter-version-file: ./pubspec.yaml
channel: stable
cache: true
cache-key: |
fl-:channel:-v:version:-:os:-:arch:-ci-pr-${{ hashFiles('./pubspec.lock') }}
pub-cache-key: |
fl-pub-:channel:-v:version:-:os:-:arch:-ci-pr-${{ hashFiles('./pubspec.lock') }}
- name: 📦 Get dependencies
run: flutter pub get
ci-pr:
name: 🔍 PR Linting
needs: dependencies
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: 📚 Code Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 Restore Dependencies
uses: subosito/flutter-action@v2
with:
flutter-version-file: ./pubspec.yaml
channel: stable
cache: true
cache-key: ${{needs.dependencies.outputs.fl-cache-key}}
pub-cache-key: ${{needs.dependencies.outputs.fl-pub-cache-key}}
- name: 🏗️ Build code utils
run: |
dart run build_runner build -d
flutter gen-l10n
- name: ⚙️ Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: latest
- name: 📦 Install DangerJs and DangerDart
run: |
npm install -g danger
dart pub global activate danger_dart
- name: 🔍 Lint Commits
run: |
VERBOSE=true dart run commitlint_cli --from=${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to=${{ github.event.pull_request.head.sha }}
- name: 🔍 Lint Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
danger_dart ci --failOnErrors