Skip to content

Karan-Frost/Build-Script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Android CI Bot Script (Python)

Python

A Python script designed to automate Android ROM building and interaction with Telegram. It handles source syncing, compilation, progress monitoring, and file uploading.

Adapted by Frost from the original Bash script by hipexscape.

Requirements

  • Python 3.x
  • requests library (pip install requests)
  • repo tool installed and in your PATH
  • rclone installed and configured (Optional, but recommended for ROM storage)

Setup

  1. Clone the repository: Clone this repository to the root of your source tree (or anywhere accessible).

  2. Install dependencies:

    pip install requests
  3. Create a Configuration File: Create a file named config.env (or any name like config.device.env) in the same directory as the script (for reference, see config.example.env). You can create multiple config files for different devices.

    Template:

    # Device Configuration
    DEVICE=your_device_codename
    VARIANT=user
    OFFICIAL_FLAG=False
    
    # Telegram Configuration
    CHAT_ID=-100xxxxxxxx
    BOT_TOKEN=your_bot_token
    ERROR_CHAT_ID=-100xxxxxxxx
    
    # Upload Configuration (Leave empty to force GoFile upload)
    RCLONE_REMOTE=drive
    RCLONE_FOLDER=roms/device_name
    
    # Initial install zip Configuration (Leave empty if you want to use your device's codename or if your device has recovery.img)
    INITIAL_INSTALL_ZIP_DEVICES=codename|codename2
    
    # Server Management
    POWEROFF=False

Configuration Variables

Variable Description
DEVICE Your device codename (e.g., zircon, veux)
VARIANT Build variant (user, userdebug, or eng)
OFFICIAL_FLAG Set to True if this is an official build, False otherwise
CHAT_ID Your Telegram Group/Channel Chat ID (e.g., -100xxxxxxx)
BOT_TOKEN Your HTTP API Bot Token from BotFather
ERROR_CHAT_ID Secondary Chat ID for sending error logs (can be same as CHAT_ID)
RCLONE_REMOTE Your rclone remote name (e.g., drive). If omitted, uploads to GoFile
RCLONE_FOLDER The target folder on the rclone remote
INITIAL_INSTALL_ZIP_DEVICES Used only if recovery.img is missing. Defines allowed devices for the generated install zip. Defaults to DEVICE
POWEROFF Set to True to power off the server after completion

Artifact Uploads

The script automatically handles uploads based on your configuration:

  1. ROM Zip:
    • Primary: Uploads to the Rclone Remote defined in the config.
    • Fallback: If RCLONE_REMOTE or RCLONE_FOLDER are missing from the config, the ROM zip is automatically uploaded to GoFile.io.
  2. Auxiliary Files: Always uploaded to GoFile.io for quick access:
    • Recovery: If recovery.img is found in the output, it is uploaded directly.
    • Initial Install Zip: If recovery.img is not found, the script generates a flashable zip containing boot, vendor_boot, and dtbo and uploads that instead.
    • OTA JSON: If a matching JSON file is found in vendor/ota/, it is also uploaded.

Command Line Options

Run the script using python3 ci_bot.py [options].

Option Flag Description
Config --config Path to your specific configuration file. Defaults to config.env if not specified.
Sync -s, --sync Runs repo sync before starting the build. Useful for fetching the latest source changes.
Clean -c, --clean Deletes the entire out/ directory. Use this for a completely fresh build (takes longer).
Disk Opt. --d-o, --disk-optimization Runs a disk optimizing script before building.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages