Automatic Build with GitHub Workflow¶
It’s possible to automate the generation of SDK files using GitHub Workflows. For practical demonstrations, please refer to these examples to see it in action.
Workflow¶
This workflow is titled “Radiant Compilation Process” and is specifically designed to automate the compilation of APK files using a tool called Radiant-Compiler.
[ ]:
# .github/workflows
name: Radiant Compilation Process
on:
workflow_dispatch: # Allows manual trigger of the workflow
push: # Triggers the workflow on every push to the repository
jobs:
compile-apk:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Radiant-Compiler
run: |
pip install radiant-compiler
- name: Execute Command in Docker Container
run: |
docker pull dunderlab/radiant_p4a:latest
echo "*.pyc" > blacklist.txt
echo "sqlite3/*" >> whitelist.txt
echo "lib-dynload/_sqlite3.so" >> whitelist.txt
echo "*.py" >> whitelist.txt
radiant_p4a apk --arch arm64-v8a
- name: Upload APKs as Artifacts
uses: actions/upload-artifact@v4
with:
name: generated-apks
path: ./*.apk
Triggers:¶
Workflow Dispatch: This trigger allows the workflow to be manually initiated from the GitHub UI. It’s useful for ad-hoc runs or testing.
Push Event: The workflow is automatically triggered on every
push
to the repository. This ensures that any changes made to the codebase are immediately reflected in the compiled APKs.
Job: compile-apk
¶
This job is responsible for the actual compilation process.
Environment: Runs on the latest Ubuntu virtual environment provided by GitHub Actions.
Steps:
Checkout Repository: Uses the
actions/checkout@v4
action to clone the repository into the GitHub Actions runner, making the codebase available for subsequent steps.Install Radiant-Compiler: Executes a command to install the Radiant-Compiler using pip. This tool is essential for compiling the APKs.
Execute Command in Docker Container:
Pulls the latest
radiant_p4a
Docker image fromdunderlab/radiant_p4a
.Creates a blacklist and whitelist for file selection, optimizing the build process.
Executes the Radiant-Compiler inside the Docker container to compile the APK, targeting the
arm64-v8a
architecture.
Upload APKs as Artifacts:
Utilizes the
actions/upload-artifact@v4
action.Artifacts named
generated-apks
are created, containing all APK files generated in the workflow.These APKs are stored as artifacts on GitHub, making them easily accessible for testing or deployment.
This workflow is a robust solution for automating the APK compilation process, ensuring consistency and efficiency in the build pipeline.
Django configuration¶
Django projects require a main.py file that uses radiant.compiler.server
as a specialized server for Android.
[ ]:
import sys
import os
from radiant.compiler import server
sys.path.append(os.path.join(os.path.dirname(__file__)))
server.main("test_project", ip='localhost', port=5000)