16 Commits

Author SHA1 Message Date
remittor
71cc899a8a test 14 2025-01-13 21:50:57 +03:00
remittor
1319a71eb8 test 13 2025-01-13 19:54:09 +03:00
remittor
780d267c51 test 12 2025-01-13 17:08:26 +03:00
remittor
3312aa1a1a test 11 2025-01-13 17:06:08 +03:00
remittor
d277ae7c4d test 11 2025-01-13 16:54:12 +03:00
remittor
466536466f test 10 2025-01-13 16:38:36 +03:00
remittor
f95c5e6368 test 9 2025-01-13 16:05:43 +03:00
remittor
038c27a05a test 8 2025-01-13 15:52:59 +03:00
remittor
2e3db4faa2 test 7 2025-01-13 15:38:46 +03:00
remittor
f23162d73e test 6 2025-01-13 15:21:12 +03:00
remittor
0073630566 test 5 2025-01-13 15:13:29 +03:00
remittor
ae23d4b8e3 test 4 2025-01-13 13:20:23 +03:00
remittor
d4a1ec7f70 test 3 2025-01-13 12:55:14 +03:00
remittor
32acb91ac6 test 2 2025-01-13 12:51:56 +03:00
remittor
8cc2e45f53 test 1 2025-01-13 12:40:52 +03:00
remittor
63511e08c1 Add action builder 2025-01-13 12:13:00 +03:00
3 changed files with 259 additions and 1 deletions

