Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
3235dad
try some caching
CoderDake Nov 4, 2022
0ef328c
use it betweenzies
CoderDake Nov 4, 2022
5484e73
try clone first
CoderDake Nov 4, 2022
4d630f1
this might just do it
CoderDake Nov 4, 2022
4d33872
:facepalm:
CoderDake Nov 5, 2022
31659d9
all
CoderDake Nov 5, 2022
752825b
invalidate the cache
CoderDake Nov 5, 2022
4124ebf
cache all steps
CoderDake Nov 7, 2022
112d5f2
trigger another build
Nov 7, 2022
9a1cbe7
fix comments
CoderDake Nov 7, 2022
c7ae1f3
Update tool/bots.sh
CoderDake Nov 7, 2022
6de6d9d
start work on prep
CoderDake Nov 9, 2022
e2936c1
set GH token
CoderDake Nov 9, 2022
81ae60b
proper checkout and cache(hopefully)
CoderDake Nov 9, 2022
87e6e09
indent
CoderDake Nov 9, 2022
0f30669
oops another indent
CoderDake Nov 9, 2022
8aebdd2
improve env
CoderDake Nov 9, 2022
1ee1112
cd into fsd
CoderDake Nov 9, 2022
41edafd
get rid of surrounding quotes
CoderDake Nov 9, 2022
cc99cf3
latest flutter candy
CoderDake Nov 9, 2022
301b744
noid
CoderDake Nov 9, 2022
fe7ceae
debug outies
CoderDake Nov 9, 2022
7271759
pass the ghtoken
CoderDake Nov 9, 2022
b3265fe
gotta love tyepos
CoderDake Nov 9, 2022
a8f8ad3
try export instead?
CoderDake Nov 9, 2022
1bfc868
help debugging
CoderDake Nov 10, 2022
e5f094c
feeling a bit embarassed at how rusty i am with sed
CoderDake Nov 10, 2022
a00a54f
setup flutter-sdk outside bots.sh
CoderDake Nov 10, 2022
e491260
!
CoderDake Nov 10, 2022
5b9b641
take a peek at that path
CoderDake Nov 10, 2022
548e2d1
lllll
CoderDake Nov 10, 2022
7df252f
ls no ll
CoderDake Nov 10, 2022
6f95bff
almost there
CoderDake Nov 10, 2022
f07039e
try clone first?
CoderDake Nov 10, 2022
876274a
uncomment
CoderDake Nov 10, 2022
3de9921
Merge remote-tracking branch 'upstream/master' into flutter-cache
CoderDake Nov 10, 2022
e9fdc69
recomment
CoderDake Nov 10, 2022
05173c4
clean up and sha work
CoderDake Nov 10, 2022
abc2464
remove old cache
CoderDake Nov 10, 2022
d07d774
much better
CoderDake Nov 10, 2022
50156f1
use remote to get branch sha
CoderDake Nov 10, 2022
d208228
origin instead of upstream
CoderDake Nov 10, 2022
30bf0a0
see if flutter doctor can be cached
CoderDake Nov 10, 2022
0154a1c
small cleanup
CoderDake Nov 10, 2022
2bf2abb
try matrix runs on
CoderDake Nov 10, 2022
6e3daa9
better prep naming
CoderDake Nov 10, 2022
b065ad7
more caching. here we go
CoderDake Nov 10, 2022
ec426c0
try diagnostic logging
CoderDake Nov 10, 2022
8206223
another bit of cleanup
CoderDake Nov 10, 2022
f3cfa16
quick try for shard
CoderDake Nov 10, 2022
00dfe2d
Revert "quick try for shard"
CoderDake Nov 10, 2022
c025d46
test commit
CoderDake Nov 10, 2022
44fe623
Revert "test commit"
CoderDake Nov 10, 2022
63bbcf3
remove extras
CoderDake Nov 10, 2022
787daa3
new world latest flut can
CoderDake Nov 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 76 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,85 @@ on:
permissions: read-all

env:
AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
flutter-prep:
name: ${{ matrix.os }} Flutter Prep
outputs:
latest_flutter_candidate: ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: git clone devtools
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Get Latest Flutter Candidate
id: flutter-candidate
run: |
LATEST_FLUTTER_CANDIDATE=$(./tool/latest_flutter_candidate.sh)
echo "FLUTTER_CANDIDATE=$LATEST_FLUTTER_CANDIDATE" >> $GITHUB_OUTPUT

- name: Load Cached Flutter SDK
id: cache-flutter
uses: actions/cache@v3
with:
path: |
./flutter-sdk
key: flutter-sdk-${{ runner.os }}-${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }}

- if: ${{ steps.cache-flutter.outputs.cache-hit != 'true' }}
name: Clone Flutter SDK if none cached
run: |
git clone https://github.com/flutter/flutter.git ./flutter-sdk
cd flutter-sdk
git checkout $LATEST_FLUTTER_CANDIDATE
env:
LATEST_FLUTTER_CANDIDATE: ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }} being used a few times, are we duplicating this, or in other words can it be put in a local var?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately I don't think there is a way to make this less verbose.


- name: Assert that the Latest Flutter Candidate is checked out
run: |
cd flutter-sdk
HEAD_SHA=$(git rev-parse HEAD)
LATEST_FLUTTER_CANDIDATE_SHA=$(git rev-parse "origin/$LATEST_FLUTTER_CANDIDATE")
if [ "$HEAD_SHA" != "$LATEST_FLUTTER_CANDIDATE_SHA" ]; then
echo "::error ,title=Error checking out Latest Flutter Candidate::{expected HEAD to be at $LATEST_FLUTTER_CANDIDATE_SHA but got $HEAD_SHA}"
exit 1
fi
env:
LATEST_FLUTTER_CANDIDATE: ${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }}

