Skip to content

Commit 3653de0

Browse files
committed
Improves static testing and improves workflow speed
1 parent 302bffb commit 3653de0

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

.github/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ All workflows use the [Ensure SHA Pinned Actions](https://github.com/marketplace
1717

1818
Also known as CI, Continuous Integration runs Flutter static and dynamic tests, then the coverage report is stored as an artifact for reference. Modify the workflow to further process the code coverage file using [code quality](https://github.com/marketplace?type=actions) or [code review](https://github.com/marketplace?category=code-review&type=actions) actions.
1919

20+
_Note:_ The [Get the Flutter Version Environment](https://github.com/marketplace/actions/get-the-flutter-version-environment) action requires that the [`pubspec.yaml`](pubspec.yaml) file contains an `environment:flutter:` key.
21+
2022
## License
2123
The scripts and documentation in this project are released under the [MIT License](LICENSE)

.github/workflows/ci.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,48 +33,49 @@ jobs:
3333
uses: zgosalvez/github-actions-get-flutter-version-env@8c616b4685d25cceda9bafa61f6c72670f6aa01e # v1.1.1
3434
with:
3535
pubspec-file-path: code/pubspec.yaml
36-
- name: Cache Flutter packages
37-
id: cache
36+
- name: Cache Flutter
37+
id: flutter-cache
3838
uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a # v2.1.3
3939
with:
4040
path: flutter
41-
key: pub-${{ env.cache-name }}-${{ steps.get-flutter-version.outputs.version }}-${{ hashFiles('code/pubspec.lock') }}
41+
key: ${{ env.cache-name }}-${{ steps.get-flutter-version.outputs.version }}-${{ hashFiles('code/pubspec.lock') }}
4242
restore-keys: |
43-
pub-${{ env.cache-name }}-${{ steps.get-flutter-version.outputs.version }}-
44-
pub-${{ env.cache-name }}-
45-
pub-
43+
${{ env.cache-name }}-${{ steps.get-flutter-version.outputs.version }}-
44+
${{ env.cache-name }}-
4645
env:
47-
cache-name: cache-flutter-packages
46+
cache-name: flutter-cache
4847
- name: Clone the Flutter repository
49-
if: steps.cache.outputs.cache-hit != 'true'
48+
if: steps.flutter-cache.outputs.cache-hit != 'true'
5049
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
5150
with:
5251
repository: flutter/flutter
5352
ref: ${{ steps.get-flutter-version.outputs.version }}
5453
path: flutter
5554
- name: Add the flutter tool to the path
56-
run: echo "$GITHUB_WORKSPACE/flutter/bin" >> $GITHUB_PATH
55+
run: |
56+
echo "$GITHUB_WORKSPACE/flutter/bin" >> $GITHUB_PATH
57+
echo "$GITHUB_WORKSPACE/flutter/bin/cache/dart-sdk/bin" >> $GITHUB_PATH
5758
- name: Populate the Flutter tool's cache of binary artifacts
58-
if: steps.cache.outputs.cache-hit != 'true'
59+
if: steps.flutter-cache.outputs.cache-hit != 'true'
5960
run: |
6061
flutter config --no-analytics
6162
flutter precache
6263
- name: Get Flutter packages
63-
if: steps.cache.outputs.cache-hit != 'true'
6464
run: flutter pub get
6565
working-directory: code
6666

6767
# static testing
6868
- name: Analyze Flutter
6969
if: matrix.category == 'static'
70-
uses: zgosalvez/github-actions-analyze-flutter@42999ac72bf187609b2b61ec93bf0b03e4ebca6e # v1.1.0
70+
uses: zgosalvez/github-actions-analyze-flutter@f1a0a3abe4211723932c4d5571702c8f71e11f20 # v1.3.0
7171
with:
72+
fail-on-warnings: true
7273
working-directory: code
7374

7475
# unit testing
7576
- name: Run Flutter ${{ matrix.category }} tests
7677
if: matrix.category != 'static'
77-
run: flutter test --coverage --coverage-path=./coverage/lcov.${{ matrix.category }}.info test/${{ matrix.category }}s
78+
run: flutter test --no-pub --coverage --coverage-path=./coverage/lcov.${{ matrix.category }}.info test/${{ matrix.category }}s
7879
working-directory: code
7980
- name: Upload code coverage to GitHub
8081
if: matrix.category != 'static'

0 commit comments

Comments
 (0)