R2S-OpenWrt #6
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
name: R2S-OpenWrt | |
on: | |
# schedule: | |
# - cron: 5 6 * * 0 | |
watch: | |
types: started | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
if: github.event.repository.owner.id == github.event.sender.id | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Show system | |
run: | | |
echo -e "Total CPU cores\t: $(nproc)" | |
cat /proc/cpuinfo | grep 'model name' | |
free -h | |
uname -a | |
[ -f /proc/version ] && cat /proc/version | |
[ -f /etc/issue.net ] && cat /etc/issue.net | |
[ -f /etc/issue ] && cat /etc/issue | |
ulimit -a | |
- name: Free disk space | |
run: | | |
sudo -E swapoff -a | |
sudo -E rm -f /swapfile | |
sudo -E docker image prune -a -f | |
sudo -E snap set system refresh.retain=2 | |
sudo -E apt-get -y purge azure* dotnet* firefox ghc* google* hhvm llvm* mono* mysql* openjdk* php* zulu* | |
sudo -E apt-get -y autoremove --purge | |
sudo -E apt-get clean | |
sudo -E rm -rf /usr/share/dotnet /usr/local/lib/android/sdk /etc/mysql /etc/php /usr/local/share/boost | |
[ -n "$AGENT_TOOLSDIRECTORY" ] && sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
df -h | |
- name: Init build dependencies | |
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 '[email protected]' | |
df -h | |
- name: Prepare Mixedwrt | |
run: | | |
sudo chown -R runner:runner /home/runner/work/R2S-R4S-X86-OpenWrt | |
cp -r ./SCRIPTS/R2S/. ./SCRIPTS/ | |
cp -r ./SCRIPTS/. ./ | |
/bin/bash 01_get_ready.sh | |
- name: Prepare Package | |
run: | | |
cd openwrt | |
cp -r ../SCRIPTS/. ./ | |
/bin/bash 02_prepare_package.sh | |
/bin/bash 02_target_only.sh | |
- name: Convert Translation | |
run: | | |
cd openwrt | |
/bin/bash 03_convert_translation.sh | |
- name: Add ACL | |
run: | | |
cd openwrt | |
/bin/bash 05_create_acl_for_luci.sh -a | |
- name: Make Config | |
run: | | |
cd openwrt | |
mv ../SEED/R2S/config.seed .config | |
make defconfig | |
- name: Smart chmod | |
run: | | |
MY_Filter=$(mktemp) | |
echo '/\.git' > ${MY_Filter} | |
echo '/\.svn' >> ${MY_Filter} | |
find ./ -maxdepth 1 | grep -v '\./$' | grep -v '/\.git' | xargs -s1024 chmod -R u=rwX,og=rX | |
find ./ -type f | grep -v -f ${MY_Filter} | xargs -s1024 file | grep 'executable\|ELF' | cut -d ':' -f1 | xargs -s1024 chmod 755 | |
rm -f ${MY_Filter} | |
unset MY_Filter | |
- name: Make Download | |
run: | | |
df -h | |
cd openwrt | |
make download -j50 | |
- name: Make Toolchain | |
run: | | |
df -h | |
cd openwrt | |
let make_process=$(nproc)+2 | |
make toolchain/install -j${make_process} V=s | |
- name: Compile Openwrt | |
id: compileopenwrt | |
continue-on-error: true | |
run: | | |
df -h | |
cd openwrt | |
let Make_Process=$(nproc)+2 | |
make -j${Make_Process} V=w | |
echo $? | |
- name: If Error | |
if: steps.compileopenwrt.outcome == 'failure' | |
run: | | |
cat openwrt/.config | |
echo '================================================================' | |
cd openwrt && make -j1 V=s | |
- name: Print Disk Space After | |
run: df -h | |
- 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 --best *.img | |
ls -Ahl | |
sha256sum openwrt*r2s* | tee R2S-GC404-$(date +%Y-%m-%d)-21.02.sha256sum | |
# zip R2S-GC404-$(date +%Y-%m-%d)-21.02-ext4.zip *r2s*ext4* | |
# zip R2S-GC404-$(date +%Y-%m-%d)-21.02-sfs.zip *r2s*squashfs* | |
# ls -Ahl | |
- name: Upload artifact | |
uses: actions/upload-artifact@main | |
with: | |
name: OpenWRT_21.02 | |
path: ./artifact/ | |
#- name: Create release | |
# id: create_release | |
# uses: ncipollo/[email protected] | |
# with: | |
# name: OpenWRT-R2S-R4S-X86-21.02.0-RC3 | |
# allowUpdates: true | |
# tag: 21.02.0-rc3 | |
# commit: master | |
# replacesArtifacts: true | |
# token: ${{ secrets.workflow_token }} | |
# artifacts: ./artifact/*.zip |