Skip to content
Open
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
34 changes: 0 additions & 34 deletions .buildkite/build.sh

This file was deleted.

10 changes: 0 additions & 10 deletions .buildkite/pipeline.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions .dockerignore

This file was deleted.

2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ updates:
- "actions/*"
# Maintain dependencies for Gradle
- package-ecosystem: "gradle"
directory: "python-for-android/dists/kolibri"
directory: "/app"
schedule:
interval: "monthly"
time: "00:00"
Expand Down
166 changes: 166 additions & 0 deletions .github/workflows/build_and_test.yml
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];
Comment thread
rtibbles marked this conversation as resolved.
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/
57 changes: 16 additions & 41 deletions .github/workflows/build_apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,60 +102,35 @@ jobs:
# of whether this is being run from the local repository with workflow_dispatch
# or from another repository with workflow_call.
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Set up Python 3.9
uses: actions/setup-python@v6
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
python-version: 3.9
- name: Install Apt Dependencies
# Dependencies installed here are taken from the buildozer Dockerfile:
# https://github.com/kivy/buildozer/blob/master/Dockerfile#L45
# with items that are already installed on the Ubuntu 22.04 image removed:
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#installed-apt-packages
run: |
sudo apt update -qq > /dev/null \
&& DEBIAN_FRONTEND=noninteractive sudo apt install -qq --yes --no-install-recommends \
build-essential \
ccache \
cmake \
gettext \
libffi-dev \
libltdl-dev \
patch \
zlib1g-dev
- uses: actions/cache@v5
with:
# This is where python for android puts its intermediary build
# files - we cache this to improve build performance, but be
# aggressive in clearing the cache whenever any file changes
# in the repository, especially as we commit files to this folder
# too, so we don't want the cache to override these files.
# We achieve this by just caching on the currently checked out commit.
# Every time we update this repository, this commit will change,
# but repeated workflow calls for this commit will use the cache.
path: ./python-for-android
key: ${{ runner.os }}-python-for-android-${{ steps.get-commit.outputs.sha }}
- uses: actions/cache@v5
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
enable-cache: true
cache-python: true
- name: Download the tarfile from URL for workflow_dispatch
if: ${{ github.event.inputs.tar-url }}
run: make get-tar tar=${{ github.event.inputs.tar-url }}
env:
TAR_URL: ${{ github.event.inputs.tar-url }}
run: make get-tar tar="$TAR_URL"
- name: Download the tarfile from URL for workflow_call
if: ${{ inputs.tar-url }}
run: make get-tar tar=${{ inputs.tar-url }}
env:
TAR_URL: ${{ inputs.tar-url }}
run: make get-tar tar="$TAR_URL"
- name: Download the tarfile from artifacts
if: ${{ inputs.tar-file-name }}
uses: actions/download-artifact@v8
with:
name: ${{ inputs.tar-file-name }}
path: tar
- name: Install dependencies
run: pip install -r requirements.txt
- name: Ensure that Android SDK dependencies are installed
run: make setup
run: uv sync --extra build && uv pip install -r requirements.txt
- name: Build the aab
if: ${{ inputs.release == true || github.event.inputs.release == 'true' }}
env:
Expand Down
53 changes: 0 additions & 53 deletions .github/workflows/pr_build.yml

This file was deleted.

19 changes: 11 additions & 8 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Linting
on:
push:
branches:
- develop
- develop
pull_request:
branches:
- develop
- develop

jobs:
pre_job:
Expand All @@ -17,7 +17,7 @@ jobs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
uses: fkirc/skip-duplicate-actions@v5.3.1
with:
github_token: ${{ github.token }}
paths_ignore: '["**.po", "**.json"]'
Expand All @@ -27,8 +27,11 @@ jobs:
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: 3.9
- uses: pre-commit/action@v3.0.1
- uses: actions/checkout@v6
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- uses: j178/prek-action@v2
Loading
Loading