Skip to content

armgit / ente

Public Imported from GitHub
0

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

Optimize mobile packages linter with selective execution

Neeraj Gupta191e397c0202
diff --git a/.github/scripts/get-affected-packages.js b/.github/scripts/get-affected-packages.js
new file mode 100644
index 0000000000..99b62cd070
--- /dev/null
+++ b/.github/scripts/get-affected-packages.js
@@ -0,0 +1,238 @@
+#!/usr/bin/env node
+
+/**
+ * Dependency Parser for Mobile Packages
+ *
+ * Parses pubspec.yaml files to build a dependency graph and determines
+ * which packages/apps need to be linted based on what changed.
+ *
+ * Usage:
+ * node get-affected-packages.js <changed_files...>
+ *
+ * Output (JSON):
+ * {
+ * "packages": ["pkg1", "pkg2", ...],
+ * "lint_photos": "true/false",
+ * "lint_auth": "true/false",
+ * "lint_locker": "true/false",
+ * "lint_all": "true/false"
+ * }
+ */
+
+const fs = require('fs');
+const path = require('path');
+const yaml = require('yaml');
+
+const PACKAGES_DIR = path.join(__dirname, '../../mobile/packages');
+const APPS_DIR = path.join(__dirname, '../../mobile/apps');
+
+/**
+ * Parse a pubspec.yaml file and extract local package dependencies
+ */
+function parsePackageDependencies(pubspecPath) {
+ try {
+ const content = fs.readFileSync(pubspecPath, 'utf8');
+ const parsed = yaml.parse(content);
+ const deps = [];
+
+ // Check both dependencies and dev_dependencies
+ for (const depSection of ['dependencies', 'dev_dependencies']) {
+ if (parsed[depSection]) {
+ for (const [depName, depConfig] of Object.entries(parsed[depSection])) {
+ // Only include local path dependencies (not SDK or pub.dev packages)
+ if (depConfig && typeof depConfig === 'object' && depConfig.path) {
+ // Extract package name from path (e.g., "../ente_crypto_api" -> "ente_crypto_api")
+ const pkgName = depConfig.path.split('/').pop();
+ deps.push(pkgName);
+ }
+ }
+ }
+ }
+
+ return deps;
+ } catch (error) {
+ console.error(`Error parsing ${pubspecPath}:`, error.message);
+ return [];
+ }
+}
+
+/**
+ * Build dependency graph for all packages
+ * Returns: { packageName: [dependencies] }
+ */
+function buildDependencyGraph() {
+ const graph = {};
+
+ // Get all package directories
+ const packages = fs.readdirSync(PACKAGES_DIR, { withFileTypes: true })
+ .filter(dirent => dirent.isDirectory() && dirent.name !== 'rust')
+ .map(dirent => dirent.name);
+
+ // Parse dependencies for each package
+ for (const pkg of packages) {
+ const pubspecPath = path.join(PACKAGES_DIR, pkg, 'pubspec.yaml');
+ if (fs.existsSync(pubspecPath)) {
+ graph[pkg] = parsePackageDependencies(pubspecPath);
+ } else {
+ graph[pkg] = [];
+ }
+ }
+
+ return graph;
+}
+
+/**
+ * Reverse the dependency graph to get dependents
+ * Returns: { packageName: [packages that depend on it] }
+ */
+function buildDependentsGraph(depGraph) {
+ const dependents = {};
+
+ // Initialize
+ for (const pkg of Object.keys(depGraph)) {
+ dependents[pkg] = [];
+ }
+
+ // Build reverse mapping
+ for (const [pkg, deps] of Object.entries(depGraph)) {
+ for (const dep of deps) {
+ if (!dependents[dep]) {
+ dependents[dep] = [];
+ }
+ dependents[dep].push(pkg);
+ }
+ }
+
+ return dependents;
+}
+
+/**
+ * Get all affected packages (transitive dependents)
+ */
+function getAffectedPackages(changedPackages, dependentsGraph) {
+ const affected = new Set(changedPackages);
+ const queue = [...changedPackages];
+
+ while (queue.length > 0) {
+ const pkg = queue.shift();
+ const deps = dependentsGraph[pkg] || [];
+
+ for (const dep of deps) {
+ if (!affected.has(dep)) {
+ affected.add(dep);
+ queue.push(dep);
+ }
+ }
+ }
+
+ return Array.from(affected).sort();
+}
+
+/**
+ * Determine which apps need linting based on changed packages
+ */
+function getAffectedApps(affectedPackages) {
+ const apps = {
+ photos: false,
+ auth: false,
+ locker: false
+ };
+
+ // Parse each app's dependencies
+ for (const [appName, _] of Object.entries(apps)) {
+ const appPubspec = path.join(APPS_DIR, appName, 'pubspec.yaml');
+ if (fs.existsSync(appPubspec)) {
+ const appDeps = parsePackageDependencies(appPubspec);
+ // If any affected package is used by this app, lint it
+ apps[appName] = appDeps.some(dep => affectedPackages.includes(dep));
+ }
+ }
+
+ return apps;
+}
+
+/**
+ * Main function
+ */
+function main() {
+ const changedFiles = process.argv.slice(2);
+
+ // Safety check: if no files or workflow/analysis files changed, lint everything
+ const safetyFiles = [
+ '.github/workflows/mobile-packages-lint.yml',
+ 'mobile/analysis_options.yaml'
+ ];
+
+ const lintAll = changedFiles.length === 0 ||
+ changedFiles.some(f => safetyFiles.some(sf => f.includes(sf))) ||
+ changedFiles.some(f => f.includes('pubspec.yaml'));
+
+ if (lintAll) {
+ // Lint everything
+ const allPackages = fs.readdirSync(PACKAGES_DIR, { withFileTypes: true })
+ .filter(dirent => dirent.isDirectory() && dirent.name !== 'rust')
+ .map(dirent => dirent.name)
+ .sort();
+
+ const output = {
+ packages: allPackages,
+ lint_photos: 'true',
+ lint_auth: 'true',
+ lint_locker: 'true',
+ lint_all: 'true',
+ reason: 'Safety: workflow/analysis/pubspec changed or no files specified'
+ };
+
+ console.log(JSON.stringify(output, null, 2));
+ return;
+ }
+
+ // Extract changed package names from file paths
+ const changedPackages = new Set();
+ for (const file of changedFiles) {
+ const match = file.match(/mobile\/packages\/([^\/]+)\//);
+ if (match) {
+ changedPackages.add(match[1]);
+ }
+ }
+
+ // If no packages changed, nothing to lint
+ if (changedPackages.size === 0) {
+ const output = {
+ packages: [],
+ lint_photos: 'false',
+ lint_auth: 'false',
+ lint_locker: 'false',
+ lint_all: 'false',
+ reason: 'No package files changed'
+ };
+
+ console.log(JSON.stringify(output, null, 2));
+ return;
+ }
+
+ // Build dependency graphs
+ const depGraph = buildDependencyGraph();
+ const dependentsGraph = buildDependentsGraph(depGraph);
+
+ // Get all affected packages (changed + their dependents)
+ const affectedPackages = getAffectedPackages(Array.from(changedPackages), dependentsGraph);
+
+ // Determine which apps need linting
+ const affectedApps = getAffectedApps(affectedPackages);
+
+ // Output result
+ const output = {
+ packages: affectedPackages,
+ lint_photos: affectedApps.photos.toString(),
+ lint_auth: affectedApps.auth.toString(),
+ lint_locker: affectedApps.locker.toString(),
+ lint_all: 'false',
+ changed_packages: Array.from(changedPackages),
+ reason: `Selective lint: ${changedPackages.size} package(s) changed`
+ };
+
+ console.log(JSON.stringify(output, null, 2));
+}
+
+main();
diff --git a/.github/scripts/get-affected-packages.sh b/.github/scripts/get-affected-packages.sh
new file mode 100755
index 0000000000..269734aa77
--- /dev/null
+++ b/.github/scripts/get-affected-packages.sh
@@ -0,0 +1,226 @@
+#!/bin/bash
+
+# Dependency Parser for Mobile Packages
+#
+# Parses pubspec.yaml files to build a dependency graph and determines
+# which packages/apps need to be linted based on what changed.
+#
+# Usage:
+# ./get-affected-packages.sh <changed_file1> <changed_file2> ...
+#
+# Output (JSON to stdout):
+# {
+# "packages": "pkg1 pkg2 pkg3",
+# "lint_photos": "true/false",
+# "lint_auth": "true/false",
+# "lint_locker": "true/false",
+# "lint_all": "true/false"
+# }
+
+set -e
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+REPO_ROOT="$SCRIPT_DIR/../.."
+PACKAGES_DIR="$REPO_ROOT/mobile/packages"
+APPS_DIR="$REPO_ROOT/mobile/apps"
+
+# Parse local dependencies from a pubspec.yaml file
+# Returns space-separated list of package names
+parse_dependencies() {
+ local pubspec_file=$1
+
+ if [ ! -f "$pubspec_file" ]; then
+ echo ""
+ return
+ fi
+
+ # Extract dependencies with "path: ../" pattern
+ # Handle both "../packagename" and "../../packages/packagename"
+ grep "path:.*\.\./" "$pubspec_file" 2>/dev/null | \
+ sed 's/.*path: *//' | \
+ sed 's/[[:space:]]*$//' | \
+ sed 's/.*\///' | \
+ tr '\n' ' ' || echo ""
+}
+
+# Build dependency graph
+# Format: package_name:dep1,dep2,dep3
+build_dep_graph() {
+ local graph=""
+
+ for pkg_dir in "$PACKAGES_DIR"/*/ ; do
+ if [ ! -d "$pkg_dir" ]; then
+ continue
+ fi
+
+ pkg_name=$(basename "$pkg_dir")
+
+ # Skip rust package (handled separately)
+ if [ "$pkg_name" = "rust" ]; then
+ continue
+ fi
+
+ pubspec="$pkg_dir/pubspec.yaml"
+ deps=$(parse_dependencies "$pubspec")
+
+ # Convert space-separated to comma-separated
+ deps_csv=$(echo "$deps" | tr ' ' ',')
+ graph="$graph$pkg_name:$deps_csv"$'\n'
+ done
+
+ echo "$graph"
+}
+
+# Get packages that depend on a given package
+get_dependents() {
+ local target_pkg=$1
+ local dep_graph=$2
+ local dependents=""
+
+ while IFS=: read -r pkg deps; do
+ if [ -z "$pkg" ]; then
+ continue
+ fi
+
+ # Check if target_pkg is in deps
+ if echo ",$deps," | grep -q ",$target_pkg,"; then
+ dependents="$dependents $pkg"
+ fi
+ done <<< "$dep_graph"
+
+ echo "$dependents"
+}
+
+# Get all affected packages (transitive)
+get_affected_packages() {
+ local changed_pkgs=$1
+ local dep_graph=$2
+
+ local affected="$changed_pkgs"
+ local to_process="$changed_pkgs"
+
+ # Iteratively find all dependents
+ for _ in {1..10}; do # Max 10 levels of dependency
+ local new_deps=""
+
+ for pkg in $to_process; do
+ local deps=$(get_dependents "$pkg" "$dep_graph")
+ for dep in $deps; do
+ # Add if not already in affected
+ if ! echo " $affected " | grep -q " $dep "; then
+ affected="$affected $dep"
+ new_deps="$new_deps $dep"
+ fi
+ done
+ done
+
+ if [ -z "$new_deps" ]; then
+ break
+ fi
+
+ to_process="$new_deps"
+ done
+
+ # Sort and deduplicate
+ echo "$affected" | tr ' ' '\n' | sort -u | tr '\n' ' '
+}
+
+# Check if app depends on any of the affected packages
+check_app_affected() {
+ local app_name=$1
+ local affected_pkgs=$2
+
+ local app_pubspec="$APPS_DIR/$app_name/pubspec.yaml"
+ local app_deps=$(parse_dependencies "$app_pubspec")
+
+ for pkg in $affected_pkgs; do
+ if echo " $app_deps " | grep -q " $pkg "; then
+ echo "true"
+ return
+ fi
+ done
+
+ echo "false"
+}
+
+# Main logic
+main() {
+ local changed_files=("$@")
+
+ # Safety checks: lint everything if certain files changed
+ local lint_all="false"
+
+ if [ ${#changed_files[@]} -eq 0 ]; then
+ lint_all="true"
+ fi
+
+ for file in "${changed_files[@]}"; do
+ if [[ "$file" == *".github/workflows/mobile-packages-lint.yml"* ]] || \
+ [[ "$file" == *"mobile/analysis_options.yaml"* ]] || \
+ [[ "$file" == *"pubspec.yaml"* ]]; then
+ lint_all="true"
+ break
+ fi
+ done
+
+ # If linting all, return all packages
+ if [ "$lint_all" = "true" ]; then
+ local all_pkgs=$(find "$PACKAGES_DIR" -maxdepth 1 -type d -not -name "packages" -not -name "rust" -exec basename {} \; | sort | tr '\n' ' ')
+
+ echo "{"
+ echo " \"packages\": \"$all_pkgs\","
+ echo " \"lint_photos\": \"true\","
+ echo " \"lint_auth\": \"true\","
+ echo " \"lint_locker\": \"true\","
+ echo " \"lint_all\": \"true\""
+ echo "}"
+ return
+ fi
+
+ # Extract changed package names
+ local changed_pkgs=""
+ for file in "${changed_files[@]}"; do
+ if [[ "$file" =~ mobile/packages/([^/]+)/ ]]; then
+ pkg_name="${BASH_REMATCH[1]}"
+ if [ "$pkg_name" != "rust" ]; then
+ if ! echo " $changed_pkgs " | grep -q " $pkg_name "; then
+ changed_pkgs="$changed_pkgs $pkg_name"
+ fi
+ fi
+ fi
+ done
+
+ # If no packages changed, nothing to lint
+ if [ -z "$(echo $changed_pkgs | tr -d ' ')" ]; then
+ echo "{"
+ echo " \"packages\": \"\","
+ echo " \"lint_photos\": \"false\","
+ echo " \"lint_auth\": \"false\","
+ echo " \"lint_locker\": \"false\","
+ echo " \"lint_all\": \"false\""
+ echo "}"
+ return
+ fi
+
+ # Build dependency graph
+ local dep_graph=$(build_dep_graph)
+
+ # Get all affected packages
+ local affected_pkgs=$(get_affected_packages "$changed_pkgs" "$dep_graph")
+
+ # Check which apps are affected
+ local lint_photos=$(check_app_affected "photos" "$affected_pkgs")
+ local lint_auth=$(check_app_affected "auth" "$affected_pkgs")
+ local lint_locker=$(check_app_affected "locker" "$affected_pkgs")
+
+ # Output JSON
+ echo "{"
+ echo " \"packages\": \"$affected_pkgs\","
+ echo " \"lint_photos\": \"$lint_photos\","
+ echo " \"lint_auth\": \"$lint_auth\","
+ echo " \"lint_locker\": \"$lint_locker\","
+ echo " \"lint_all\": \"false\""
+ echo "}"
+}
+
+main "$@"
diff --git a/.github/workflows/mobile-packages-lint.yml b/.github/workflows/mobile-packages-lint.yml
index 80428050eb..1fd81026ab 100644
--- a/.github/workflows/mobile-packages-lint.yml
+++ b/.github/workflows/mobile-packages-lint.yml
@@ -6,6 +6,9 @@ on:
paths:
- "mobile/packages/**"
- ".github/workflows/mobile-packages-lint.yml"
+ - "mobile/analysis_options.yaml"
+ # Allow manual trigger for testing
+ workflow_dispatch:
env:
FLUTTER_VERSION: "3.32.8"
@@ -13,10 +16,80 @@ env:
permissions:
contents: read
+ pull-requests: read # Required for paths-filter
jobs:
+ detect-changes:
+ runs-on: ubuntu-latest
+ outputs:
+ packages: ${{ steps.filter.outputs.packages }}
+ lint_photos: ${{ steps.filter.outputs.lint_photos }}
+ lint_auth: ${{ steps.filter.outputs.lint_auth }}
+ lint_locker: ${{ steps.filter.outputs.lint_locker }}
+ lint_all: ${{ steps.filter.outputs.lint_all }}
+ rust_changed: ${{ steps.filter.outputs.rust_changed }}
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Detect changed files
+ uses: dorny/paths-filter@v3
+ id: changes
+ with:
+ filters: |
+ rust:
+ - 'mobile/packages/rust/**/*.rs'
+ - 'mobile/packages/rust/**/Cargo.toml'
+ - 'mobile/packages/rust/**/Cargo.lock'
+ - 'mobile/apps/photos/rust/**/*.rs'
+ - 'mobile/apps/photos/rust/**/Cargo.toml'
+ - 'rust/core/**/*.rs'
+ workflow:
+ - '.github/workflows/mobile-packages-lint.yml'
+ analysis:
+ - 'mobile/analysis_options.yaml'
+ packages:
+ - 'mobile/packages/**'
+
+ - name: Determine affected packages
+ id: filter
+ run: |
+ # Get list of changed files
+ CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} || echo "")
+
+ # Run dependency analyzer
+ RESULT=$(./.github/scripts/get-affected-packages.sh $CHANGED_FILES)
+
+ echo "Analysis result:"
+ echo "$RESULT"
+
+ # Extract values from JSON
+ PACKAGES=$(echo "$RESULT" | jq -r '.packages')
+ LINT_PHOTOS=$(echo "$RESULT" | jq -r '.lint_photos')
+ LINT_AUTH=$(echo "$RESULT" | jq -r '.lint_auth')
+ LINT_LOCKER=$(echo "$RESULT" | jq -r '.lint_locker')
+ LINT_ALL=$(echo "$RESULT" | jq -r '.lint_all')
+
+ # Set outputs
+ echo "packages=$PACKAGES" >> $GITHUB_OUTPUT
+ echo "lint_photos=$LINT_PHOTOS" >> $GITHUB_OUTPUT
+ echo "lint_auth=$LINT_AUTH" >> $GITHUB_OUTPUT
+ echo "lint_locker=$LINT_LOCKER" >> $GITHUB_OUTPUT
+ echo "lint_all=$LINT_ALL" >> $GITHUB_OUTPUT
+ echo "rust_changed=${{ steps.changes.outputs.rust }}" >> $GITHUB_OUTPUT
+
+ echo "Affected packages: $PACKAGES"
+ echo "Lint photos: $LINT_PHOTOS"
+ echo "Lint auth: $LINT_AUTH"
+ echo "Lint locker: $LINT_LOCKER"
+ echo "Lint all: $LINT_ALL"
+ echo "Rust changed: ${{ steps.changes.outputs.rust }}"
+
packages-lint:
+ needs: detect-changes
runs-on: ubuntu-latest
+ # Skip if no packages need linting
+ if: needs.detect-changes.outputs.packages != '' || needs.detect-changes.outputs.lint_all == 'true'
steps:
- name: Checkout code and submodules
uses: actions/checkout@v4
@@ -50,132 +123,164 @@ jobs:
run: flutter gen-l10n
working-directory: mobile/packages/strings
- # Lint all packages
+ # Lint all packages (conditionally based on what changed)
- name: Lint package - accounts
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'accounts')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/accounts
- name: Lint package - base
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'base')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/base
- name: Lint package - configuration
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'configuration')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/configuration
- name: Lint package - dir_utils
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'dir_utils')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/dir_utils
- name: Lint package - ente_crypto_api
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'ente_crypto_api')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/ente_crypto_api
- name: Lint package - ente_crypto_dart_adapter
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'ente_crypto_dart_adapter')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/ente_crypto_dart_adapter
- name: Lint package - ente_icons
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'ente_icons')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/ente_icons
- name: Lint package - ente_pure_utils
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'ente_pure_utils')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/ente_pure_utils
- name: Lint package - events
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'events')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/events
- name: Lint package - legacy
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'legacy')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/legacy
- name: Lint package - lock_screen
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'lock_screen')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/lock_screen
- name: Lint package - log_viewer
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'log_viewer')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/log_viewer
- name: Lint package - logging
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'logging')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/logging
- name: Lint package - native_video_editor
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'native_video_editor')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/native_video_editor
- name: Lint package - network
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'network')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/network
- name: Lint package - qr
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'qr')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/qr
- name: Lint package - sharing
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'sharing')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/sharing
- name: Lint package - strings
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'strings')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/strings
- name: Lint package - ui
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'ui')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/ui
- name: Lint package - utils
+ if: needs.detect-changes.outputs.lint_all == 'true' || contains(needs.detect-changes.outputs.packages, 'utils')
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/packages/utils
- name: Check formatting (ente_rust)
+ if: needs.detect-changes.outputs.rust_changed == 'true'
working-directory: mobile/packages/rust/rust
run: cargo fmt -- src/frb_generated.rs && cargo fmt --check
- name: Run clippy (ente_rust)
+ if: needs.detect-changes.outputs.rust_changed == 'true'
working-directory: mobile/packages/rust/rust
run: cargo clippy --all-targets --all-features
- name: Build (ente_rust)
+ if: needs.detect-changes.outputs.rust_changed == 'true'
working-directory: mobile/packages/rust/rust
run: cargo build
- name: Test (ente_rust)
+ if: needs.detect-changes.outputs.rust_changed == 'true'
working-directory: mobile/packages/rust/rust
run: cargo test
# Lint all three apps to ensure package changes don't break them
- name: Generate Rust bindings (photos app)
+ if: needs.detect-changes.outputs.lint_photos == 'true'
run: flutter_rust_bridge_codegen generate
working-directory: mobile/apps/photos
- name: Lint app - photos
+ if: needs.detect-changes.outputs.lint_photos == 'true'
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/apps/photos
- name: Check formatting (ente_photos_rust)
+ if: needs.detect-changes.outputs.rust_changed == 'true'
working-directory: mobile/apps/photos/rust
run: cargo fmt -- src/frb_generated.rs && cargo fmt --check
- name: Run clippy (ente_photos_rust)
+ if: needs.detect-changes.outputs.rust_changed == 'true'
working-directory: mobile/apps/photos/rust
run: cargo clippy --all-targets --all-features
- name: Build (ente_photos_rust)
+ if: needs.detect-changes.outputs.rust_changed == 'true'
working-directory: mobile/apps/photos/rust
run: cargo build
- name: Test (ente_photos_rust)
+ if: needs.detect-changes.outputs.rust_changed == 'true'
working-directory: mobile/apps/photos/rust
run: cargo test
- name: Lint app - auth
+ if: needs.detect-changes.outputs.lint_auth == 'true'
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/apps/auth
- name: Lint app - locker
+ if: needs.detect-changes.outputs.lint_locker == 'true'
run: flutter pub get && flutter analyze --no-fatal-infos
working-directory: mobile/apps/locker