Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add local Flutter setup action

Manav Rathib9f21c47e06d
diff --git a/.github/actions/setup-flutter/action.yml b/.github/actions/setup-flutter/action.yml
new file mode 100644
index 0000000000..e1811b0f2a
--- /dev/null
+++ b/.github/actions/setup-flutter/action.yml
@@ -0,0 +1,48 @@
+name: "Setup Flutter"
+description: "Install the Flutter SDK version used by Ente CI"
+
+runs:
+ using: "composite"
+ steps:
+ - shell: bash
+ env:
+ FLUTTER_VERSION: "3.38.10"
+ run: |
+ set -euo pipefail
+
+ base_url="https://storage.googleapis.com/flutter_infra_release/releases"
+ case "$RUNNER_OS-$RUNNER_ARCH" in
+ Linux-X64) archive="stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz" ;;
+ macOS-X64) archive="stable/macos/flutter_macos_${FLUTTER_VERSION}-stable.zip" ;;
+ macOS-ARM64) archive="stable/macos/flutter_macos_arm64_${FLUTTER_VERSION}-stable.zip" ;;
+ Windows-X64) archive="stable/windows/flutter_windows_${FLUTTER_VERSION}-stable.zip" ;;
+ esac
+
+ temp_dir="$RUNNER_TEMP"
+ if [ "$RUNNER_OS" = Windows ]; then
+ temp_dir="$(cygpath -u "$temp_dir")"
+ fi
+
+ install_root="$temp_dir/flutter-sdk"
+ flutter_root="$install_root/flutter"
+
+ github_path() {
+ if [ "$RUNNER_OS" = Windows ]; then
+ cygpath -w "$1"
+ else
+ printf '%s\n' "$1"
+ fi
+ }
+
+ archive_name="${archive##*/}"
+ archive_path="$temp_dir/$archive_name"
+
+ curl -fsSL "$base_url/$archive" -o "$archive_path"
+ mkdir -p "$install_root"
+ case "$archive_name" in
+ *.zip) unzip -q -o "$archive_path" -d "$install_root" ;;
+ *) tar xf "$archive_path" -C "$install_root" ;;
+ esac
+ rm -f "$archive_path"
+
+ github_path "$flutter_root/bin" >>"$GITHUB_PATH"
diff --git a/.github/workflows/auth-build.yml b/.github/workflows/auth-build.yml
index 650b2b2219..0555ada089 100644
--- a/.github/workflows/auth-build.yml
+++ b/.github/workflows/auth-build.yml
@@ -11,9 +11,6 @@ on:
# Run every weekday at ~3:45 AM IST
- cron: "15 22 * * 0-4"
-env:
- FLUTTER_VERSION: "3.38.10"
-
permissions:
contents: write
@@ -116,11 +113,8 @@ jobs:
distribution: "temurin"
java-version: "17"
- - name: Install Flutter ${{ env.FLUTTER_VERSION }}
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
- with:
- channel: "stable"
- flutter-version: ${{ env.FLUTTER_VERSION }}
+ - name: Install Flutter
+ uses: ./.github/actions/setup-flutter
- name: Generate strings localizations
run: flutter gen-l10n
@@ -244,11 +238,8 @@ jobs:
ref: ${{ needs.build-metadata.outputs.commit_sha }}
submodules: recursive
- - name: Install Flutter ${{ env.FLUTTER_VERSION }}
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
- with:
- channel: "stable"
- flutter-version: ${{ env.FLUTTER_VERSION }}
+ - name: Install Flutter
+ uses: ./.github/actions/setup-flutter
- name: Generate strings localizations
run: flutter gen-l10n
@@ -285,11 +276,11 @@ jobs:
./linux/packaging/build_rpm.sh
mv dist/*/*.rpm "artifacts/${ARTIFACT_STEM}-x86_64.rpm"
dart pub global activate --source git https://github.com/ente-io/fastforgefork --git-ref develop --git-path packages/fastforge
- fastforge package --platform=linux --targets=appimage --skip-clean
+ dart pub global run fastforge package --platform=linux --targets=appimage --skip-clean
appimage_path="$(find dist -name '*-*-linux.AppImage' -print -quit)"
./linux/packaging/post_process_appimage.sh "$appimage_path"
mv "$appimage_path" "artifacts/${ARTIFACT_STEM}-x86_64.AppImage"
- fastforge package --platform=linux --targets=deb --skip-clean
+ dart pub global run fastforge package --platform=linux --targets=deb --skip-clean
mv dist/**/*-*-linux.deb "artifacts/${ARTIFACT_STEM}-x86_64.deb"
- name: Generate checksums
@@ -362,11 +353,8 @@ jobs:
ref: ${{ needs.build-metadata.outputs.commit_sha }}
submodules: recursive
- - name: Install Flutter ${{ env.FLUTTER_VERSION }}
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
- with:
- channel: "stable"
- flutter-version: ${{ env.FLUTTER_VERSION }}
+ - name: Install Flutter
+ uses: ./.github/actions/setup-flutter
- name: Generate strings localizations
run: flutter gen-l10n
@@ -514,12 +502,8 @@ jobs:
ref: ${{ needs.build-metadata.outputs.commit_sha }}
submodules: recursive
- - name: Install Flutter ${{ env.FLUTTER_VERSION }}
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
- with:
- channel: "stable"
- flutter-version: ${{ env.FLUTTER_VERSION }}
- cache: true
+ - name: Install Flutter
+ uses: ./.github/actions/setup-flutter
- name: Generate strings localizations
run: flutter gen-l10n
@@ -654,12 +638,8 @@ jobs:
ref: ${{ needs.build-metadata.outputs.commit_sha }}
submodules: recursive
- - name: Install Flutter ${{ env.FLUTTER_VERSION }}
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
- with:
- channel: "stable"
- flutter-version: ${{ env.FLUTTER_VERSION }}
- cache: true
+ - name: Install Flutter
+ uses: ./.github/actions/setup-flutter
- name: Generate strings localizations
run: flutter gen-l10n
diff --git a/.github/workflows/locker-build.yml b/.github/workflows/locker-build.yml
index 52e30d1c99..70a52e4f37 100644
--- a/.github/workflows/locker-build.yml
+++ b/.github/workflows/locker-build.yml
@@ -11,9 +11,6 @@ on:
# Run every weekday at ~4:45 AM IST
- cron: "15 23 * * 0-4"
-env:
- FLUTTER_VERSION: "3.38.10"
-
permissions:
contents: write
@@ -115,11 +112,8 @@ jobs:
distribution: "temurin"
java-version: "17"
- - name: Install Flutter ${{ env.FLUTTER_VERSION }}
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
- with:
- channel: "stable"
- flutter-version: ${{ env.FLUTTER_VERSION }}
+ - name: Install Flutter
+ uses: ./.github/actions/setup-flutter
- name: Generate strings localizations
run: flutter gen-l10n
@@ -240,12 +234,8 @@ jobs:
with:
ref: ${{ needs.build-metadata.outputs.commit_sha }}
- - name: Install Flutter ${{ env.FLUTTER_VERSION }}
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
- with:
- channel: "stable"
- flutter-version: ${{ env.FLUTTER_VERSION }}
- cache: true
+ - name: Install Flutter
+ uses: ./.github/actions/setup-flutter
- name: Generate strings localizations
run: flutter gen-l10n
diff --git a/.github/workflows/mobile-lint.yml b/.github/workflows/mobile-lint.yml
index 6db74a8105..7006dce8fb 100644
--- a/.github/workflows/mobile-lint.yml
+++ b/.github/workflows/mobile-lint.yml
@@ -15,9 +15,6 @@ on:
- "rust/crates/photos/**"
workflow_dispatch:
-env:
- FLUTTER_VERSION: "3.38.10"
-
permissions:
contents: read
@@ -65,12 +62,8 @@ jobs:
done
working-directory: mobile/apps/auth
- - name: Install Flutter ${{ env.FLUTTER_VERSION }}
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
- with:
- channel: "stable"
- flutter-version: ${{ env.FLUTTER_VERSION }}
- cache: true
+ - name: Install Flutter
+ uses: ./.github/actions/setup-flutter
# Restore-only; primed on main by warm-caches.yml.
- name: Restore Rust cache
diff --git a/.github/workflows/photos-build.yml b/.github/workflows/photos-build.yml
index 185521b721..76ee97b3c5 100644
--- a/.github/workflows/photos-build.yml
+++ b/.github/workflows/photos-build.yml
@@ -11,9 +11,6 @@ on:
# Run every weekday at ~2:35 AM IST
- cron: "5 21 * * 0-4"
-env:
- FLUTTER_VERSION: "3.38.10"
-
permissions:
contents: write
@@ -115,11 +112,8 @@ jobs:
distribution: "temurin"
java-version: "17"
- - name: Install Flutter ${{ env.FLUTTER_VERSION }}
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
- with:
- channel: "stable"
- flutter-version: ${{ env.FLUTTER_VERSION }}
+ - name: Install Flutter
+ uses: ./.github/actions/setup-flutter
- name: Set build version
run: node ../../../.github/scripts/flutter-version.mjs photos set-build "${RELEASE_VERSION}" "${BUILD_NUMBER}"
@@ -236,12 +230,8 @@ jobs:
with:
ref: ${{ needs.build-metadata.outputs.commit_sha }}
- - name: Install Flutter ${{ env.FLUTTER_VERSION }}
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
- with:
- channel: "stable"
- flutter-version: ${{ env.FLUTTER_VERSION }}
- cache: true
+ - name: Install Flutter
+ uses: ./.github/actions/setup-flutter
- name: Set build version
run: node ../../../.github/scripts/flutter-version.mjs photos set-build "${RELEASE_VERSION}" "${BUILD_NUMBER}"
diff --git a/.github/workflows/warm-caches.yml b/.github/workflows/warm-caches.yml
index c3320f3803..cca4215d56 100644
--- a/.github/workflows/warm-caches.yml
+++ b/.github/workflows/warm-caches.yml
@@ -62,11 +62,7 @@ jobs:
submodules: recursive
- name: Install Flutter
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
- with:
- channel: "stable"
- flutter-version: "3.38.10" # Keep in sync with mobile-lint.yml
- cache: true
+ uses: ./.github/actions/setup-flutter
- name: Setup Rust cache
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1