-
Notifications
You must be signed in to change notification settings - Fork 99
70 lines (61 loc) · 1.67 KB
/
unit_tests.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
name: unit_tests
on:
pull_request:
paths-ignore:
- "docs/**"
- "**.md"
push:
branches:
- main
paths-ignore:
- "docs/**"
- "**.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
detect_changed_packages:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.filter.outputs.changed_packages }}
has_changes: ${{ steps.filter.outputs.changed_packages != '[]' }}
steps:
- uses: actions/checkout@v4.1.7
- uses: ./.github/actions/changes
id: filter
unit_tests:
name: "Run unit tests"
runs-on: ubuntu-latest
needs: detect_changed_packages
if: needs.detect_changed_packages.outputs.has_changes == 'true'
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.detect_changed_packages.outputs.packages) }}
target: ["html", "io"]
steps:
- uses: actions/checkout@v4.1.7
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- uses: bluefireteam/melos-action@v3
with:
melos-version: "3.0.1"
- name: Run unit tests on Chrome
if: matrix.target == 'html'
run: |
melos exec \
--scope=${{ matrix.package }}* \
--dir-exists="test" \
--fail-fast -- "flutter test --platform chrome"
- name: Run unit tests
if: matrix.target == 'io'
run: |
melos exec \
--scope=${{ matrix.package }}* \
--dir-exists="test" \
--fail-fast -- "flutter test"