-
Notifications
You must be signed in to change notification settings - Fork 4
117 lines (92 loc) · 3.19 KB
/
ci.yaml
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
name: CI Checks
on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]
env:
FLUTTER_VERSION: "3.19.5"
jobs:
full_CI:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.FLUTTER_MIN_VERSION}}
cache: true
- name: Set up Melos
uses: bluefireteam/melos-action@v3
- name: Run analyzer
run: melos run analyze
- name: Check formatting of Dart files
run: melos run format_check
- name: Run unit tests
run: melos run test_unit
- name: Run golden tests
run: melos run test_golden
selective_CI:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.FLUTTER_MIN_VERSION}}
cache: true
- name: Set up Melos
uses: bluefireteam/melos-action@v3
- name: Set MELOS_PACKAGES filter with packages names that are affected by the Git Diff
run: |
changeAffectedPackages=$(melos list --diff=origin/main...HEAD --include-dependents)
if [[ $changeAffectedPackages == *"No package"* ]]; then
echo "MELOS_PACKAGES=dummy_value_to_filter_out_all_packages" >> $GITHUB_ENV
else
echo "MELOS_PACKAGES=$(echo "$changeAffectedPackages" | paste -sd ',' -)" >> $GITHUB_ENV
fi
- name: Print MELOS_PACKAGES global scope
run: |
echo "The Melos global scope is: $MELOS_PACKAGES"
echo "It'll be used as a global filter for the remaining Melos scripts in the pipeline!"
- name: Run analyzer with Git Diff using MELOS_PACKAGES
run: melos run analyze
- name: Check formatting of Dart files with Git Diff using MELOS_PACKAGES
run: melos run format_check
- name: Run unit tests with Git Diff using MELOS_PACKAGES
run: melos run test_unit
- name: Run golden tests with Git Diff using MELOS_PACKAGES
run: melos run test_golden
# This Melos filtering approach will not work as intended until the following
# feature is implemented https://github.com/invertase/melos/pull/702.
selective_CI_alternative:
if: false
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.FLUTTER_MIN_VERSION}}
cache: true
- name: Set up Melos
uses: bluefireteam/melos-action@v3
- name: Run analyzer with Git Diff
run: melos run analyze_diff
- name: Check formatting of Dart files with Git Diff
run: melos run format_check_diff
- name: Run unit tests with Git Diff
run: melos run test_unit_diff
- name: Run golden tests with Git Diff
run: melos run test_golden_diff