Skip to content

Commit

Permalink
Update build-openwrt.yml
Browse files Browse the repository at this point in the history
Signed-off-by: aUsernameWoW <[email protected]>
  • Loading branch information
aUsernameWoW authored Dec 9, 2024
1 parent c2fc994 commit 7442038
Showing 1 changed file with 69 additions and 108 deletions.
177 changes: 69 additions & 108 deletions .github/workflows/build-openwrt.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build OpenWRT in Github owned Actions
name: Build OpenWRT in Github Actions

on:
push:
Expand All @@ -9,153 +9,114 @@ on:
- main
workflow_dispatch:

env:
FORCE_UNSAFE_CONFIGURE: 1
PATH: /usr/lib/ccache:$PATH
CC: ccache gcc
CXX: ccache g++
CONFIG_CCACHE: y
CCACHE_DIR: ${{ github.workspace }}/.ccache

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up environment
run: |
sudo apt update
sudo apt install -y 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 coreutils ccache musl-tools
#sudo yum groupinstall "Development Tools" -y
#sudo yum install cmake ncurses-devel zlib-devel gcc gcc-c++ patch unzip bzip2 gettext perl-Data-Dumper rsync -y
#sudo yum install git subversion gawk libtool zlib-devel gcc make ncurses-devel patch wget bzip2 flex bison gperf python3 python3-pip python3-setuptools -y
#sudo yum install glibc-devel glibc-static texinfo expat-devel gettext-devel openssl-devel -y
#sudo yum install perl perl-CPAN -y
#sudo cpan IPC::Cmd
#yes
sudo apt install -y 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 \
coreutils ccache musl-tools
- name: Configure ccache
uses: hendrikmuhs/[email protected]
with:
max-size: 5G

