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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 189 additions & 0 deletions .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
name: Build App

on:
workflow_call:
inputs:
app-type:
description: 'App type (Parent, Student, or Teacher)'
required: true
type: string
app-type-lower:
description: 'App type in lowercase (parent, student, or teacher)'
required: true
type: string
firebase-app-id-secret:
description: 'Name of the Firebase App ID secret'
required: true
type: string
secrets:
ACCESS_TOKEN:
required: true
ANDROID_RELEASE_KEYSTORE_B64:
required: true
FIREBASE_SERVICE_ACCOUNT_KEY:
required: true
FIREBASE_APP_ID:
required: true

jobs:
build:
name: ${{ inputs.app-type-lower }}-build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 1
token: ${{ secrets.ACCESS_TOKEN }}

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Cache Gradle Build Cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches/build-cache-*
.gradle
key: ${{ runner.os }}-gradle-build-cache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-gradle-build-cache-

- name: Decode Release Keystore
run: |
echo "${{ secrets.ANDROID_RELEASE_KEYSTORE_B64 }}" | base64 --decode > release.jks
chmod 600 release.jks

- name: Setup Service account
env:
FIREBASE_SERVICE_ACCOUNT_KEY: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }}
run: |
if [ -z "${FIREBASE_SERVICE_ACCOUNT_KEY}" ]; then
echo "Error: Firebase service account key is not configured"
exit 1
fi
echo "${FIREBASE_SERVICE_ACCOUNT_KEY}" > service-account-key.json
chmod 600 service-account-key.json

- name: Build Release Notes
id: get_release_notes
run: |
echo "RELEASE_NOTES<<EOF" >> $GITHUB_OUTPUT
echo "${{ github.event.pull_request.title }}" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Install Firebase CLI
run: npm install -g firebase-tools

- name: Setup Firebase App Id
run: |
if [ -z "${{ secrets.FIREBASE_APP_ID }}" ]; then
echo "Error: Firebase App ID is not configured"
exit 1
fi
echo "${{ secrets.FIREBASE_APP_ID }}" > firebase_app_id.txt

- name: Build debug and test APKs
run: |
./gradle/gradlew -p apps :${{ inputs.app-type-lower }}:assembleQaDebug \
:${{ inputs.app-type-lower }}:assembleQaDebugAndroidTest \
:${{ inputs.app-type-lower }}:assembleDevDebugMinify \
--build-cache \
--parallel \
--max-workers=4 \
--no-daemon \
-Dorg.gradle.jvmargs="-Xmx6g -XX:+HeapDumpOnOutOfMemoryError" \
-Dkotlin.compiler.execution.strategy=in-process \
-Pandroid.injected.signing.store.file=$(pwd)/release.jks

- name: Upload QA debug APK
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.app-type-lower }}-qa-debug.apk
path: apps/${{ inputs.app-type-lower }}/build/outputs/apk/qa/debug/${{ inputs.app-type-lower }}-qa-debug.apk

- name: Upload QA test APK
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.app-type-lower }}-qa-debug-androidTest.apk
path: apps/${{ inputs.app-type-lower }}/build/outputs/apk/androidTest/qa/debug/${{ inputs.app-type-lower }}-qa-debug-androidTest.apk

- name: Upload Dev debug APK
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.app-type-lower }}-dev-debugMinify.apk
path: apps/${{ inputs.app-type-lower }}/build/outputs/apk/dev/debugMinify/${{ inputs.app-type-lower }}-dev-debugMinify.apk

- name: Distribute app to Firebase App Distribution
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/service-account-key.json
run: |
firebase --version
FIREBASE_APP_ID="$(cat firebase_app_id.txt)"

if ! firebase appdistribution:distribute "apps/${{ inputs.app-type-lower }}/build/outputs/apk/dev/debugMinify/${{ inputs.app-type-lower }}-dev-debugMinify.apk" \
--app "$FIREBASE_APP_ID" \
--release-notes "${{ steps.get_release_notes.outputs.RELEASE_NOTES }}" \
--groups "Testers" > result.txt 2>&1; then
echo "Firebase distribution failed:"
cat result.txt
exit 1
fi
cat result.txt

