Skip to content

OpenWrt-x86-64-Lean-Tiny-OP #271

OpenWrt-x86-64-Lean-Tiny-OP

OpenWrt-x86-64-Lean-Tiny-OP #271

#
# <https://github.com/KFERMercer/OpenWrt-CI>
#
# Copyright (C) 2019 P3TERX
#
# Copyright (C) 2020 KFERMercer
#
name: OpenWrt-x86-64-Lean-Tiny-OP
on:
# 定时触发(每天早4点10分)
schedule:
- cron: 10 20 * * *
# release触发
release:
types: [published]
# 点赞触发
watch:
types: [started]
# 编辑触发
# push:
# branches:
# - master
# config触发
# paths:
# - 'Tiny-OP.sh'
env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
DIY_SH: Tiny-OP.sh
TZ: Asia/Shanghai
jobs:
build_openwrt:
name: 编译OpenWrt固件
if: github.event.repository.owner.id == github.event.sender.id
runs-on: ubuntu-latest
steps:
- name: 校验本地文件
uses: actions/checkout@v2
with:
ref: master
- name: 初始化编译环境
env:
DEBIAN_FRONTEND: noninteractive
run: |
docker rmi `docker images -q`
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d
sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php* android*
sudo -E apt-get update
sudo -E apt-get -qq install -y build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib g++-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler ccache xsltproc rename antlr3 gperf wget curl swig rsync libtinfo5
sudo -E apt-get -y autoremove --purge
sudo -E apt-get clean
df -h
- name: 克隆源代码
run: |
git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt
- name: 更新时区、编译时间
id: date
run: |
sudo timedatectl set-timezone "$TZ"
echo "::set-output name=status::success"
echo "FILE_DATE=$(date +"%m-%d %H.%M")" >> $GITHUB_ENV
- name: 更新源并创建配置文件
run: |
[ -e files ] && mv files openwrt/files
chmod +x $DIY_SH
cd openwrt
../$DIY_SH
make defconfig
- name: 下载软件包
run: |
cd openwrt && make download -j8
find dl -size -1024c -exec rm -f {} \;
- name: 编译固件
run: |
cd openwrt
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 || make -j1 V=s
- name: 检查空间使用情况
run: |
echo "======================="
echo "Space usage:"
echo "======================="
df -hT
echo "======================="
du -h --max-depth=1 openwrt/ --exclude=build_dir --exclude=bin
du -h --max-depth=1 openwrt/build_dir
du -h --max-depth=1 openwrt/bin
- name: 整理文件
run: |
mkdir -p ./artifact/firmware
mkdir -p ./artifact/vmware
mkdir -p ./artifact/package
mkdir -p ./artifact/buildinfo
rm -rf $(find openwrt/bin/targets/ -type d -name "packages")
cp -rf $(find openwrt/bin/packages/ -type f -name "*.ipk") ./artifact/package/
cp -rf $(find openwrt/bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/
cp -rf $(find openwrt/bin/targets/ -type f -name "*combined*img*") ./artifact/firmware/
cp -rf $(find openwrt/bin/targets/ -type f -name "*combined*vmdk*") ./artifact/vmware/
- name: 上传固件
uses: actions/upload-artifact@v2
with:
name: OpenWrt-firmware-Lean-${{ env.FILE_DATE }}
path: ./artifact/firmware/
- name: 上传vmware镜像
uses: actions/upload-artifact@v2
with:
name: OpenWrt-vmware-Lean-${{ env.FILE_DATE }}
path: ./artifact/vmware/
- name: 上传插件包
uses: actions/upload-artifact@v2
with:
name: OpenWrt-package-Lean-${{ env.FILE_DATE }}
path: ./artifact/package/
- name: 上传固件信息
uses: actions/upload-artifact@v2
with:
name: OpenWrt-buildinfo-Lean-${{ env.FILE_DATE }}
path: ./artifact/buildinfo/