- name: Setup Flutter SDK
run: |
./flutter-sdk/bin/flutter config --no-analytics
./flutter-sdk/bin/flutter doctor
./flutter-sdk/bin/cache/dart-sdk/bin/dart --disable-analytics

main:
name: main
needs: flutter-prep
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: git clone
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Load Cached Flutter SDK
uses: actions/cache@v3
with:
path: |
./flutter-sdk
key: flutter-sdk-${{ runner.os }}-${{ needs.flutter-prep.outputs.latest_flutter_candidate }}

- name: tool/bots.sh
env:
BOT: main
run: ./tool/bots.sh

test:
name: ${{ matrix.bot }}
needs: flutter-prep
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -44,14 +105,20 @@ jobs:
steps:
- name: git clone
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Load Cached Flutter SDK
uses: actions/cache@v3
with:
path: |
./flutter-sdk
key: flutter-sdk-${{ runner.os }}-${{ needs.flutter-prep.outputs.latest_flutter_candidate }}
- name: tool/bots.sh
env:
BOT: ${{ matrix.bot }}
PLATFORM: vm
run: ./tool/bots.sh

macos-test:
needs: flutter-prep
name: macos ${{ matrix.bot }}
runs-on: macos-latest
strategy:
Expand All @@ -62,7 +129,12 @@ jobs:
steps:
- name: git clone
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Load Cached Flutter SDK
uses: actions/cache@v3
with:
path: |
./flutter-sdk
key: flutter-sdk-${{ runner.os }}-${{ needs.flutter-prep.outputs.latest_flutter_candidate }}
- name: tool/bots.sh
env:
BOT: ${{ matrix.bot }}
Expand Down
16 changes: 5 additions & 11 deletions tool/bots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ function flutter {
fi
}

# Get Flutter.
echo "Cloning the Flutter master branch"
git clone https://github.com/flutter/flutter.git ./flutter-sdk
# Make sure Flutter sdk has been provided
if [ ! -d "./flutter-sdk" ]; then
echo "Expected ./flutter-sdk to exist"
exit 1;
fi

# Look in the dart bin dir first, then the flutter one, then the one for the
# devtools repo. We don't use the dart script from flutter/bin as that script
Expand All @@ -39,14 +41,6 @@ export PATH=`pwd`/flutter-sdk/bin/cache/dart-sdk/bin:`pwd`/flutter-sdk/bin:`pwd`
# Look up the latest flutter candidate (this is the latest flutter version in g3)
# TODO(https://github.com/flutter/devtools/issues/4591): re-write this script as a
# shell script so we won't have to incurr the cost of building flutter tool twice.
echo "Looking up the latest Flutter candidate branch"
pushd packages/devtools_app
LATEST_FLUTTER_CANDIDATE=`repo_tool latest-flutter-candidate --githubToken=$AUTH_TOKEN | tail -n 1`
popd

pushd flutter-sdk
git checkout $LATEST_FLUTTER_CANDIDATE
popd

flutter config --no-analytics
flutter doctor
Expand Down
22 changes: 22 additions & 0 deletions tool/latest_flutter_candidate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Copyright 2022 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

RESPONSE=$(gh api --paginate /repos/flutter/flutter/branches)
Comment thread
CoderDake marked this conversation as resolved.

CANDIDATES=$(echo "$RESPONSE" | jq '.[].name' | grep candidate)

VERSIONS=$(echo "$CANDIDATES" | sed -E 's/.*([0-9]+\.[0-9]+-candidate\.[0-9]+).*/\1/' )

LATEST_VERSION=$(echo "$VERSIONS" | sort --version-sort | tail -n 1 )

if [ -z ${LATEST_VERSION+x} ]; then
echo "Unable to get Latest flutter candidate version"
exit 1
fi

LATEST_FLUTTER_CANDIDATE="flutter-$LATEST_VERSION"

echo $LATEST_FLUTTER_CANDIDATE
121 changes: 0 additions & 121 deletions tool/lib/commands/latest_flutter_candidate.dart

This file was deleted.

2 changes: 0 additions & 2 deletions tool/lib/repo_tool.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

import 'package:args/command_runner.dart';
import 'package:devtools_repo/commands/latest_flutter_candidate.dart';

import 'commands/analyze.dart';
import 'commands/generate_changelog.dart';
Expand All @@ -21,6 +20,5 @@ class DevToolsCommandRunner extends CommandRunner {
addCommand(PackagesGetCommand());
addCommand(GenerateChangelogCommand());
addCommand(RollbackCommand());
addCommand(LatestFlutterCandidateCommand());
}
}
2 changes: 1 addition & 1 deletion tool/update_flutter_sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TOOL_DIR=`dirname "${RELATIVE_PATH_TO_SCRIPT}"`

pushd "$TOOL_DIR"
dart pub get
REQUIRED_FLUTTER_BRANCH=`dart bin/repo_tool.dart latest-flutter-candidate | tail -n 1`
REQUIRED_FLUTTER_BRANCH=`./latest_flutter_candidate.sh`

echo "REQUIRED_FLUTTER_BRANCH: $REQUIRED_FLUTTER_BRANCH"

Expand Down