- name: Prepare Comment Body
id: prepare_comment
run: |
INSTALL_URL=$(grep -o 'https://appdistribution\.firebase[^[:space:]]*' result.txt | head -1)

if [ -z "$INSTALL_URL" ]; then
echo "Error: Could not extract install URL from Firebase output"
cat result.txt
exit 1
fi

INSTALL_URL_ESCAPED=$(printf '%s' "$INSTALL_URL" | sed 's/:/%3A/g; s/\//%2F/g; s/?/%3F/g; s/=/%3D/g; s/&/%26/g')
{
echo "body<<EOF"
echo "<!-- qr-code-${{ inputs.app-type }} -->"
echo "<p>${{ inputs.app-type }} Install Page</p><img src=\"https://api.qrserver.com/v1/create-qr-code/?data=${INSTALL_URL_ESCAPED}\" width=\"200\">"
echo "EOF"
} >> $GITHUB_OUTPUT

- name: Find Previous Comment
id: find_comment
uses: peter-evans/find-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- qr-code-${{ inputs.app-type }} -->'

- name: Create or Update Comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.prepare_comment.outputs.body }}
edit-mode: replace

- name: Cleanup sensitive files
if: always()
run: |
rm -f release.jks
rm -f service-account-key.json
rm -f firebase_app_id.txt
rm -f result.txt
32 changes: 17 additions & 15 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,23 @@ jobs:
This is an update to an existing PR. You must:
1. Use the GitHub MCP tools to fetch your previous reviews on this PR
2. Fetch the latest PR diff and identify what has changed since your last review
3. Update your EXISTING review comments - DO NOT create a new review summary
4. Use checkboxes to track progress on previously identified issues:
- [ ] Unresolved issue
- [x] Resolved issue
5. For each previously identified issue:
- If it has been addressed: Mark the checkbox as complete [x] and add a note
- If it is still present: Keep the checkbox unchecked [ ]
- If new issues are found: Add new checkboxes [ ]
6. Update inline comments:
- Resolve or update threads that have been addressed
- Add new inline comments ONLY for new issues that require changes
- Do NOT add inline comments for positive changes or improvements
7. Keep all positive feedback in the summary section only
3. Find your previous review summary comment (the one that starts with "## PR Review Summary" or similar)
4. Post a NEW PR comment (not a review) with an update status that includes:
- Reference to your previous review
- Progress update using checkboxes:
- [x] Previously identified issues that have been resolved
- [ ] Previously identified issues still present
- [ ] New issues found in this update
- Brief summary of what changed
- Any new concerns or positive feedback
5. For inline review comments:
- Resolve threads where the issue has been fixed
- Update existing review comment threads if partially addressed
- Add new inline review comments ONLY for new issues that require changes
- Do NOT add inline comments for positive feedback
6. DO NOT create a new review summary - only post a progress update comment

DO NOT create a new review from scratch. Update the existing one.' || '
Use mcp__github__create_or_update_issue_comment to post the update.' || '
## NEW REVIEW EVENT
This is a new PR or initial review. You must:
1. Use the GitHub MCP tools to fetch the PR diff
Expand All @@ -85,5 +87,5 @@ jobs:

# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
claude_args: '--allowedTools "mcp__github__create_pending_pull_request_review,mcp__github__add_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__get_pull_request_diff,mcp__github__list_reviews,mcp__github__get_review,mcp__github__list_review_comments,mcp__github__update_review_comment,mcp__github__create_or_update_pull_request_review_comment"'
claude_args: '--allowedTools "mcp__github__create_pending_pull_request_review,mcp__github__add_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__get_pull_request_diff,mcp__github__list_reviews,mcp__github__get_review,mcp__github__list_review_comments,mcp__github__update_review_comment,mcp__github__create_or_update_pull_request_review_comment,mcp__github__create_or_update_issue_comment,mcp__github__list_issue_comments,mcp__github__resolve_review_thread"'

Loading
Loading