Files
msm8916-openwrt/.github/workflows/builder.yml
T
2025-09-19 13:15:19 +02:00

130 lines
4.2 KiB
YAML

name: OpenWrt Builder
on:
repository_dispatch:
workflow_dispatch:
inputs:
openwrt_version:
description: 'OpenWrt version to build'
required: true
default: 'main'
type: choice
options:
- 'main'
- 'openwrt-24.10'
env:
CONFIG_FILE: diffconfig
UPLOAD_BIN_DIR: true
UPLOAD_FIRMWARE: true
UPLOAD_RELEASE: false
TZ: Europe/Madrid
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo -E apt-get -qq update
sudo -E ./devenv/dependencies.sh
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo timedatectl set-timezone "$TZ"
sudo mkdir -p /workdir
sudo chown $USER:$GROUPS /workdir
- name: Clone source code
working-directory: /workdir
run: |
df -hT $PWD
echo "Cloning OpenWrt version: ${{ inputs.openwrt_version }}"
git clone --depth=1 --branch "${{ inputs.openwrt_version }}" https://git.openwrt.org/openwrt/openwrt.git openwrt
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
- name: Load msm89xx target and uz801 packages
run: |
git apply --unsafe-paths --directory=/workdir enable_wcn36xx_mac80211.patch
mv msm89xx openwrt/target/linux/msm89xx
mv packages openwrt/package/uz801
if [ "${{ inputs.openwrt_version }}" == "openwrt-24.10" ]; then
sed -i '/^KERNEL_PATCHVER/c\KERNEL_PATCHVER:=6.6' openwrt/target/linux/msm89xx/Makefile
fi
- name: Update and install feeds
run: |
cd openwrt
rm -rf tmp
./scripts/feeds update -a
./scripts/feeds install -a
- name: Load config
run: |
[ -f $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
- name: Download package
id: package
run: |
cd openwrt
make defconfig
make download -j8
find dl -size -1024c -exec ls -l {} \; || true
find dl -size -1024c -exec rm -f {} \; || true
- name: Compile the firmware
id: compile
run: |
cd openwrt
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 || make -j1 V=s
echo "status=success" >> $GITHUB_OUTPUT
grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' > DEVICE_NAME
[ -s DEVICE_NAME ] && echo "DEVICE_NAME=$(cat DEVICE_NAME)" >> $GITHUB_ENV
echo "FILE_DATE=$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
- name: Check space usage
if: (!cancelled())
run: df -hT
- name: Upload bin directory
uses: actions/upload-artifact@v4
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true'
with:
name: openwrt_bin_${{ env.DEVICE_NAME }}_${{ env.FILE_DATE }}
path: openwrt/bin
- name: Organize files
id: organize
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
run: |
cd openwrt/bin/targets/*/*
rm -rf packages
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "status=success" >> $GITHUB_OUTPUT
- name: Upload firmware
uses: actions/upload-artifact@v4
if: steps.organize.outputs.status == 'success' && !cancelled()
with:
name: openwrt_firmware_${{ env.DEVICE_NAME }}_${{ env.FILE_DATE }}
path: |
${{ env.FIRMWARE }}/openwrt-msm89xx-msm8916-yiming-uz801v3-ext4-boot.img
${{ env.FIRMWARE }}/openwrt-msm89xx-msm8916-yiming-uz801v3-ext4-system.img
${{ env.FIRMWARE }}/openwrt-msm89xx-msm8916-yiming-uz801v3.manifest
# - name: Upload image builder
# uses: actions/upload-artifact@v4
# if: steps.organize.outputs.status == 'success' && !cancelled()
# with:
# name: openwrt_imagebuilder_${{ env.DEVICE_NAME }}_${{ env.FILE_DATE }}
# path: |
# ${{ env.FIRMWARE }}/openwrt-msm89xx-msm8916-yiming-uz801v3-ext4-boot.img
# ${{ env.FIRMWARE }}/openwrt-msm89xx-msm8916-yiming-uz801v3-ext4-system.img