show disk usage when failed #164
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: OpenWrt for x86 | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'CHANGELOG.md' | |
- '.github/workflows/x86-OpenWrt.yml' | |
env: | |
UPLOAD_FIRMWARE: true | |
TZ: Asia/Shanghai | |
MYOPENWRTTARGET: x86 | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
if: github.event.repository.owner.id == github.event.sender.id | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: 'master' | |
- name: Show system | |
run: | | |
echo -e "Total CPU cores\t: $(nproc)" | |
grep 'model name' /proc/cpuinfo | |
free -h | |
uname -a | |
[ -f /proc/version ] && cat /proc/version | |
[ -f /etc/issue.net ] && cat /etc/issue.net | |
- name: Free disk space | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
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 -qq --fix-missing update | |
sudo -E apt-get -qq -y --fix-missing purge dotnet* google* llvm* mono* mysql* php* zulu* | |
sudo -E apt-get -qq -y --fix-missing autoremove --purge | |
sudo -E rm -rf /usr/share/dotnet /usr/local/lib/android /etc/mysql /etc/php | |
df -h | |
- name: Init build dependencies | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo -E rm -rf /etc/apt/sources.list.d/* | |
sudo -E apt-get -qq --fix-missing update | |
sudo -E apt-get -qq --fix-missing install -y antlr3 aria2 asciidoc autoconf automake autopoint bash binutils build-essential bzip2 ccache clang cmake coreutils cpio curl device-tree-compiler diffutils dwarves findutils flex g++ g++-multilib gawk gcc gcc-multilib genisoimage gettext git gnutls-dev gperf grep gzip help2man intltool jq lib32gcc-s1 libc6-dev-i386 libelf-dev libglib2.0-dev libncurses-dev libreadline-dev libssl-dev libthread-queue-any-perl libtool libusb-dev lld llvm lrzsz make msmtp nano p7zip-full patch perl perl-modules python2-dev python3-dev python3-pip python3-ply python3-pyelftools qemu-utils rsync scons subversion swig texinfo time unzip upx-ucl util-linux vim wget xsltproc xxd zlib1g-dev | |
sudo -E pip3 install pylibfdt | |
sudo -E apt-get -qq clean | |
git config --global user.name 'GitHub Actions' && git config --global user.email '[email protected]' | |
df -h | |
- name: Prepare OpenWrt | |
run: | | |
sudo chown -R runner:docker ./ | |
cp -f ./SCRIPTS/01_get_ready.sh ./01_get_ready.sh | |
echo "FMDATETIME=$(date '+%Y%m%d-%H%M')" >> $GITHUB_ENV | |
/bin/bash ./01_get_ready.sh | |
- name: Prepare Package | |
run: | | |
cp -f ./SCRIPTS/*.sh ./openwrt/ | |
cd openwrt | |
/bin/bash ./02_prepare_package.sh | |
- name: Remove Upx | |
run: | | |
cd openwrt | |
/bin/bash ./03_remove_upx.sh | |
- name: Convert Translation | |
run: | | |
cd openwrt | |
/bin/bash ./04_convert_translation.sh | |
- name: Add ACL | |
run: | | |
cd openwrt | |
/bin/bash ./05_create_acl_for_luci.sh -a | |
- name: Make Config | |
run: | | |
cd openwrt | |
cp -f ../SEED/x86.config.seed .config | |
cat ../SEED/more.seed >> .config | |
make defconfig | |
- name: Make Download | |
run: | | |
df -h | |
cd openwrt && make download -j$(($(nproc) * 8)) | |
echo $? | |
- name: Make Toolchain | |
id: maketoolchain | |
continue-on-error: true | |
run: | | |
df -h | |
cd openwrt && make toolchain/install -j$(($(nproc) + 1)) | |
echo $? | |
/bin/ls -AF staging_dir/toolchain-*/bin/ | |
- name: If Toolchain Error | |
if: steps.maketoolchain.outcome == 'failure' | |
run: | | |
df -h | |
cd openwrt && make toolchain/install -j1 V=s | |
- name: Compile OpenWrt | |
id: compileopenwrt | |
continue-on-error: true | |
run: | | |
df -h | |
cd openwrt && make -j$(($(nproc) + 1)) V=w | |
echo $? | |
- name: If Compiling Error | |
if: steps.compileopenwrt.outcome == 'failure' | |
run: | | |
df -h | |
cat openwrt/.config | |
echo '================================================================' | |
cd openwrt && make -j1 V=s | |
- name: Cleaning and hashing | |
run: | | |
rm -rf ./artifact && mkdir -p ./artifact | |
cd ./artifact | |
echo "FIRMWAREDIR=$(pwd)" >> $GITHUB_ENV | |
cd ../openwrt | |
cp -f .config ../artifact/kconfig-full | |
/bin/bash ./scripts/diffconfig.sh > ../artifact/kconfig-lite | |
cd bin/targets/x86/64 | |
ls -Ahl | |
/bin/bash ../../../../../SCRIPTS/06_cleaning.sh | |
mv -f ./* ../../../../../artifact/ | |
echo "status=success" >> $GITHUB_OUTPUT | |
- name: Upload Firmwares | |
uses: actions/upload-artifact@v3 | |
if: env.UPLOAD_FIRMWARE == 'true' && ${{ success() }} | |
with: | |
name: OpenWrt_x86_${{ env.FMDATETIME }} | |
path: ${{ env.FIRMWAREDIR }} |