mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
1. modifies the script slightly to allow passing in multiple versions for a given element 2. updates to build tools 36.1.0, and adds 35.0.0 and 34.0.0 3. also adds cmake to the list, version 3.22.1, as that downloaded in our ci currently 4. changes ci yaml and deps file accordingly ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: Gray Mackall <mackall@google.com>
144 lines
5.4 KiB
YAML
144 lines
5.4 KiB
YAML
name: Composite Flutter Setup
|
|
description: checkouts the tree, setups the environment
|
|
inputs:
|
|
ANDROID_TOOLS_VERSION:
|
|
description: 'android tools version'
|
|
default: '13114758'
|
|
ANDROID_PLATFORM:
|
|
description: 'android platform version'
|
|
default: 'android-36'
|
|
ANDROID_BUILDTOOLS:
|
|
description: 'android buildtools version'
|
|
default: '36.1.0'
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
# Real checkout on github actions for pull requests
|
|
- name: Checkout code (non-act pull_request)
|
|
uses: actions/checkout@v4
|
|
if: github.event_name == 'pull_request' && !env.ACT
|
|
with:
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
# Checkout the PR; not the merge commit - we need to describe tags
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
# Real checkout on github actions for post submit
|
|
- name: Checkout code (non-act push)
|
|
uses: actions/checkout@v4
|
|
if: github.event_name == 'push' && !env.ACT
|
|
with:
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
# Checkout the PR; not the merge commit - we need to describe tags
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
# Fake checkout if running locally
|
|
- name: Checkout code (act local)
|
|
uses: actions/checkout@v4
|
|
if: env.ACT
|
|
|
|
# If this is a branch / pr NOT on fluter/flutter, set the remote upstream
|
|
# so the flutter tool can figure out the version
|
|
- name: Set upstream (if not flutter/flutter)
|
|
shell: bash
|
|
if: github.repository != 'flutter/flutter' && !env.ACT
|
|
run: |
|
|
git remote add upstream https://github.com/flutter/flutter.git
|
|
git fetch --all --tags
|
|
|
|
# If running locally; install the JDK - Github runners have everything on them
|
|
- name: Set up our JDK environment
|
|
if: env.ACT
|
|
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00
|
|
with:
|
|
java-version: '21'
|
|
distribution: 'temurin'
|
|
|
|
# If running locally; install Android SDK tools - Github runners have everything on them
|
|
- name: Set Android SDK environment variable
|
|
shell: bash
|
|
if: env.ACT
|
|
run: |
|
|
echo "ANDROID_SDK_ROOT=/opt/android/sdk" >> $GITHUB_ENV
|
|
echo "ANDROID_HOME=/opt/android/sdk" >> $GITHUB_ENV
|
|
- name: Get Android SDK version
|
|
shell: bash
|
|
id: android-sdk-version
|
|
if: env.ACT
|
|
run: |
|
|
echo "revision=${{inputs.ANDROID_TOOLS_VERSION}};${{inputs.ANDROID_PLATFORM}};build-tools;${{inputs.ANDROID_BUILDTOOLS}}" >> "$GITHUB_OUTPUT"
|
|
- name: Android SDK Cache
|
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
|
|
id: android-sdk-setup
|
|
if: env.ACT
|
|
with:
|
|
path: /opt/android/sdk
|
|
key: ${{ runner.os }}-${{ steps.android-sdk-version.outputs.revision }}
|
|
- name: Setup Android SDK (cold cache)
|
|
if: env.ACT && steps.android-sdk-setup.outputs.cache-hit != 'true'
|
|
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407
|
|
with:
|
|
packages: 'tools platform-tools platforms;${{inputs.ANDROID_PLATFORM}} build-tools;${{inputs.ANDROID_BUILDTOOLS}}'
|
|
log-accepted-android-sdk-licenses: false
|
|
cmdline-tools-version: ${{ inputs.ANDROID_TOOLS_VERSION }}
|
|
- name: Setup Android SDK (warm cache)
|
|
shell: bash
|
|
if: env.ACT && steps.android-sdk-setup.outputs.cache-hit == 'true'
|
|
run: |
|
|
echo "/opt/android/sdk/cmdline-tools/${{ inputs.ANDROID_TOOLS_VERSION }}/bin" >> "$GITHUB_PATH"
|
|
echo "/opt/android/sdk/platform-tools" >> "$GITHUB_PATH"
|
|
|
|
- name: Add `flutter` to the PATH
|
|
shell: bash
|
|
run: |
|
|
echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Setup PUB_CACHE environment variable
|
|
shell: bash
|
|
run: |
|
|
echo "PUB_CACHE=/opt/pub-cache" >> $GITHUB_ENV
|
|
|
|
# Get the Flutter revision. This is the key for the cache for artifacts
|
|
# under bin/cache
|
|
- name: Get Flutter version
|
|
shell: bash
|
|
id: flutter-revision
|
|
run: |
|
|
echo "revision=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
|
|
- name: Flutter artifacts cache
|
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
|
|
id: flutter-artifacts
|
|
with:
|
|
path: ${{ github.workspace }}/bin/cache
|
|
key: ${{ runner.os }}-flutter-${{ steps.flutter-revision.outputs.revision }}
|
|
|
|
- name: pub deps hash
|
|
shell: bash
|
|
id: pub-deps-hash
|
|
run: |
|
|
# Generate stable hash of pubspec.yaml files
|
|
find dev examples packages -name "pubspec.yaml" -print0 | sort -z | xargs -0 cat | sha256sum >> "$RUNNER_TEMP/pub_deps_sha"
|
|
echo "revision=$(cat "$RUNNER_TEMP/pub_deps_sha")" >> "$GITHUB_OUTPUT"
|
|
- name: pub package cache
|
|
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
|
|
id: pub-cache
|
|
with:
|
|
path: |
|
|
/opt/pub-cache
|
|
${{ github.workspace }}/**/.dart_tool
|
|
${{ github.workspace }}/**/pubspec.lock
|
|
key: ${{ runner.os }}-pub-${{ steps.pub-deps-hash.outputs.revision }}
|
|
|
|
- name: Flutter Doctor
|
|
shell: bash
|
|
run: |
|
|
flutter doctor
|
|
|
|
- name: flutter pub get (online)
|
|
shell: bash
|
|
if: steps.pub-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
flutter pub get
|