- name: Cache OpenWRT dl folder
uses: actions/cache@v3
with:
path: $GITHUB_WORKSPACE/dl
key: ${{ runner.os }}-openwrt-dl-${{ hashFiles('$GITHUB_WORKSPACE/feeds.conf.default') }}
path: ${{ github.workspace }}/dl
key: ${{ runner.os }}-openwrt-dl-v1-${{ hashFiles('feeds.conf.default') }}
restore-keys: |
${{ runner.os }}-openwrt-dl-
${{ runner.os }}-openwrt-dl-v1-
- name: Cache OpenWRT build_dir
uses: actions/cache@v3
with:
path: $GITHUB_WORKSPACE/build_dir
key: ${{ runner.os }}-openwrt-build-${{ hashFiles('$GITHUB_WORKSPACE/.config') }}
path: ${{ github.workspace }}/build_dir
key: ${{ runner.os }}-openwrt-build-v1-${{ hashFiles('.config') }}
restore-keys: |
${{ runner.os }}-openwrt-build-
${{ runner.os }}-openwrt-build-v1-
- name: Set up ccache environment
run: |
export PATH="/usr/lib/ccache:$PATH"
export CC="ccache gcc"
export CXX="ccache g++"
export CONFIG_CCACHE=y
export CONFIG_CCACHE_DIR="$GITHUB_WORKSPACE/.ccache"
- uses: actions/cache@v2
- name: Cache ccache files
uses: actions/cache@v3
with:
path: $GITHUB_WORKSPACE/.ccache
key: ${{ runner.os }}-ccache-${{ hashFiles('**/Makefile') }}
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-ccache-v1-${{ hashFiles('**/Makefile') }}
restore-keys: |
${{ runner.os }}-ccache-
${{ runner.os }}-ccache-v1-
- name: Clone OpenWRT
- name: Update and install feeds
run: |
cd $GITHUB_WORKSPACE
./scripts/feeds update -a
./scripts/feeds install -a
curl -sSL https://raw.githubusercontent.com/chenmozhijin/turboacc/luci/add_turboacc.sh -o add_turboacc.sh && bash add_turboacc.sh
- name: Install additional packages
run: |
curl -sSL https://raw.githubusercontent.com/chenmozhijin/turboacc/luci/add_turboacc.sh -o add_turboacc.sh
bash add_turboacc.sh
git clone https://github.com/sirpdboy/netspeedtest.git package/netspeedtest
git clone https://github.com/jerrykuku/luci-theme-argon.git package/luci-theme-argon
#git clone https://github.com/aUsernameWoW/uugamebooster package/uugamebooster && cd package/uugamebooster && bash update_makefile.sh
- name: Configure .config
- name: Configure OpenWRT
run: |
cd $GITHUB_WORKSPACE
rm -rf .config
echo 'CONFIG_ALL_KMODS=y' >> .config
echo 'CONFIG_ALL_NONSHARED=y' >> .config
echo 'CONFIG_TARGET_mediatek_filogic_DEVICE_xiaomi_mi-router-ax3000t=y' >> .config
echo 'CONFIG_TARGET_mediatek_filogic=y' >> .config
echo 'CONFIG_TARGET_mediatek=y' >> .config
echo 'CONFIG_ZRAM_DEF_COMP_ZSTD=y' >> .config
echo 'CONFIG_FEED_luci=y' >> .config
echo 'CONFIG_FEED_packages=y' >> .config
echo 'CONFIG_FEED_routing=y' >> .config
echo 'CONFIG_FEED_telephony=y' >> .config
echo 'CONFIG_LUCI_LANG_zh_Hans=y' >> .config
echo 'CONFIG_PACKAGE_luci-app-firewall=y' >> .config
echo 'CONFIG_PACKAGE_luci-app-opkg=y' >> .config
echo 'CONFIG_PACKAGE_luci-app-turboacc=y' >> .config
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_BBR_CCA=y' >> .config
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_NFT_FULLCONE=y' >> .config
echo 'CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_OFFLOADING=y' >> .config
echo 'CONFIG_PACKAGE_luci-base=y' >> .config
echo 'CONFIG_PACKAGE_luci-i18n-base-zh-cn=y' >> .config
echo 'CONFIG_PACKAGE_luci-i18n-dashboard-zh-cn=y' >> .config
echo 'CONFIG_PACKAGE_luci-i18n-firewall-zh-cn=y' >> .config
echo 'CONFIG_PACKAGE_luci-i18n-opkg-zh-cn=y' >> .config
echo 'CONFIG_PACKAGE_luci-lib-base=y' >> .config
echo 'CONFIG_PACKAGE_luci-lib-ip=y' >> .config
echo 'CONFIG_PACKAGE_luci-lib-jsonc=y' >> .config
echo 'CONFIG_PACKAGE_luci-lib-nixio=y' >> .config
echo 'CONFIG_PACKAGE_luci-light=y' >> .config
echo 'CONFIG_PACKAGE_luci-lua-runtime=y' >> .config
echo 'CONFIG_PACKAGE_luci-mod-admin-full=y' >> .config
echo 'CONFIG_PACKAGE_luci-mod-dashboard=y' >> .config
echo 'CONFIG_PACKAGE_luci-mod-network=y' >> .config
echo 'CONFIG_PACKAGE_luci-mod-status=y' >> .config
echo 'CONFIG_PACKAGE_luci-mod-system=y' >> .config
echo 'CONFIG_PACKAGE_luci-proto-ipv6=y' >> .config
echo 'CONFIG_PACKAGE_luci-proto-ppp=y' >> .config
echo 'CONFIG_PACKAGE_luci-theme-argon=y' >> .config
echo 'CONFIG_PACKAGE_luci-theme-bootstrap=y' >> .config
echo 'CONFIG_PACKAGE_luci=y' >> .config
echo 'CONFIG_PACKAGE_luci-theme-openwrt-2020=y' >> .config
echo 'CONFIG_PACKAGE_zram-swap=y' >> .config
echo 'CONFIG_PACKAGE_btop=y' >> .config
echo 'CONFIG_BPF=y' >> .config
echo 'CONFIG_BPF_SYSCALL=y' >> .config
echo 'CONFIG_BPF_JIT=y' >> .config
echo 'CONFIG_CGROUPS=y' >> .config
echo 'CONFIG_KPROBES=y' >> .config
echo 'CONFIG_NET_INGRESS=y' >> .config
echo 'CONFIG_NET_EGRESS=y' >> .config
echo 'CONFIG_NET_SCH_INGRESS=m' >> .config
echo 'CONFIG_NET_CLS_BPF=m' >> .config
echo 'CONFIG_NET_CLS_ACT=y' >> .config
echo 'CONFIG_BPF_STREAM_PARSER=y' >> .config
echo 'CONFIG_DEBUG_INFO=y' >> .config
echo '# CONFIG_DEBUG_INFO_REDUCED is not set' >> .config
echo 'CONFIG_DEBUG_INFO_BTF=y' >> .config
echo 'CONFIG_KPROBE_EVENTS=y' >> .config
echo 'CONFIG_BPF_EVENTS=y' >> .config
echo 'CONFIG_PACKAGE_kmod=y' >> .config
echo 'CONFIG_CCACHE=y' >> .config
echo 'CONFIG_CCACHE_DIR=".ccache"' >> .config
echo 'CONFIG_PACKAGE_luci-app-netspeedtest=y' >> .config
echo 'CONFIG_PACKAGE_luci-app-https-dns-proxy=y' >> .config
echo 'CONFIG_PACKAGE_uugamebooster=y' >> .config
echo 'CONFIG_LIBCURL_OPENSSL=y' >> .config
echo 'CONFIG_LIBCURL_NGHTTP3=y' >> .config
echo 'CONFIG_LIBCURL_ZSTD=y' >> .config
echo 'CONFIG_DEVEL=y' >> .config
echo 'CONFIG_PACKAGE_wpad=y' >> .config
echo 'CONFIG_WPA_WOLFSSL=y' >> .config
cp openwrt.config .config
make defconfig
- name: Build OpenWRT
uses: nick-invision/retry@v2
with:
timeout_minutes: 360
max_attempts: 3
retry_wait_seconds: 60
command: |
make -j$(nproc) V=s || make V=s
on_retry_command: |
rm -rf build_dir/target-*
rm -rf build_dir/toolchain-*
- name: Generate build info
if: success()
run: |
cd $GITHUB_WORKSPACE
make -j$(nproc) V=s || make V=s
echo "Build completed at $(date)" > build_info.txt
echo "OpenWRT Version: $(git describe --tags)" >> build_info.txt
echo "Commit: $(git rev-parse HEAD)" >> build_info.txt
ccache -s >> build_info.txt
- name: Upload firmware
uses: actions/upload-artifact@v4
with:
name: openwrt-firmware
name: openwrt-firmware-${{ github.sha }}
path: |
bin/targets/**/*
.config
build_info.txt
retention-days: 7

- name: Upload build logs on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: build-logs-${{ github.sha }}
path: |
bin/targets/*
.config
build_info.txt
logs/
build.log
retention-days: 7

0 comments on commit 7442038

Please sign in to comment.