Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
113 changes: 48 additions & 65 deletions .github/scripts/changed-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
set -euo pipefail

FROM_TAG=$1
INCLUDE_TOKENS_SUBMODULES=${2:-false}

echo "🔍 Detecting changed modules since $FROM_TAG"
echo "📦 Include token submodules :apps and :docs is $INCLUDE_TOKENS_SUBMODULES"

# Track if affected special dirs
UIKIT_COMPOSE_CHANGED=false
INTEGR_COMPOSE_CHANGED=false
UIKIT_CHANGED=false
TESTING_CHANGED=false
TESTING_CHANGED_TARGET=""
TESTING_SEEN_VS=false
TESTING_SEEN_COMPOSE=false
INTEGR_CHANGED=false

declare -a MODULES_SET=()
CHANGED_TOKENS=false
Expand All @@ -20,10 +20,6 @@ INCLUDE_SANDBOX=false
while IFS= read -r FILE; do
echo "➡️ Checking file: $FILE"

if [[ "$FILE" == sdds-core/*/* ]]; then
INCLUDE_SANDBOX=true
fi

# sdds-haze
if [[ "$FILE" == third-party/sdds-haze/*/* ]]; then
FIRST=$(echo "$FILE" | cut -d '/' -f3)
Expand All @@ -38,19 +34,10 @@ while IFS= read -r FILE; do
# sdds-core (excluding icons/ and testing/)
if [[ "$FILE" == sdds-core/*/* ]]; then
FIRST=$(echo "$FILE" | cut -d '/' -f2)
if [[ "$FIRST" == "uikit-compose" || "$FIRST" == "uikit-compose-fixtures" ]]; then
if [[ "$FIRST" == "uikit-compose" ]]; then
UIKIT_COMPOSE_CHANGED=true
elif [[ "$FIRST" == "uikit" || "$FIRST" == "uikit-fixtures" ]]; then
elif [[ "$FIRST" == "uikit" ]]; then
UIKIT_CHANGED=true
elif [[ "$FIRST" == "testing" ]]; then
TESTING_CHANGED=true
# Track which testing flavors changed
if [[ "$FILE" == */vs/* ]]; then
TESTING_SEEN_VS=true
fi
if [[ "$FILE" == */compose/* ]]; then
TESTING_SEEN_COMPOSE=true
fi
fi
if [[ "$FIRST" != "icons" && "$FIRST" != "testing" && "$FIRST" != "gradle" ]]; then
MODULE=":sdds-core:$FIRST"
Expand All @@ -62,44 +49,26 @@ while IFS= read -r FILE; do
# integration-core
if [[ "$FILE" == integration-core/*/* ]]; then
FIRST=$(echo "$FILE" | cut -d '/' -f2)
if [[ "$FIRST" == "uikit-compose-fixtures" || "$FIRST" == "sandbox-compose" ]]; then
INTEGR_COMPOSE_CHANGED=true
elif [[ "$FIRST" == "uikit-fixtures" || "$FIRST" == "sandbox-view" ]]; then
INTEGR_CHANGED=true
elif [[ "$FIRST" == "sandbox-ksp" || "$FIRST" == "sandbox-core" ]]; then
INTEGR_COMPOSE_CHANGED=true
INTEGR_CHANGED=true
fi
MODULE=":integration-core:$FIRST"
MODULES_SET+=("$MODULE")
echo "✅ Matched: $MODULE"
fi

