-
Notifications
You must be signed in to change notification settings - Fork 258
135 lines (117 loc) · 4.75 KB
/
dart_vm.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Dart (VM)
on:
workflow_call:
inputs:
package-name:
description: The name of the package being tested
required: true
type: string
working-directory:
description: The working directory relative to the repo root
required: true
type: string
jobs:
test-dart-vm:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
# Allows other matrix items to run if one fails
fail-fast: false
matrix:
sdk:
# Minimum supported Dart version
- "3.3.0"
- stable
- beta
# Skips 'beta' tests on PRs
exclude:
- sdk: ${{ (github.event_name == 'pull_request') && 'beta' || 'NONE' }}
steps:
- name: Cache Pub dependencies
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # 3.3.2
with:
path: |
~/.pub-cache/hosted
~/.pub-cache/git
key: os:ubuntu-latest;sdk:${{ matrix.sdk }};packages:${{ inputs.working-directory }}
restore-keys: |
os:ubuntu-latest;sdk:${{ matrix.sdk }};packages:${{ inputs.working-directory }}
os:ubuntu-latest;sdk:${{ matrix.sdk }}
os:ubuntu-latest
- name: Git Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # 3.6.0
- name: Git Submodules
run: git submodule update --init
# Some Dart packages require Flutter to be available, for example `amplify_core`
# requires it for its `doc` package. Running this before "Setup Dart" means that
# the `dart` executable in PATH will always be the one setup by "Setup Dart".
#
# TODO(dnys1): Create mapping of Flutter->Dart versions so we can just use Dart
# vended by Flutter.
- name: Setup Flutter
uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # 2.10.0
with:
cache: true
channel: stable
- name: Setup Dart
uses: dart-lang/setup-dart@e58aeb62aef51dcc4d0ba8eada7c08092aad5314 # main
with:
sdk: ${{ matrix.sdk }}
- name: Dart Version
run: dart --version
- name: Setup aft
shell: bash # Run in bash regardless of platform
run: dart pub global activate -spath packages/aft
- name: Bootstrap
id: bootstrap
timeout-minutes: 20
run: aft bootstrap --fail-fast --include=${{ inputs.package-name }} --verbose
- name: Check Formatting
if: "always() && steps.bootstrap.conclusion == 'success' && matrix.sdk == 'stable'"
run: dart format --set-exit-if-changed .
working-directory: ${{ inputs.working-directory }}
- name: Check for Tests
id: testCheck
if: "always() && steps.bootstrap.conclusion == 'success'"
shell: bash # Run in bash regardless of platform
working-directory: ${{ inputs.working-directory }}
run: |
if [ -d test ]; then
echo "hasTests=true" >> $GITHUB_OUTPUT
else
echo "hasTests=false" >> $GITHUB_OUTPUT
fi
- name: Setup Package
if: "always() && steps.bootstrap.conclusion == 'success'"
shell: bash # Run in bash regardless of platform
working-directory: ${{ inputs.working-directory }}
run: |
if [ -e tool/setup.sh ]; then
./tool/setup.sh
fi
- name: Analyze
if: "always() && steps.bootstrap.conclusion == 'success'"
run: dart analyze --fatal-infos --fatal-warnings .
working-directory: ${{ inputs.working-directory }}
- name: Run Tests (stable)
if: "always() && steps.bootstrap.conclusion == 'success' && steps.testCheck.outputs.hasTests == 'true' && matrix.sdk == 'stable'"
run: dart test
working-directory: ${{ inputs.working-directory }}
# Non-stable test runs do not need to verify `build` tags since the generated code in the repo is updated using `build_runner` on `stable`.
- name: Run Tests (non-stable)
if: "always() && steps.bootstrap.conclusion == 'success' && steps.testCheck.outputs.hasTests == 'true' && matrix.sdk != 'stable'"
run: dart test --exclude-tags=build
working-directory: ${{ inputs.working-directory }}
- name: Log success/failure
if: always()
uses: ./.github/composite_actions/log_cw_metric_wrapper
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
job-status: ${{ job.status }}
github-token: ${{ secrets.GITHUB_TOKEN }}
test-type: unit
working-directory: ${{ inputs.working-directory }}
framework: dart
flutter-dart-channel: ${{ matrix.sdk }}
dart-compiler: vm