Skip to content

Commit

Permalink
Enable Windows bots
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTup committed Feb 7, 2025
1 parent 451d918 commit a4604fa
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 28 deletions.
39 changes: 27 additions & 12 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,27 @@ on:
# Declare default permissions as read only.
permissions: read-all

defaults:
run:
# Use Bash on all platforms including Windows to avoid
# two copies of bot scripts.
shell: bash

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
flutter-prep:
uses: ./.github/workflows/flutter-prep.yaml

main:
name: main
name: ${{ matrix.os }} main
needs: flutter-prep
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: git clone
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
Expand Down Expand Up @@ -75,16 +84,17 @@ jobs:
dcm analyze packages/devtools_app packages/devtools_app_shared packages/devtools_extensions packages/devtools_shared packages/devtools_test
test-packages:
name: ${{ matrix.package }} test
name: ${{ matrix.os }} ${{ matrix.package }} test
needs: flutter-prep
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
package:
- devtools_app_shared
- devtools_extensions
- devtools_shared
os: [ubuntu-latest, windows-latest]
steps:
- name: git clone
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
Expand All @@ -100,11 +110,13 @@ jobs:
run: ./tool/ci/package_tests.sh

test-tool:
name: Tool test
name: ${{ matrix.os }} Tool test
needs: flutter-prep
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: git clone
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
Expand All @@ -118,9 +130,9 @@ jobs:
run: ./tool/ci/tool_tests.sh

test:
name: ${{ matrix.bot }}
name: ${{ matrix.os }} ${{ matrix.bot }}
needs: flutter-prep
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
Expand All @@ -129,6 +141,7 @@ jobs:
- build_dart2js
- test_ddc
- test_dart2js
os: [ubuntu-latest, windows-latest]
steps:
- name: git clone
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
Expand Down Expand Up @@ -186,12 +199,13 @@ jobs:
echo "::notice title=To Quickly Fix Goldens:: Run \`dt fix-goldens --run-id=$WORKFLOW_ID\` on your local branch."
devtools-app-integration-test:
name: devtools_app integration-test ${{ matrix.bot }} - ${{ matrix.device }} - shard ${{ matrix.shard }}
name: ${{ matrix.os }} devtools_app integration-test ${{ matrix.bot }} - ${{ matrix.device }} - shard ${{ matrix.shard }}
needs: flutter-prep
runs-on: macos-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
# Consider running integration tests in ddc mode, too.
bot: [integration_dart2js]
device: [flutter, flutter-web, dart-cli]
Expand Down Expand Up @@ -251,14 +265,15 @@ jobs:
path: packages/devtools_app/integration_test/**/failures/*.png

devtools-extensions-integration-test:
name: devtools_extensions integration-test ${{ matrix.bot }}
name: ${{ matrix.os }} devtools_extensions integration-test ${{ matrix.bot }}
needs: flutter-prep
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Consider running integration tests in ddc mode, too.
bot: [integration_dart2js]
os: [ubuntu-latest, windows-latest]
steps:
- name: git clone
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/flutter-prep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@

name: Flutter SDK prep

defaults:
run:
# Use Bash on all platforms including Windows to avoid
# two copies of bot scripts.
shell: bash

on:
workflow_call:
inputs:
os-name:
description: 'The OS to run against, either "macos" or "ubuntu". If neither is provided, will run against both.'
description: 'The OS to run against, either "macos", "ubuntu" or "windows". If none is provided, will run against all.'
type: string

outputs:
Expand All @@ -23,7 +29,7 @@ jobs:
latest_flutter_candidate: ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }}
strategy:
matrix:
os: ${{ (inputs.os-name == 'macos' && fromJSON('[ "macos-latest"]')) || (inputs.os-name == 'ubuntu' && fromJSON('[ "ubuntu-latest"]')) || fromJSON('["ubuntu-latest", "macos-latest"]') }}
os: ${{ (inputs.os-name == 'macos' && fromJSON('[ "macos-latest"]')) || (inputs.os-name == 'ubuntu' && fromJSON('[ "ubuntu-latest"]')) || (inputs.os-name == 'windows' && fromJSON('[ "windows-latest"]')) || fromJSON('["ubuntu-latest", "macos-latest", "windows-latest"]') }}
runs-on: ${{ matrix.os }}
steps:
# TODO(https://github.com/flutter/devtools/issues/5729) Consider caching DevTools so that we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ class TestFlutterApp extends IntegrationTestApp {

@override
Future<void> startProcess() async {
runProcess = await Process.start('flutter', [
'run',
'--machine',
'-d',
testAppDevice.argName,
// Do not serve DevTools from Flutter Tools.
'--no-devtools',
], workingDirectory: testAppPath);
runProcess = await Process.start(
Platform.isWindows ? 'flutter.bat' : 'flutter',
[
'run',
'--machine',
'-d',
testAppDevice.argName,
// Do not serve DevTools from Flutter Tools.
'--no-devtools',
],
workingDirectory: testAppPath,
);
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,12 @@ void main() {
expect(delta, greaterThan(lowerThreshold));
expect(delta, lessThan(upperThreshold));
},
// TODO(dantup): Understand why this fails on Windows. The delta is smaller
// than expected.
//
// Expected: a value greater than <322122547.2>
// Actual: <320659456>
// Which: is not a value greater than <322122547.2>
skip: Platform.isWindows,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class IntegrationTestRunner with IOMixin {
];

debugLog('> flutter ${flutterDriveArgs.join(' ')}');
final process = await Process.start('flutter', flutterDriveArgs);
final process = await Process.start(
Platform.isWindows ? 'flutter.bat' : 'flutter', flutterDriveArgs);

bool stdOutWriteInProgress = false;
bool stdErrWriteInProgress = false;
Expand Down
11 changes: 8 additions & 3 deletions tool/ci/package_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ if [ "$PACKAGE" = "devtools_app_shared" ]; then
flutter test test/
popd

elif [ "$PACKAGE" = "devtools_extensions" ]; then
elif [ "$PACKAGE" = "devtools_extensions" ]; then

pushd $DEVTOOLS_DIR/packages/devtools_extensions
echo `pwd`
flutter test test/*_test.dart
flutter test test/web --platform chrome
# Skip this on Windows because `flutter test --platform chrome`
# appears to hand there.
# https://github.com/flutter/flutter/issues/162798
if [[ $RUNNER_OS != "Windows" ]]; then
flutter test test/web --platform chrome
fi
popd

elif [ "$PACKAGE" = "devtools_shared" ]; then
elif [ "$PACKAGE" = "devtools_shared" ]; then

pushd $DEVTOOLS_DIR/packages/devtools_shared
echo `pwd`
Expand Down
2 changes: 0 additions & 2 deletions tool/ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export DEVTOOLS_DIR=$SCRIPT_DIR/../..
# In GitBash on Windows, we have to call flutter.bat so we alias them in this
# script to call the correct one based on the OS.
function flutter {
# TODO: Also support windows on github actions.
if [[ $RUNNER_OS == "Windows" ]]; then
command flutter.bat "$@"
else
Expand All @@ -22,7 +21,6 @@ function flutter {
}
export -f flutter

# TODO: Also support windows on github actions.
if [[ $RUNNER_OS == "Windows" ]]; then
echo Installing Google Chrome Stable...
# Install Chrome via Chocolatey while `addons: chrome` doesn't seem to work on Windows yet
Expand Down

0 comments on commit a4604fa

Please sign in to comment.