# tokens/*
if [[ "$FILE" == tokens/* ]]; then
INCLUDE_SANDBOX=true
CHANGED_TOKENS=true
fi

# playground/sandbox-compose
if [[ "$FILE" == playground/sandbox-compose/* ]]; then
MODULE=":playground:sandbox-compose"
MODULES_SET+=("$MODULE")
echo "✅ Matched: $MODULE"
fi
done < <(git diff --name-only "$FROM_TAG" HEAD)

# Resolve testing target based on observed paths
if [[ "$TESTING_CHANGED" == true ]]; then
if [[ "$TESTING_SEEN_VS" == true && "$TESTING_SEEN_COMPOSE" == true ]]; then
TESTING_CHANGED_TARGET="all"
elif [[ "$TESTING_SEEN_VS" == true ]]; then
TESTING_CHANGED_TARGET="view"
elif [[ "$TESTING_SEEN_COMPOSE" == true ]]; then
TESTING_CHANGED_TARGET="compose"
else
# Default when testing changed but neither subfolder matched explicitly
TESTING_CHANGED_TARGET="none"
fi
else
TESTING_CHANGED_TARGET="none"
fi

echo "🧪 Testing target resolved: $TESTING_CHANGED_TARGET"

if [[ "$UIKIT_COMPOSE_CHANGED" == true || "$UIKIT_CHANGED" == true || "$TESTING_CHANGED" == true ]]; then
if [[ "$UIKIT_COMPOSE_CHANGED" == true || "$UIKIT_CHANGED" == true || "$INTEGR_COMPOSE_CHANGED" == true || "$INTEGR_CHANGED" == true ]]; then
echo "🔁 Resolving token modules due to changes in uikit or testing"

for DIR in tokens/*/; do
Expand All @@ -112,18 +81,14 @@ if [[ "$UIKIT_COMPOSE_CHANGED" == true || "$UIKIT_CHANGED" == true || "$TESTING_
MODULE=":tokens:$NAME"
MODULES_SET+=("$MODULE")
echo "🔗 Added view token module due to uikit change: $MODULE"
elif [[ "$TESTING_CHANGED_TARGET" == "view" && "$NAME" == *view* ]]; then
MODULE=":tokens:$NAME"
MODULES_SET+=("$MODULE")
echo "🔗 Added view token module due to testing change: $MODULE"
elif [[ "$TESTING_CHANGED_TARGET" == "compose" && "$NAME" == *compose* ]]; then
elif [[ "$INTEGR_CHANGED" == true && "$NAME" == *view* ]]; then
MODULE=":tokens:$NAME"
MODULES_SET+=("$MODULE")
echo "🔗 Added compose token module due to testing change: $MODULE"
elif [[ "$TESTING_CHANGED_TARGET" == "all" && ( "$NAME" == *view* || "$NAME" == *compose* ) ]]; then
echo "🔗 Added view token module due to integration change: $MODULE"
elif [[ "$INTEGR_COMPOSE_CHANGED" == true && "$NAME" == *compose* ]]; then
MODULE=":tokens:$NAME"
MODULES_SET+=("$MODULE")
echo "🔗 Added token module for all testing targets: $MODULE"
echo "🔗 Added compose token module due to integration compose change: $MODULE"
fi
done
fi
Expand All @@ -145,13 +110,8 @@ if [[ "$CHANGED_TOKENS" == true ]]; then
done
fi

if [[ "$INCLUDE_SANDBOX" == true ]]; then
MODULE=":playground:sandbox-compose"
MODULES_SET+=("$MODULE")
echo "📦 Included sandbox-compose due to core/tokens changes"
fi

UNIQUE_MODULES=$(printf "%s\n" "${MODULES_SET[@]:-}" | sort -u | xargs)
echo "✅ Pre Final module list: $UNIQUE_MODULES"

# Apply ignore list from .ignore-changed-modules (if exists)
IGNORED_MODULES=()
Expand Down Expand Up @@ -182,6 +142,32 @@ if [[ ${#IGNORED_MODULES[@]} -gt 0 ]]; then
UNIQUE_MODULES=$(printf "%s " "${FILTERED_MODULES[@]}")
fi

if [[ "$INCLUDE_TOKENS_SUBMODULES" == "true" ]]; then
echo "📦 Adding :app and :docs submodules for token modules"

MODULES_WITH_TOKEN_SUBMODULES=()
for MODULE in $UNIQUE_MODULES; do
MODULES_WITH_TOKEN_SUBMODULES+=("$MODULE")

if [[ "$MODULE" == :tokens:* && "$MODULE" != *:app && "$MODULE" != *:docs ]]; then
for SUBMODULE in app docs; do
TOKEN_SUBMODULE="$MODULE:$SUBMODULE"
TOKEN_SUBMODULE_PATH="${TOKEN_SUBMODULE#:}"
TOKEN_SUBMODULE_PATH="${TOKEN_SUBMODULE_PATH//://}"

if [[ -d "$TOKEN_SUBMODULE_PATH" ]]; then
MODULES_WITH_TOKEN_SUBMODULES+=("$TOKEN_SUBMODULE")
echo "✅ Added token $SUBMODULE module: $TOKEN_SUBMODULE"
else
echo "⏭ Skipped missing token $SUBMODULE module: $TOKEN_SUBMODULE"
fi
done
fi
done

UNIQUE_MODULES=$(printf "%s\n" "${MODULES_WITH_TOKEN_SUBMODULES[@]:-}" | sort -u | xargs)
fi

# Check which modules actually exist (to handle deleted modules)
EXISTING_MODULES=()
NON_EXISTENT_MODULES=()
Expand All @@ -207,12 +193,9 @@ if (( ${#NON_EXISTENT_MODULES[@]} > 0 )); then
fi

# Replace CLEANED_MODULES with only existing modules
UNIQUE_MODULES=$(printf "%s " "${EXISTING_MODULES[@]}")
UNIQUE_MODULES=$(printf "%s " "${EXISTING_MODULES[@]:-}")

echo "✅ Final module list: $UNIQUE_MODULES"

# Output testing target for GitHub Actions
echo "testing_changed_target=$TESTING_CHANGED_TARGET" >> "$GITHUB_OUTPUT"

# Output for GitHub Actions
echo "modules=$UNIQUE_MODULES" >> "$GITHUB_OUTPUT"
echo "modules=$UNIQUE_MODULES" >> "$GITHUB_OUTPUT"
4 changes: 0 additions & 4 deletions .github/scripts/dispatch-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ for MODULE in "${MODULES[@]}"; do
EVENT_TYPE="publish-plugin-theme-builder"
PAYLOAD="{\"tag\": \"$TAG\"}"
;;
":playground:sandbox-compose")
EVENT_TYPE="publish-sandbox"
PAYLOAD="{\"tag\": \"$TAG\"}"
;;
":sdds-haze:haze")
EVENT_TYPE="publish-haze"
PAYLOAD="{\"tag\": \"$TAG\"}"
Expand Down
3 changes: 0 additions & 3 deletions .github/templates/apk-installation-instructions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
### 📦 Собранные APK
- 📥 [Скачать архив с APK](__APK_URL__) <!-- Замените __APK_URL__ на реальную ссылку при вставке -->

#### 📲 Как установить APK на Android-устройство:
1. Распакуйте архив.
2. Скопируйте нужный `.apk` на устройство (через USB, Telegram, Google Drive и т.д.).
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/android-code-quality-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
detect_changes:
name: Detect changes
uses: ./.github/workflows/detect-changes.yml
with:
includeTokensSubmodules: true
lint:
name: Perform lint analysis
needs: detect_changes
Expand Down
81 changes: 51 additions & 30 deletions .github/workflows/build-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,68 @@ concurrency:
cancel-in-progress: true

jobs:
build:
name: Build debug artifacts
detect_changes:
name: Detect changes
uses: ./.github/workflows/detect-changes.yml

build_apps:
name: Build debug APKs
needs: detect_changes
if: ${{ join(fromJson(needs.detect_changes.outputs.changed_tokens)) != '' }}
uses: ./.github/workflows/build-token-apps-common.yml
secrets: inherit
with:
modules: ${{ needs.detect_changes.outputs.changed_tokens }}
ref: ${{ github.head_ref }}
release: false

create_comment:
name: Attach APK comment
needs: build_apps
runs-on: ubuntu-latest
if: always() && needs.build_apps.result == 'success'
steps:
- name: Checkout the code
uses: actions/checkout@v4

- name: Prepare environment
uses: ./.github/actions/prepare-android-env
- name: Download APK metadata artifacts
uses: actions/download-artifact@v4
with:
pattern: sandbox-*-debug-metadata
path: apk-results

- name: Extract branch name
id: extract_branch
- name: Collect APK URLs and generate summary
id: collect_summary
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
run: |
if [ ! -d apk-results ]; then
echo "No APK metadata artifacts found." >> $GITHUB_STEP_SUMMARY
exit 0
fi

- name: Run sandbox-compose assembleDebug
run: ./gradlew :playground:sandbox-compose:assembleDebug -PbranchName=${{ steps.extract_branch.outputs.branch }}
: > build-summary.md
echo "### 📦 Собранные Debug APK" >> build-summary.md

- name: Upload APK
id: upload_apk
if: success()
uses: actions/upload-artifact@v4.3.1
with:
name: artifacts
path: |
**/build/outputs/apk/**/*.apk

- name: Generate comment with artifact link
shell: bash
if: ${{ steps.upload_apk.outputs.artifact-url }}
run: |
echo "Artifact url is ${{ steps.upload_apk.outputs.artifact-url || 'empty' }}"
sed "s|__APK_URL__|${{ steps.upload_apk.outputs.artifact-url }}|g" \
.github/templates/apk-installation-instructions.md > build-summary.md

cat build-summary.md
find apk-results -name artifact.json | sort | while read -r path; do
module=$(jq -r '.module' "$path")
url=$(jq -r '.artifactUrl' "$path")

if [[ -z "$url" || "$url" == "null" ]]; then
echo "Skipping $module because artifact URL is empty"
continue
fi

echo "- 📥 [$module]($url)" >> build-summary.md
done

echo >> build-summary.md
cat .github/templates/apk-installation-instructions.md >> build-summary.md
cat build-summary.md >> "$GITHUB_STEP_SUMMARY"

- name: Attach comment to PR
- name: Attach comment
if: success() && hashFiles('build-summary.md') != ''
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ steps.upload_apk.outputs.artifact-url }}
with:
header: apk
header: apk-debug
path: build-summary.md
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Loading
Loading