Skip to content

Update requirements.txt #94

Update requirements.txt

Update requirements.txt #94

name: Build and Downloaf Native Lib Package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: '11'
- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Upload requirements.txt
run: |
# Make sure the requirements.txt is present in the repo
if [ ! -f requirements.txt ]; then
echo "requirements.txt not found!"
exit 1
fi
cat requirements.txt
- name: Install Python Dependencies
run: |
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install git+https://github.com/flet-dev/python-for-android.git@3.11.6
pip install --upgrade cython pipgrip
- name: Extract dependencies with pipgrip
run: |
source .venv/bin/activate
pipgrip $(cat requirements.txt) --lock
- name: Set up Android SDK
run: |
mkdir -p $HOME/Android/Sdk/cmdline-tools
wget https://dl.google.com/android/repository/commandlinetools-linux-7302050_latest.zip
unzip commandlinetools-linux-7302050_latest.zip -d $HOME/Android/Sdk/cmdline-tools/
mv $HOME/Android/Sdk/cmdline-tools/cmdline-tools $HOME/Android/Sdk/cmdline-tools/latest
echo "ANDROID_SDK_ROOT=$HOME/Android/Sdk" >> $GITHUB_ENV
echo "SDK_ROOT=$HOME/Android/Sdk" >> $GITHUB_ENV
echo "ANDROID_NDK_HOME=/home/runner/Android/Sdk/ndk/25.2.9519653" >> $GITHUB_ENV
echo "PATH=$PATH:$HOME/Android/Sdk/cmdline-tools/latest/bin:$HOME/Android/Sdk/platform-tools:$ANDROID_NDK_HOME" >> $GITHUB_ENV
yes | $HOME/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --install "platform-tools" "platforms;android-33" "build-tools;33.0.0"
$HOME/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --list
- name: Install Android NDK
run: |
NDK_VERSION="25.2.9519653"
yes | $HOME/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --install "ndk;$NDK_VERSION" --channel=3
- name: Build Android Package
id: build_package
run: |
source .venv/bin/activate # Activate virtual environment
p4a create --requirements=$(paste -s -d, pipgrip.lock) --arch arm64-v8a --arch armeabi-v7a --arch x86_64 --sdk-dir $ANDROID_SDK_ROOT --ndk-dir $ANDROID_NDK_HOME --dist-name mydist
- name: Zip mydist folder
run: |
cd /home/runner/.local/share/python-for-android/dists
zip -r mydist.zip mydist
- name: List zip files
run: |
ls -la
- name: Upload ZIP artifact
uses: actions/upload-artifact@v3
with:
name: mydist
path: /home/runner/.local/share/python-for-android/dists/mydist.zip