OpenWrt-CI #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# <https://github.com/KFERMercer/OpenWrt-CI> | |
# | |
# Copyright (C) 2019 P3TERX | |
# | |
# Copyright (C) 2020 KFERMercer | |
# | |
name: OpenWrt-CI | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 20 * * * | |
permissions: | |
contents: read | |
jobs: | |
build_openwrt: | |
name: Build OpenWrt Firmware | |
runs-on: ubuntu-latest | |
steps: | |
- name: Before freeing up disk space | |
run: | | |
echo "Before freeing up disk space" | |
echo "==============================================================================" | |
df -hT | |
echo "==============================================================================" | |
- name: "Optimize Disk Space" | |
uses: "hugoalh/[email protected]" | |
with: | |
operate_sudo: "True" | |
general_include: ".+" | |
general_exclude: |- | |
^GCC$ | |
^G\+\+$ | |
Clang | |
LLVM | |
docker_include: ".+" | |
docker_prune: "True" | |
docker_clean: "True" | |
apt_prune: "True" | |
apt_clean: "True" | |
homebrew_prune: "True" | |
homebrew_clean: "True" | |
npm_prune: "True" | |
npm_clean: "True" | |
os_swap: "True" | |
- name: Freeing up disk space | |
uses: easimon/maximize-build-space@master | |
with: | |
root-reserve-mb: 2048 | |
swap-size-mb: 1 | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
remove-haskell: 'true' | |
remove-codeql: 'true' | |
remove-docker-images: 'true' | |
- name: Free up disk space complete | |
run: | | |
echo "Free up disk space complete" | |
echo "==============================================================================" | |
df -hT | |
echo "==============================================================================" | |
- name: Checkout OpenWrt | |
uses: actions/checkout@v3 | |
- name: Space cleanup and Initialization environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
# docker rmi `docker images -q` | |
sudo -E rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d /usr/local/lib/android | |
sudo -E apt-mark hold grub-efi-amd64-signed | |
sudo -E apt update | |
sudo -E apt -y purge azure-cli* docker* ghc* zulu* llvm* firefox google* dotnet* powershell* openjdk* mysql* php* mongodb* dotnet* snap* | |
sudo -E apt -y full-upgrade | |
sudo -E apt -y install ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python3 python3-pip libpython3-dev qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev | |
sudo -E systemctl daemon-reload | |
sudo -E apt -y autoremove --purge | |
sudo -E apt clean | |
sudo -E timedatectl set-timezone "Asia/Shanghai" | |
- name: Update feeds | |
run: | | |
sed -i 's/#src-git helloworld/src-git helloworld/g' ./feeds.conf.default | |
./scripts/feeds update -a | |
./scripts/feeds install -a | |
- name: Generate configuration file | |
run: | | |
rm -f ./.config* | |
touch ./.config | |
# | |
# ========================固件定制部分======================== | |
# | |
cat >> .config <<EOF | |
CONFIG_TARGET_x86=y | |
CONFIG_TARGET_x86_64=y | |
CONFIG_TARGET_x86_64_Generic=y | |
CONFIG_TARGET_IMAGES_GZIP=y | |
CONFIG_PACKAGE_kmod-ath=y | |
CONFIG_ATH_USER_REGD=y | |
CONFIG_PACKAGE_ATH_DFS=y | |
CONFIG_PACKAGE_kmod-ath10k=y | |
CONFIG_ATH10K_LEDS=y | |
CONFIG_ATH10K_THERMAL=y | |
CONFIG_PACKAGE_kmod-ath5k=y | |
CONFIG_PACKAGE_kmod-ath9k=y | |
CONFIG_ATH9K_SUPPORT_PCOEM=y | |
CONFIG_PACKAGE_kmod-ath9k-common=y | |
CONFIG_PACKAGE_kmod-ath9k-htc=y | |
CONFIG_PACKAGE_kmod-cfg80211=y | |
CONFIG_PACKAGE_kmod-mac80211=y | |
CONFIG_PACKAGE_MAC80211_DEBUGFS=y | |
CONFIG_PACKAGE_MAC80211_MESH=y | |
CONFIG_PACKAGE_kmod-rt2800-lib=y | |
CONFIG_PACKAGE_kmod-rt2800-usb=y | |
CONFIG_PACKAGE_kmod-rt2x00-lib=y | |
CONFIG_PACKAGE_kmod-rt2x00-usb=y | |
CONFIG_PACKAGE_dnsmasq_full_dhcpv6=y | |
CONFIG_PACKAGE_ipv6helper=y | |
CONFIG_PACKAGE_kmod-usb3=y | |
CONFIG_PACKAGE_kmod-usb-storage=y | |
CONFIG_PACKAGE_kmod-usb-storage-extras=y | |
CONFIG_PACKAGE_kmod-fs-ext4=y | |
CONFIG_PACKAGE_kmod-fs-ntfs=y | |
CONFIG_PACKAGE_luci-app-samba4=y | |
CONFIG_PACKAGE_luci-app-vsftpd=y | |
CONFIG_PACKAGE_luci-app-frpc=y | |
CONFIG_PACKAGE_luci-app-zerotier=y | |
CONFIG_PACKAGE_luci-app-ddns=y | |
CONFIG_PACKAGE_luci-app-wol=y | |
CONFIG_PACKAGE_luci-app-upnp=y | |
CONFIG_PACKAGE_luci-app-unblockmusic=y | |
CONFIG_PACKAGE_luci-app-jd-dailybonus=y | |
CONFIG_PACKAGE_luci-app-accesscontrol=y | |
CONFIG_PACKAGE_luci-app-arpbind=y | |
CONFIG_PACKAGE_luci-app-autoreboot=y | |
CONFIG_PACKAGE_luci-app-diskman_INCLUDE_btrfs_progs=y | |
CONFIG_PACKAGE_luci-app-diskman_INCLUDE_lsblk=y | |
CONFIG_PACKAGE_luci-app-filetransfer=y | |
CONFIG_PACKAGE_luci-app-firewall=y | |
CONFIG_PACKAGE_luci-app-nlbwmon=y | |
CONFIG_PACKAGE_luci-app-ramfree=y | |
CONFIG_PACKAGE_luci-app-rclone_INCLUDE_rclone-webui=y | |
CONFIG_PACKAGE_luci-app-rclone_INCLUDE_rclone-ng=y | |
CONFIG_PACKAGE_luci-app-ttyd=y | |
CONFIG_PACKAGE_luci-app-turboacc=y | |
CONFIG_PACKAGE_luci-app-turboacc_INCLUDE_OFFLOADING=y | |
CONFIG_PACKAGE_luci-app-vlmcsd=y | |
CONFIG_PACKAGE_luci-theme-bootstrap=y | |
CONFIG_PACKAGE_luci-app-ssr-plus=y | |
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Xray=y | |
CONFIG_PACKAGE_htop=y | |
CONFIG_PACKAGE_automount=y | |
CONFIG_PACKAGE_openssh-sftp-server=y | |
CONFIG_PACKAGE_luci-app-aria2=y | |
CONFIG_PACKAGE_luci-app-docker=y | |
CONFIG_PACKAGE_luci-theme-netgear=y | |
EOF | |
# | |
# ========================固件定制部分结束======================== | |
# | |
sed -i 's/^[ \t]*//g' ./.config | |
make defconfig | |
- name: Download packages | |
run: make download -j16 | |
- name: Compile firmware | |
run: | | |
make -j$(nproc) || make -j1 V=s | |
echo "=======================" | |
echo "Space usage:" | |
echo "=======================" | |
df -h | |
echo "=======================" | |
du -h --max-depth=1 ./ --exclude=build_dir --exclude=bin | |
du -h --max-depth=1 ./build_dir | |
du -h --max-depth=1 ./bin | |
- name: Prepare artifact | |
run: | | |
mkdir -p ./artifact/package | |
mkdir -p ./artifact/buildinfo | |
rm -rf $(find ./bin/targets/ -type d -name "packages") | |
cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ./artifact/package/ | |
cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/ | |
- name: Upload buildinfo | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenWrt_buildinfo | |
path: ./artifact/buildinfo/ | |
- name: Upload package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenWrt_package | |
path: ./artifact/package/ | |
- name: Upload firmware | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OpenWrt_firmware | |
path: ./bin/targets/ |