253
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,253 @@
name: build
on:
workflow_dispatch:
# push:
# tags:
# - v[0-9]+*
env:
REPO_URL: https://github.com/openwrt-xiaomi/openwrt.git
REPO_BRANCH: xq-24.10
TAG_PREFIX: v24-
BUILD_ROOT: ${{ github.workspace }}/openwrt
DEPENDENCIES: ${{ github.workspace }}/dependencies-ubuntu.txt
TZ: UTC
DEVICE_NAME: unknown
BUILD_DATE: unknown
jobs:
check:
runs-on: ubuntu-24.04
outputs:
tag: ${{ steps.gh.outputs.tag }}
date: ${{ steps.gh.outputs.date }}
sha: ${{ steps.gh.outputs.sha }}
url: ${{ steps.gh.outputs.url }}
message: ${{ steps.gh.outputs.message }}
is_active: ${{ steps.activity.outputs.is_active }}
steps:
- name: Get repo data via GH API
id: gh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: 'openwrt-xiaomi/openwrt'
run: |
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
BRANCH=$(gh api repos/$REPO --jq '.default_branch')
DATE=$(gh api repos/$REPO/commits/$BRANCH --jq '.commit.committer.date')
BUILD_DATE=$( date --utc +'%y%m%d' )
TAG=$TAG_PREFIX$BUILD_DATE
{
echo "tag=$TAG"
echo "date=$(date --utc -d $DATE +%Y%m%d)"
echo "sha=$(gh api repos/$REPO/commits/$BRANCH --jq '.sha[0:7]')"
echo "url=$(gh api repos/$REPO/commits/$BRANCH --jq '.html_url')"
echo "build_root=$BUILD_ROOT"
echo "message<<EOF"
gh api repos/$REPO/commits/$BRANCH --jq '.commit.message'
echo EOF
} >> $GITHUB_OUTPUT
echo "DATE=$DATE" >> $GITHUB_ENV
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Check for repo activity
id: activity
env:
DATE: ${{ env.DATE }}
URL: ${{ steps.gh.outputs.url }}
run: |
TIMESTAMP=$(date --utc -d $DATE +%s)
DAYS=$(( ( $(date --utc +%s) - $TIMESTAMP ) / 86400 ))
echo "Repository activity: $(date --utc -d $DATE)"
echo "Commit: $URL"
if [ "${{ github.event_name }}" != "schedule" ]; then
is_active=true
elif [[ $DAYS -lt 1 ]] ; then
is_active=true
else
echo "Repository not updated within last 24 hours."
is_active=false
fi
echo "is_active=$is_active" >> $GITHUB_OUTPUT
build:
needs: check
#if: needs.check.outputs.is_active == 'true'
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
target:
- kng_re
- r3d
- r3g
- rb03
- rb06
- rd03
- rt-ax52
- rt-ax57m
- rt-ax59u
- rt-ax89x
- tuf_ax4200
- tuf_ax6000
steps:
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get -qq update
#sudo apt-get -qq update && sudo apt-get -qq upgrade
sudo apt-get -qq install $(cat $DEPENDENCIES)
sudo apt-get -qq autoremove --purge
sudo apt-get -qq clean
sudo timedatectl set-timezone "$TZ"
- name: Maximize build disk space
uses: easimon/maximize-build-space@master
with:
remove-dotnet: true
remove-android: true
remove-haskell: true
remove-codeql: true
remove-docker-images: true
- name: Checkout builder
uses: actions/checkout@main
- name: Download OpenWrt sources
run: git clone --branch $REPO_BRANCH $REPO_URL $BUILD_ROOT
- name: Init builder
env:
BLDROOT: ${{ github.workspace }}
shell: bash
run: |
rsync -avq --exclude=".*" --exclude="$(basename $BUILD_ROOT)" $BLDROOT/ $BUILD_ROOT/
cd $BUILD_ROOT
chmod +x *.sh
wget https://github.com/fantastic-packages/packages/raw/refs/heads/24.10/keys/usign/53FF2B6672243D28.pub
- name: Update OpenWrt packages
run: |
cd $BUILD_ROOT
./xupdate.sh -f
- name: Build the firmware image
id: compile
env:
TARGET: ${{ matrix.target }}
run: |
cd $BUILD_ROOT
MAKE_JOBS=$(($(nproc)+1))
echo "$MAKE_JOBS thread compile"
./xmake.sh -m -t $TARGET
make -j $MAKE_JOBS download world
# || make V=sc
DEVICE_NAME=$( grep -so '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' )
BOARD_NAME=$( grep -so '^CONFIG_TARGET_BOARD=.*' .config | cut -d'"' -f2 )
SUBTARGET_NAME=$( grep -so '^CONFIG_TARGET_SUBTARGET=.*' .config | cut -d'"' -f2 )
OUT_DIR=$BUILD_ROOT/bin/targets/$BOARD_NAME/$SUBTARGET_NAME
# BLD_VER=24.10.0-rc5
BLD_VER=$( cat $OUT_DIR/profiles.json | grep -so '"version_number":"[^"]*' | grep -so '[^"]*$' )
FILE_DATE=$(date --utc +'%y%m%d')
echo "Firmware $BLD_VER [$FILE_DATE] builded!"
# mkdir -p logs
# mkdir -p $OUT_DIR
# echo "$BOARD_NAME $SUBTARGET_NAME $DEVICE_NAME" > "$OUT_DIR/$DEVICE_NAME.txt"
if [ ! -f $OUT_DIR/kernel-debug.tar.zst ]; then
echo "File kernel-debug.tar.zst not found!"
exit 100
fi
echo "status=success" >> $GITHUB_OUTPUT
echo "DEVICE_NAME=$DEVICE_NAME" >> $GITHUB_ENV
echo "BOARD_NAME=$BOARD_NAME" >> $GITHUB_ENV
echo "SUBTARGET_NAME=$SUBTARGET_NAME" >> $GITHUB_ENV
echo "BLD_VER=$BLD_VER" >> $GITHUB_ENV
echo "OUT_DIR=$OUT_DIR" >> $GITHUB_ENV
echo "FILE_DATE=$(date --utc +'%y%m%d')" >> $GITHUB_ENV
echo "FILE_TIME=$(date --utc +'%Y%m%d%H%M')" >> $GITHUB_ENV
- name: Check space usage
run: df -hT
- name: Compress build logs
if: always()
env:
TARGET: ${{ matrix.target }}
LOGS_DIR: ${{ env.BUILD_ROOT }}/logs
run: |
tar -cJvf logs-$TARGET.tar.xz $LOGS_DIR
- name: Cleanup OUT directory
if: steps.compile.outputs.status == 'success'
env:
OUT_DIR: ${{ env.OUT_DIR }}
run: |
cd $OUT_DIR
echo "---------------------------"
ls -la
echo "---------------------------"
rm -rf packages
rm -f kernel-*
rm -f *uImage
rm -f *ubi-cleaner*
rm -f *-ram-*.bin
- name: Info
env:
OUT_DIR: ${{ env.OUT_DIR }}
run: |
echo "---------------------------"
ls -la $OUT_DIR
echo "---------------------------"
- name: Upload OUT directory
uses: actions/upload-artifact@main
if: steps.compile.outputs.status == 'success'
with:
name: openwrt-${{ env.BLD_VER }}-${{ env.FILE_DATE }}-${{ env.DEVICE_NAME }}
path: ${{ env.OUT_DIR }}
if-no-files-found: error
- name: Upload build logs
if: always()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.target }}
path: logs-*.tar.xz
release:
needs: [ check, build ]
permissions:
contents: write
runs-on: ubuntu-24.04
strategy:
max-parallel: 1
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: openwrt-*
- name: Put images into zip
env:
TAG: ${{ needs.check.outputs.tag }}
DATE: ${{ needs.check.outputs.date }}
run: |
mkdir -p public
find . -mindepth 1 -type d -name 'openwrt-*' -exec sh -c 'zip -0 ./public/$(basename {}).zip -j {} {}/*' \;
ls -lh ./public/*.zip
- name: Upload assets
uses: andelf/nightly-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ needs.check.outputs.tag }}
with:
prerelease: false
tag_name: ${{ needs.check.outputs.tag }}
name: '${{ needs.check.outputs.tag }}'
files: ./public/*.zip

1
dependencies-ubuntu.txt Normal file
View File

@@ -0,0 +1 @@
build-essential clang flex bison g++ gawk gcc-multilib g++-multilib gettext git libncurses5-dev libssl-dev python3-setuptools rsync swig unzip zlib1g-dev file wget

View File

@@ -16,8 +16,9 @@ KALLSYMS=false
TESTING_KERNEL=false
BUILD_ONLY_INITRAMFS=false
BUILD_SKIP_INITRAMFS=false
CALL_MAKE=true
while getopts "j:t:fiskT" opt; do
while getopts "j:t:fiskTm" opt; do
case $opt in
j) MAKE_JOBS=$OPTARG;;
t) XTARGET=$OPTARG;;
@@ -26,6 +27,7 @@ while getopts "j:t:fiskT" opt; do
T) TESTING_KERNEL=true;;
i) BUILD_ONLY_INITRAMFS=true;;
s) BUILD_SKIP_INITRAMFS=true;;
m) CALL_MAKE=false;;
esac
done
@@ -262,6 +264,8 @@ function build_target {
#make tools/install -j$make_jobs
#make toolchain/install -j$make_jobs
[ "$CALL_MAKE" = "false" ] && return 0
make -j $make_jobs download world
}