Skip to content

OpenWrt-CI

OpenWrt-CI #13

Workflow file for this run

#
# <https://github.com/KFERMercer/OpenWrt-CI>
#
# Copyright (C) 2019 P3TERX
#
# Copyright (C) 2020 KFERMercer
#
name: OpenWrt-CI
on:
workflow_dispatch:
inputs:
ssh:
description: 'SSH connection to Actions'
required: false
default: 'false'
# schedule:
# - cron: 0 20 * * *
release:
types: [published]
watch:
types: [started]
permissions:
contents: read
jobs:
build_openwrt:
name: Build OpenWrt Firmware
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: build_k2p
- name: Space cleanup
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: Checkout OpenWrt
uses: actions/checkout@v3
- 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 到 EOF 之间粘贴你的编译配置, 需注意缩进关系
# 例如:
cat >> .config <<EOF
CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt7621=y
CONFIG_TARGET_ramips_mt7621_DEVICE_phicomm_k2p=y
CONFIG_PACKAGE_UnblockNeteaseMusic-Go=y
CONFIG_PACKAGE_ebtables=y
CONFIG_PACKAGE_odhcp6c=y
CONFIG_PACKAGE_luci-app-unblockmusic=y
CONFIG_DEFAULT_luci-app-unblockmusic=y
CONFIG_DEFAULT_luci-app-ssr-plus=y
CONFIG_PACKAGE_luci-app-ssr-plus=y
CONFIG_PACKAGE_luci-i18n-ssr-plus-zh-cn=y
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_ShadowsocksR_Libev_Client=y
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_ShadowsocksR_Libev_Server=y
CONFIG_PACKAGE_shadowsocksr-libev-ssr-check=y
CONFIG_PACKAGE_shadowsocksr-libev-ssr-local=y
CONFIG_PACKAGE_shadowsocksr-libev-ssr-redir=y
CONFIG_PACKAGE_shadowsocksr-libev-ssr-server=y
CONFIG_PACKAGE_shadowsocks-libev-ss-local=y
CONFIG_PACKAGE_shadowsocks-libev-ss-redir=y
CONFIG_PACKAGE_shadowsocks-libev-ss-rules=y
CONFIG_PACKAGE_shadowsocks-libev-ss-server=y
CONFIG_PACKAGE_shadowsocks-libev-config=y
CONFIG_TARGET_IMAGES_GZIP=y
CONFIG_KERNEL_BUILD_USER="OpenWrt-CI"
CONFIG_KERNEL_BUILD_DOMAIN="Azure"
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/