Skip to content

Commit fc54a5a

Browse files
committed
Fixed CI Flutter detection
1 parent badee96 commit fc54a5a

4 files changed

Lines changed: 16 additions & 12 deletions

File tree

.github/workflows/_base-flutter.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
working-directory: ${{ inputs.path }}
9292

9393
- name: Run analysis
94-
run: flutter analyze --fatal-warnings
94+
run: flutter analyze --fatal-warnings ./lib/
9595
working-directory: ${{ inputs.path }}
9696

9797
test:

.github/workflows/_base-has_flutter.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@ jobs:
3030
exit 0
3131
fi
3232
33-
if awk '
34-
$1 == "environment:" { in_env=1 }
35-
in_env && $1 == "sdk:" { in_env=0 }
36-
in_env && $1 == "flutter:" { found=1 }
37-
END { exit(found?0:1) }
38-
' "$PUBSPEC"; then
33+
# if has a "flutter:" anywhere in the file
34+
if grep -q "flutter:" "$PUBSPEC"; then
3935
echo "Flutter SDK detected."
4036
echo "is_flutter=1" >> "$GITHUB_OUTPUT"
4137
else

.github/workflows/example.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,34 @@ on:
1010
paths:
1111
- 'example/**/*.dart'
1212
- 'example/**/*.yaml'
13-
- .github/workflows/_base-dart.yaml
14-
- .github/workflows/_base-flutter.yaml
13+
- .github/workflows/_base*.yaml
1514
- .github/workflows/example.yaml
1615
release:
1716
types: [published]
1817

1918
jobs:
19+
is-flutter:
20+
uses: ./.github/workflows/_base-has_flutter.yaml
21+
with:
22+
path: '.'
23+
2024
dart:
25+
needs: is-flutter
26+
if: needs.is-flutter.outputs.is_flutter == '0'
2127
strategy:
2228
matrix:
23-
example: [ basic, advanced_example ]
29+
example: [ editor ]
2430
name: "${{ matrix.example }}"
2531
uses: ./.github/workflows/_base-dart.yaml
2632
with:
2733
path: "example/${{ matrix.example }}"
2834

2935
flutter:
36+
needs: is-flutter
37+
if: needs.is-flutter.outputs.is_flutter == '1'
3038
strategy:
3139
matrix:
32-
example: [ basic, advanced_example ]
40+
example: [ editor ]
3341
name: "${{ matrix.example }}"
3442
uses: ./.github/workflows/_base-flutter.yaml
3543
with:

.github/workflows/package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
paths:
1313
- '**.dart'
1414
- './*.yaml'
15-
- .github/workflows/_base-dart.yaml
15+
- .github/workflows/_base*.yaml
1616
- .github/workflows/package.yaml
1717
release:
1818
types: [published]

0 commit comments

Comments
 (0)