Skip to content

Commit e4b8416

Browse files
authored
feat: github workflow to run all tests (#1)
Runs on N, N-1, and main Runs on pull request and push to main.
1 parent cb7a046 commit e4b8416

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/dart_latest.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright 2026 The Flutter Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
# Workflow to run all packages against a matrix of Dart versions.
6+
#
7+
# To run locally:
8+
# gh act pull_request
9+
name: Multi-Version Dart Test
10+
11+
on:
12+
push:
13+
branches: [ main ]
14+
pull_request:
15+
branches: [ main ]
16+
17+
jobs:
18+
test:
19+
name: Dart ${{ matrix.dart-sdk }}
20+
21+
# This creates a separate job for every version in the list
22+
strategy:
23+
matrix:
24+
dart-sdk: [ 3.10.7, 3.11.5, main ]
25+
fail-fast: false # Continues other versions even if one fails
26+
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Dart (${{ matrix.dart-sdk }})
34+
uses: dart-lang/setup-dart@v1
35+
with:
36+
sdk: ${{ matrix.dart-sdk }}
37+
38+
# NOTE: This will be replaced with a call to the packages repo tools once they are published.
39+
- name: Run tests in all subfolders
40+
run: |
41+
# Find all directories containing a pubspec.yaml
42+
find . -name "pubspec.yaml" -not -path "*/.*/*" | while read -r pubspec_path; do
43+
dir=$(dirname "$pubspec_path")
44+
45+
# Start a github workflow group.
46+
echo "::group::[${{ matrix.dart-sdk }}] Testing in $dir"
47+
48+
# Using a subshell ( ... ) to avoid needing to 'cd -'
49+
(
50+
cd "$dir"
51+
dart pub get
52+
dart test
53+
) || exit 1
54+
55+
echo "::endgroup::"
56+
done

0 commit comments

Comments
 (0)