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
1 change: 1 addition & 0 deletions .buildbot/android/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
exit 0 # migrated to .gitea/workflows/android.yml
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Expand Down
1 change: 1 addition & 0 deletions .buildbot/android/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
exit 0 # migrated to .gitea/workflows/android.yml

RELEASE_ARTIFACT=$(grep release_artifact packages/android/buildozer.spec |cut -d= -f2|tr -Cd 'a-z')

Expand Down
90 changes: 90 additions & 0 deletions .gitea/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Android Build

on:
push:
branches: [master, main, v0.6]
pull_request:
branches: [master, main, v0.6]

jobs:
build:
name: buildozer android debug
runs-on: ubuntu-latest
container: ubuntu:focal

steps:
- name: Install system dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update -qq
apt-get -y install -qq --no-install-recommends \
locales git curl autoconf automake build-essential cmake \
libtool libltdl-dev libffi-dev libssl-dev \
patch pkg-config python-is-python3 python3-dev python3-pip \
unzip zip openjdk-17-jdk libzbar0 gettext
locale-gen en_US.UTF-8

- name: Checkout repository
env:
TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory "$PWD"
git init
SERVER="${GITHUB_SERVER_URL#https://}"
git remote add origin "https://x-access-token:${TOKEN}@${SERVER}/${GITHUB_REPOSITORY}.git"
git fetch --depth 1 origin "${GITHUB_SHA}"
git checkout FETCH_HEAD

- name: Install buildozer and cython
run: pip install buildozer cython==3.0.10 virtualenv

- name: Create build user
run: |
useradd -m builder
chown -R builder:builder .
chown -R builder:builder "${RUNNER_TOOL_CACHE}"

- name: Prepare source tree
run: |
# buildozer symlink workaround (from build.sh)
rm -rf src/pybitmessage
mkdir -p src/pybitmessage
cp src/*.py src/pybitmessage
cp -r src/bitmessagekivy src/backend src/mockbm src/images src/pybitmessage

# Symlink both buildozer directories to persistent tool cache:
# ~/.buildozer holds SDK/NDK downloads
# packages/android/.buildozer holds p4a toolchain and build artifacts
mkdir -p "${RUNNER_TOOL_CACHE}/buildozer-home" "${RUNNER_TOOL_CACHE}/buildozer-builddir"
ln -sfn "${RUNNER_TOOL_CACHE}/buildozer-home" /home/builder/.buildozer
ln -sfn "${RUNNER_TOOL_CACHE}/buildozer-builddir" packages/android/.buildozer
chown -R builder:builder "${RUNNER_TOOL_CACHE}/buildozer-home" "${RUNNER_TOOL_CACHE}/buildozer-builddir"

- name: Build APK
env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
run: |
runuser -u builder -- bash -c '
# gradle OOM workaround
mkdir -p ~/.gradle
echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" \
> ~/.gradle/gradle.properties
cd packages/android
buildozer android debug
'

- name: Verify APK contents
run: |
RELEASE_ARTIFACT=$(grep release_artifact packages/android/buildozer.spec | cut -d= -f2 | tr -Cd 'a-z')
if [ "$RELEASE_ARTIFACT" = "aab" ]; then
echo "Release artifact is AAB, skipping APK verification"
exit 0
fi
unzip -p packages/android/bin/*.apk assets/private.tar \
| tar --list -z > package.list
cat package.list
grep '\.sql$' package.list || exit 1


76 changes: 76 additions & 0 deletions .gitea/workflows/tox-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Tox Linter Tests

on:
push:
branches: [master, main, v0.6]
pull_request:
branches: [master, main, v0.6]

jobs:
lint:
name: "${{ matrix.tox-env }} / python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
tox-env: [bandit, flake8, pycodestyle, pylint]
python-version: ["2.7", "3.10"]
include:
- python-version: "2.7"
container: "python:2.7-buster"
tox-suffix: "-py27"
- python-version: "3.10"
tox-suffix: ""

steps:
# ── System packages ────────────────────────────────────────
# Container (Python 2): runs as root, needs git for checkout
- name: Install system dependencies (container)
if: matrix.python-version == '2.7'
run: |
sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list
sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list
sed -i '/buster-updates/d' /etc/apt/sources.list
apt-get update -q
apt-get install -qy git libcap-dev

# Host VM (Python 3): git is pre-installed, just need libcap-dev
- name: Install system dependencies
if: matrix.python-version != '2.7'
run: |
sudo apt-get update -q
sudo apt-get install -qy libcap-dev

# GitHub mounts Node into containers, so actions/checkout works everywhere.
# Gitea runners don't, so the buster container needs a manual git clone.
- name: Checkout repository
if: "!(matrix.python-version == '2.7' && env.GITEA_ACTIONS == 'true')"
uses: actions/checkout@v4

- name: Checkout repository (Gitea container)
if: matrix.python-version == '2.7' && env.GITEA_ACTIONS == 'true'
env:
TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory "$PWD"
git init
SERVER="${GITHUB_SERVER_URL#https://}"
git remote add origin "https://x-access-token:${TOKEN}@${SERVER}/${GITHUB_REPOSITORY}.git"
git fetch --depth 1 origin "${GITHUB_SHA}"
git checkout FETCH_HEAD

# ── Python 3 ───────────────────────────────────────────────
- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version != '2.7'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

# ── Common ─────────────────────────────────────────────────
- name: Install tox
run: |
pip install "tox<4" "virtualenv<20.22.0"

- name: Run tox -e ${{ matrix.tox-env }}${{ matrix.tox-suffix }}
run: tox -e ${{ matrix.tox-env }}${{ matrix.tox-suffix }}
8 changes: 4 additions & 4 deletions packages/android/buildozer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ android.ndk_api = 21
android.private_storage = True

# (str) Android NDK directory (if empty, it will be automatically downloaded.)
android.ndk_path = /opt/android/android-ndk
#android.ndk_path =

# (str) Android SDK directory (if empty, it will be automatically downloaded.)
android.sdk_path = /opt/android/android-sdk
#android.sdk_path =

# (str) ANT directory (if empty, it will be automatically downloaded.)
android.ant_path = /opt/android/apache-ant
#android.ant_path =

# (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time
Expand All @@ -124,7 +124,7 @@ android.ant_path = /opt/android/apache-ant
# agreements. This is intended for automation only. If set to False,
# the default, you will be shown the license when first running
# buildozer.
# android.accept_sdk_license = False
android.accept_sdk_license = True

# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity
Expand Down
Loading