-
-
Notifications
You must be signed in to change notification settings - Fork 24
Migrate from python-for-android to Chaquopy #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rtibbles
wants to merge
7
commits into
develop
Choose a base branch
from
chaquopy_refactor
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0f93e5d
Remove obsolete python-for-android infrastructure
rtibbles 805bf5d
Add Gradle project with Chaquopy-based Android app
rtibbles e9487d7
Update CI workflows and build scripts for Chaquopy
rtibbles ff0500e
Add unit tests for utility classes and task workers
rtibbles cbbdbf1
Update README for Chaquopy-based architecture
rtibbles 9206ff6
Add development and testing tooling
rtibbles ef2bca8
Use preinstalled Android SDK on GitHub Actions runner
rtibbles File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| name: Build and Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - develop | ||
| pull_request: | ||
| branches: | ||
| - develop | ||
|
|
||
| jobs: | ||
| pre_job: | ||
| name: Path match check | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
| steps: | ||
| - id: skip_check | ||
| uses: fkirc/skip-duplicate-actions@v5.3.1 | ||
| with: | ||
| github_token: ${{ github.token }} | ||
| paths_ignore: '["**.po", "**.json"]' | ||
|
|
||
| download_tar: | ||
| name: Download Kolibri tar | ||
| needs: pre_job | ||
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| tar-file-name: ${{ steps.get_tar.outputs.tar-file-name }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Get latest Kolibri release URL | ||
| id: get_release | ||
| uses: actions/github-script@v9 | ||
| with: | ||
| result-encoding: string | ||
| script: | | ||
|
|
||
| const { data: releases } = await github.rest.repos.listReleases({ | ||
| owner: 'learningequality', | ||
| repo: 'kolibri', | ||
| per_page: 1, | ||
| page: 1, | ||
| }); | ||
|
|
||
| if (!releases.length) throw new Error('No releases found for kolibri'); | ||
| const latestRelease = releases[0]; | ||
| const tarAsset = latestRelease.assets.find(asset => asset.name.endsWith('.tar.gz')); | ||
| if (!tarAsset) throw new Error('No .tar.gz asset in latest release'); | ||
| return tarAsset.browser_download_url; | ||
|
|
||
| - name: Download Kolibri tar | ||
| id: get_tar | ||
| env: | ||
| TAR_URL: ${{ steps.get_release.outputs.result }} | ||
| run: | | ||
| make get-tar tar="$TAR_URL" | ||
| echo "tar-file-name=$(ls tar/*.tar.gz | head -1 | xargs basename)" >> $GITHUB_OUTPUT | ||
| - name: Upload tar as artifact | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: ${{ steps.get_tar.outputs.tar-file-name }} | ||
| path: tar/${{ steps.get_tar.outputs.tar-file-name }} | ||
|
|
||
| build_apk: | ||
| name: Build Debug APK | ||
| needs: [pre_job, download_tar] | ||
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | ||
| uses: ./.github/workflows/build_apk.yml | ||
| with: | ||
| tar-file-name: ${{ needs.download_tar.outputs.tar-file-name }} | ||
|
|
||
| tests: | ||
| name: Unit tests | ||
| needs: [pre_job, download_tar] | ||
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '17' | ||
| cache: 'gradle' | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| enable-cache: true | ||
| cache-python: true | ||
| - name: Install Python dependencies | ||
| run: uv sync && uv pip install -r requirements.txt | ||
| - name: Download Kolibri tar | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: ${{ needs.download_tar.outputs.tar-file-name }} | ||
| path: tar | ||
| - name: Run unit tests | ||
| run: ./gradlew test | ||
|
|
||
| smoke_test: | ||
| name: Smoke test (API ${{ matrix.api-level }}) | ||
| needs: [pre_job, build_apk] | ||
| if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| api-level: [24, 30, 35] | ||
| include: | ||
| - api-level: 24 | ||
| target: default | ||
| - api-level: 30 | ||
| target: google_apis | ||
| - api-level: 35 | ||
| target: google_apis | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '17' | ||
| - name: Install Maestro CLI | ||
| run: make maestro-install | ||
| - name: Add Maestro to PATH | ||
| run: echo "$HOME/.maestro/bin" >> $GITHUB_PATH | ||
| - name: Enable KVM | ||
| run: | | ||
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
| sudo udevadm control --reload-rules | ||
| sudo udevadm trigger --name-match=kvm | ||
| - name: Download APK artifact | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: ${{ needs.build_apk.outputs.apk-file-name }} | ||
| path: dist | ||
| - name: Run smoke test | ||
| uses: reactivecircus/android-emulator-runner@v2 | ||
| with: | ||
| api-level: ${{ matrix.api-level }} | ||
| arch: x86_64 | ||
| target: ${{ matrix.target }} | ||
| force-avd-creation: false | ||
| disable-animations: true | ||
| # Hardened emulator flags. Snapshot save/restore + accelerated GPU have been | ||
| # the root cause of intermittent "bad color buffer handle" and "device offline" | ||
| # crashes mid-test on CI — `-no-snapshot` skips both load and save, and | ||
| # `swiftshader_indirect` forces software rendering. | ||
| emulator-options: -no-snapshot -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none | ||
| # NOTE: reactivecircus runs each line of this script as a separate `sh -c` call, | ||
| # so multi-line shell constructs (until/while/case) must live in the Makefile | ||
| # or a script file, not here. | ||
| script: | | ||
| adb install -r dist/*.apk | ||
| adb shell am set-debug-app --persistent org.learningequality.Kolibri | ||
| adb wait-for-device | ||
| until adb shell pm path org.learningequality.Kolibri >/dev/null 2>&1; do sleep 1; done | ||
| make smoke-test-with-retry | ||
| - name: Upload Maestro debug output | ||
| if: always() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: maestro-debug-output-api-${{ matrix.api-level }} | ||
| path: ~/.maestro/tests/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.