Skip to content

OpenWRT-snapshot

OpenWRT-snapshot #557

#=================================================
# Description: Build OpenWrt using GitHub Actions
# Lisence: MIT
name: OpenWRT-snapshot
on:
# release:
# types: published
push:
branches:
- master
paths:
- '.github/workflows/openwrt-rockchip.yml'
- 'step/01-prepare_package.sh'
- 'step/00-prepare_5.10.sh'
- 'seed/rockchip.seed'
schedule:
- cron: 35 20 * * 2,5
watch:
types: started
jobs:
openwrt-master:
runs-on: ubuntu-18.04
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Checkout
uses: actions/checkout@main
- name: Show CPU Model and Free Space
run: |
echo -e "Total CPU cores\t: $(nproc)"
cat /proc/cpuinfo | grep 'model name'
free -h
- name: Set env
run: |
echo "SSH_ACTIONS=false" >> $GITHUB_ENV
echo "UPLOAD_BIN_DIR=false" >> $GITHUB_ENV
echo "UPLOAD_FIRMWARE=true" >> $GITHUB_ENV
echo "UPLOAD_RELEASE=true" >> $GITHUB_ENV
echo "TZ=Asia/Shanghai" >>$GITHUB_ENV
echo "Build_Date=$(date +%Y.%m.%d)" >> $GITHUB_ENV
- name: Show env
run: echo $GITHUB_ENV
- name: free disk space
run: |
df -h
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker rmi $(docker image ls -aq)
df -h
/bin/bash ./script/free_disk_space.sh
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E rm -rf /etc/apt/sources.list.d
sudo -E apt-get update -y
sudo -E apt-get install -y build-essential rsync asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core p7zip p7zip-full msmtp libssl-dev texinfo libreadline-dev libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint ccache curl wget vim nano python3 python3-pip python3-ply haveged lrzsz device-tree-compiler scons
wget -qO - https://raw.githubusercontent.com/friendlyarm/build-env-on-ubuntu-bionic/master/install.sh | sed 's/python-/python3-/g' | /bin/bash
sudo -E apt-get clean -y
git config --global user.name 'GitHub Actions' && git config --global user.email 'noreply@github.com'
df -h
- name: Install OpenWrt source
run: |
git clone -b master --single-branch https://git.openwrt.org/openwrt/openwrt.git openwrt
- name: Prepare openwrt
run: |
cd openwrt
cp -r ../step/* ./
/bin/bash 00-prepare_5.10.sh
- name: Prepare application packages
run: |
cd openwrt
/bin/bash 01-prepare_package.sh
- name: Add ACL
run: |
cd openwrt
/bin/bash 03-create_acl_for_luci.sh -a
- name: Load Multiple devices Config
run: |
cd openwrt
mv ../seed/rockchip.seed .config
make defconfig
cp .config rockchip_multi.config
# - name: Download package
# id: package
# run: |
# cd openwrt
# make download -j10
# find dl -size -1024c -exec ls -l {} \;
# find dl -size -1024c -exec rm -f {} \;
#
# - name: Make toolchain-aarch64
# id: compiletoolchain
# continue-on-error: true
# run: |
# cd openwrt
# let make_process=$(nproc)+1
# make toolchain/install -j${make_process} V=s
# - name: If toolchain Error
# if: steps.compiletoolchain.outcome == 'failure'
# run: |
# echo '================================================================'
# cd openwrt && make toolchain/install -j1 V=s
- name: Compile OpenWRT for R2S & R4S & R1 plus
id: compileopenwrt
continue-on-error: true
run: |
cd openwrt
let make_process=$(nproc)+1
make -j${make_process} V=s || make -j${make_process} V=s
- name: If compile openwrt Error
if: steps.compileopenwrt.outcome == 'failure'
run: |
cat openwrt/.config
echo '================================================================'
cd openwrt && make -j1 V=s
- name: Organize files
id: organize
run: |
rm -rf ./artifact/
mkdir -p ./artifact/
mv openwrt/bin/targets/rockchip/armv8/*sysupgrade.img* ./artifact/
cd ./artifact/
ls -Ahl
gzip -d *.gz && exit 0
gzip *.img
sha256sum openwrt*r2s* | tee R2S-QC-$(date +%Y-%m-%d).sha256sum
sha256sum openwrt*r4s* | tee R4S-QC-$(date +%Y-%m-%d).sha256sum
sha256sum openwrt*r1-plus* | tee R1-plus-QC-$(date +%Y-%m-%d).sha256sum
ls -Ahl
zip R2S-QC-$(date +%Y-%m-%d)-snapshot.zip *r2s* R2S*.sha256sum
zip R4S-QC-$(date +%Y-%m-%d)-snapshot.zip *r4s* R4S*.sha256sum
zip R1-plus-QC-$(date +%Y-%m-%d)-snapshot.zip *r1-plus* R1-plus*.sha256sum
cp ../openwrt/*.config ./
ls -Ahl
- name: Upload artifact master
uses: actions/upload-artifact@main
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
with:
name: OpenWRT_NanoPi_firmware
path: ./artifact/*.zip
- name: Compile OpenWRT for kernel 5.14
id: compile514
run: |
cd openwrt
/bin/bash 04-k5.14.sh
mv ../seed/k514.seed .config
make defconfig
let make_process=$(nproc)+1
make -j${make_process} V=s || make -j${make_process} V=s
- name: If compile openwrt 5.14 Error
if: steps.compile514.outcome == 'failure'
run: |
cat openwrt/.config
echo '================================================================'
cd openwrt && make -j1 V=s
- name: Organize k5.14 files
id: organize514
run: |
rm -rf ./artifact514/
mkdir -p ./artifact514/
mv openwrt/bin/targets/rockchip/armv8/*sysupgrade.img* ./artifact514/
cd ./artifact514/
ls -Ahl
gzip -d *.gz && exit 0
gzip *.img
sha256sum openwrt*r2s* | tee R2S-QC-k514.sha256sum
sha256sum openwrt*r4s* | tee R4S-QC-k514.sha256sum
sha256sum openwrt*r1-plus* | tee R1-plus-QC-k514.sha256sum
ls -Ahl
zip R2S-QC-$(date +%Y-%m-%d)-k514.zip *r2s* R2S*.sha256sum
zip R4S-QC-$(date +%Y-%m-%d)-k514.zip *r4s* R4S*.sha256sum
zip R1-plus-QC-$(date +%Y-%m-%d)-k514.zip *r1-plus* R1-plus*.sha256sum
ls -Ahl
- name: Upload k5.14 firmware
uses: actions/upload-artifact@main
with:
name: openwrt kernel 5.14 firmware
path: ./artifact514/*.zip
- name: Create release for master
id: create_release
uses: ncipollo/release-action@v1.8.8
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
with:
name: OpenWRT-rockchip-kernel 5.10 daily update
allowUpdates: true
tag: snapshot
commit: master
replacesArtifacts: true
token: ${{ secrets.RELEASES_TOKEN }}
bodyFile: "body-origin.md"
artifacts: ./artifact/*.zip,./artifact/*.config
Cleanup-Old-Artifacts:
needs: [openwrt-master]
runs-on: ubuntu-18.04
steps:
- name: Cleanup Old Action Artifacts
uses: kolpav/purge-artifacts-action@v1
with:
token: ${{ github.token }}
expire-in: 14d
Cleanup-Workflow-Runs:
needs: Cleanup-Old-Artifacts
runs-on: ubuntu-18.04
steps:
- name: Cleanup Workflow Runs
uses: GitRML/delete-workflow-runs@v1.2.1
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 14