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
135 lines (125 loc) · 7.96 KB
/
Copy pathaction.yml
File metadata and controls
135 lines (125 loc) · 7.96 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
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_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)
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|runtime_env/.*|compose_runtime_env\.py|_generate_runtime_env_sources\.py)$|^backend/charts/backend-listen/.*_values\.yaml$|^backend/scripts/(runtime_env_validation/.*|render_backend_runtime_env|render_gke_backend_config|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|render_gke_backend_config|preflight_cloud_run_deploy|repair_cloud_run_traffic|deploy_status_report)\.py$|^backend/tests/fixtures/deploy_status/|^backend/docs/runbooks/prod_hotfix_runbook\.mdx$|^docs/docs\.json$|^\.github/workflows/gcp_backend.*\.ya?ml$|^\.github/actions/(sync-backfill-lifecycle|deploy-backend-stack)/|^\.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$|^\.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_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)
IMPACT_FILES=$(mktemp)
printf '%s\n' "$FILES" > "$IMPACT_FILES"
python3 scripts/pre_push_ci_prediction.py \
--changed-files "$IMPACT_FILES" \
--base "$DIFF_BASE" \
--event "${{ github.event_name }}" \
--github-output "$GITHUB_OUTPUT"
{
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_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_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