forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
151 lines (141 loc) · 10.3 KB
/
Copy pathaction.yml
File metadata and controls
151 lines (141 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Detect Changes
description: Compute path-filter booleans for PR and main-branch checks.
outputs:
diff_base:
value: ${{ steps.changed.outputs.diff_base }}
has_dart:
value: ${{ steps.changed.outputs.has_dart }}
has_python:
value: ${{ steps.changed.outputs.has_python }}
has_arb:
value: ${{ steps.changed.outputs.has_arb }}
has_firmware:
value: ${{ steps.changed.outputs.has_firmware }}
has_frontend:
value: ${{ steps.changed.outputs.has_frontend }}
has_web_app:
value: ${{ steps.changed.outputs.has_web_app }}
has_admin:
value: ${{ steps.changed.outputs.has_admin }}
has_personas:
value: ${{ steps.changed.outputs.has_personas }}
has_workflows:
value: ${{ steps.changed.outputs.has_workflows }}
has_backend_runtime_env:
value: ${{ steps.changed.outputs.has_backend_runtime_env }}
has_backend_async_gate:
value: ${{ steps.changed.outputs.has_backend_async_gate }}
has_backend_isolation_gate:
value: ${{ steps.changed.outputs.has_backend_isolation_gate }}
has_desktop_agent_runtime:
value: ${{ steps.changed.outputs.has_desktop_agent_runtime }}
has_app_codegen:
value: ${{ steps.changed.outputs.has_app_codegen }}
has_app_l10n:
value: ${{ steps.changed.outputs.has_app_l10n }}
has_app_compile_smoke:
value: ${{ steps.changed.outputs.has_app_compile_smoke }}
has_app_dart:
value: ${{ steps.changed.outputs.has_app_dart }}
has_desktop_rust:
value: ${{ steps.changed.outputs.has_desktop_rust }}
has_desktop_auth_session_ratchet:
value: ${{ steps.changed.outputs.has_desktop_auth_session_ratchet }}
has_format:
value: ${{ steps.changed.outputs.has_format }}
has_flutter_generated:
value: ${{ steps.changed.outputs.has_flutter_generated }}
has_backend_static_contracts:
value: ${{ steps.changed.outputs.has_backend_static_contracts }}
has_backend_workflow_contracts:
value: ${{ steps.changed.outputs.has_backend_workflow_contracts }}
has_web_lint:
value: ${{ steps.changed.outputs.has_web_lint }}
has_web_build:
value: ${{ steps.changed.outputs.has_web_build }}
runs:
using: composite
steps:
- name: Get changed files
id: changed
shell: bash
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
DIFF_BASE="origin/${{ github.base_ref }}"
else
DIFF_BASE="HEAD~1"
fi
FILES=$(scripts/changed-files "$DIFF_BASE"...HEAD)
# Translation-only changes cannot break the Android build: the ARBs and
# their generated localization classes still go through Dart Analyze and
# Flutter Tests, so the expensive Gradle APK build adds no signal.
APP_COMPILE_FILES=$(echo "$FILES" | grep -vE '^app/lib/l10n/app_[A-Za-z_]+\.arb$|^app/lib/l10n/app_localizations(_[A-Za-z_]+)?\.dart$' || true)
echo "$FILES"
echo "diff_base=$DIFF_BASE" >> "$GITHUB_OUTPUT"
has_dart=$(echo "$FILES" | grep -q '\.dart$' && echo true || echo false)
has_python=$(echo "$FILES" | grep -q 'backend/.*\.py$' && echo true || echo false)
has_arb=$(echo "$FILES" | grep -q '\.arb$' && echo true || echo false)
has_firmware=$(echo "$FILES" | grep -qE '^(omi|omiGlass)/.*\.(c|cpp|cc|cxx|h|hpp)$' && echo true || echo false)
has_frontend=$(echo "$FILES" | grep -qE '^web/frontend/|^\.github/workflows/web-checks\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_web_app=$(echo "$FILES" | grep -qE '^web/app/|^\.github/workflows/web-checks\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_admin=$(echo "$FILES" | grep -qE '^web/admin/|^\.github/workflows/web-checks\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_personas=$(echo "$FILES" | grep -qE '^web/personas-open-source/|^\.github/workflows/web-checks\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_workflows=$(echo "$FILES" | grep -qE '^\.github/workflows/.*\.ya?ml$|^\.github/actionlint\.ya?ml$|^\.github/actions/.*/action\.ya?ml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_backend_runtime_env=$(echo "$FILES" | grep -qE '^backend/deploy/runtime_env\.yaml$|^backend/charts/backend-listen/.*_values\.yaml$|^backend/scripts/(render_backend_runtime_env|validate-backend-runtime-env|preflight-cloud-run-deploy|repair_cloud_run_traffic|deploy_status_report|pre-deploy-check)\.(py|sh)$|^backend/tests/unit/test_(backend_runtime_env_validator|preflight_cloud_run_deploy|repair_cloud_run_traffic|deploy_status_report)\.py$|^backend/tests/fixtures/deploy_status/|^docs/doc/developer/backend/prod_hotfix_runbook\.mdx$|^docs/docs\.json$|^\.github/workflows/gcp_backend.*\.ya?ml$|^\.github/actions/sync-backfill-lifecycle/|^\.github/workflows/(repo-checks|backend-checks)\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_backend_async_gate=$(echo "$FILES" | grep -qE '^backend/.*\.py$|^backend/agent-proxy/Dockerfile$|^\.github/workflows/(repo-checks|backend-checks)\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_backend_isolation_gate=$(echo "$FILES" | grep -qE '^backend/.*\.py$|^backend/tests/\.(import_time_side_effects_legacy|module_stub_legacy_allowlist)$|^\.github/workflows/(repo-checks|backend-checks)\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_backend_workflow_contracts=$(echo "$FILES" | grep -qE '^\.gitignore$|^backend/testing/workflow_contracts\.json$|^backend/scripts/(check_workflow_contracts|select_backend_unit_tests)\.py$|^scripts/(changed-files|install-git-hooks\.sh|pre-push|pre-push-singleflight)$|^\.github/workflows/(backend-checks|backend-unit-tests|desktop-checks|desktop-swift-ci|repo-checks)\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_desktop_agent_runtime=$(echo "$FILES" | grep -qE '^desktop/macos/agent/|^desktop/macos/pi-mono-extension/|^desktop/macos/run\.sh$|^desktop/macos/scripts/(audit-desktop-bundle-deps|prepare-agent-runtime|prepare-desktop-bundle-native-deps|test-tool-surfaces|agent-logic-harness)\.sh$|^codemagic\.yaml$|^scripts/pre-push$|^\.github/workflows/(repo-checks|desktop-checks)\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_app_codegen=$(echo "$FILES" | grep -qE '^app/lib/|^app/pubspec\.yaml$|^app/pubspec\.lock$|^app/build\.yaml$|^app/assets/|^\.github/workflows/(repo-checks|mobile-app-checks)\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_app_l10n=$(echo "$FILES" | grep -qE '^app/lib/l10n/.*\.arb$|^app/l10n\.yaml$|^\.github/workflows/(repo-checks|mobile-app-checks)\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_app_compile_smoke=$(echo "$APP_COMPILE_FILES" | grep -qE '^app/(lib/|android/|ios/|pubspec\.yaml$|pubspec\.lock$|build\.yaml$|analysis_options\.yaml$|l10n\.yaml$|flavorizr\.yaml$|setup/prebuilt/|setup/scripts/|config/|assets/)|^\.github/workflows/(repo-checks|mobile-app-checks)\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_app_dart=$(echo "$FILES" | grep -qE '^app/(lib|test|integration_test)/.*\.dart$|^app/pubspec\.(yaml|lock)$|^app/analysis_options\.yaml$|^app/analysis_baseline\.json$|^app/scripts/analyze_ratchet\.sh$|^app/test\.sh$|^\.github/workflows/mobile-app-checks\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_desktop_rust=$(echo "$FILES" | grep -qE '^desktop/macos/Backend-Rust/|^\.github/workflows/(repo-checks|desktop-checks)\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
has_desktop_auth_session_ratchet=$(echo "$FILES" | grep -qE '^desktop/macos/Desktop/Sources/(APIClient|AuthService|AuthSessionCoordinator|DesktopKeychainStore|OmiApp)\.swift$|^desktop/macos/Desktop/Sources/Auth/.*\.swift$|^desktop/macos/scripts/smoke-signed-desktop-artifact\.sh$|^codemagic\.yaml$|^\.github/scripts/check_desktop_auth_session\.py$|^\.github/workflows/(repo-checks|desktop-checks)\.yml$|^\.github/actions/detect-changes/' && echo true || echo false)
{
echo "has_dart=$has_dart"
echo "has_python=$has_python"
echo "has_arb=$has_arb"
echo "has_firmware=$has_firmware"
echo "has_frontend=$has_frontend"
echo "has_web_app=$has_web_app"
echo "has_admin=$has_admin"
echo "has_personas=$has_personas"
echo "has_workflows=$has_workflows"
echo "has_backend_runtime_env=$has_backend_runtime_env"
echo "has_backend_async_gate=$has_backend_async_gate"
echo "has_backend_isolation_gate=$has_backend_isolation_gate"
echo "has_backend_workflow_contracts=$has_backend_workflow_contracts"
echo "has_desktop_agent_runtime=$has_desktop_agent_runtime"
echo "has_app_codegen=$has_app_codegen"
echo "has_app_l10n=$has_app_l10n"
echo "has_app_compile_smoke=$has_app_compile_smoke"
echo "has_app_dart=$has_app_dart"
echo "has_desktop_rust=$has_desktop_rust"
echo "has_desktop_auth_session_ratchet=$has_desktop_auth_session_ratchet"
} >> "$GITHUB_OUTPUT"
if [ "$has_dart" = "true" ] || [ "$has_python" = "true" ] || [ "$has_arb" = "true" ] || [ "$has_firmware" = "true" ]; then
echo "has_format=true" >> "$GITHUB_OUTPUT"
else
echo "has_format=false" >> "$GITHUB_OUTPUT"
fi
if [ "$has_app_codegen" = "true" ] || [ "$has_app_l10n" = "true" ]; then
echo "has_flutter_generated=true" >> "$GITHUB_OUTPUT"
else
echo "has_flutter_generated=false" >> "$GITHUB_OUTPUT"
fi
if [ "$has_backend_runtime_env" = "true" ] || [ "$has_backend_async_gate" = "true" ] || [ "$has_backend_isolation_gate" = "true" ] || [ "$has_backend_workflow_contracts" = "true" ]; then
echo "has_backend_static_contracts=true" >> "$GITHUB_OUTPUT"
else
echo "has_backend_static_contracts=false" >> "$GITHUB_OUTPUT"
fi
if [ "$has_frontend" = "true" ] || [ "$has_personas" = "true" ]; then
echo "has_web_lint=true" >> "$GITHUB_OUTPUT"
else
echo "has_web_lint=false" >> "$GITHUB_OUTPUT"
fi
if [ "$has_web_app" = "true" ] || [ "$has_admin" = "true" ]; then
echo "has_web_build=true" >> "$GITHUB_OUTPUT"
else
echo "has_web_build=false" >> "$GITHUB_OUTPUT"
fi