Skip to content

X86-OpenWrt

X86-OpenWrt #3578

Workflow file for this run

name: X86-OpenWrt
on:
# schedule:
# - cron: 5 6 * * 0
workflow_dispatch:
watch:
types: started
jobs:
build:
runs-on: ubuntu-22.04
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Show system
run: |
echo -e "Total CPU cores\t: $(nproc)"
cat /proc/cpuinfo | grep 'model name'
cpu_name=$(cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F: '{print $2}' | sed 's/^[ \t]*//')
if [[ "$cpu_name" =~ "8370C" || "$cpu_name" =~ "7763" ]]; then
echo "CPU为8370C或7763,继续执行命令"
ulimit -a
else
echo "CPU不为8370C或7763,性能不足,停止执行命令"
exit 1
fi
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
swap-size-mb: 512
temp-reserve-mb: 128
root-reserve-mb: 3072
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
- name: Checkout
uses: actions/checkout@main
- name: Init build dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo swapoff -a
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo -E apt-get -qq update
sudo -E apt-get -qq install aria2
sudo -E wget -P /usr/local/sbin/ https://github.com/HiGarfield/lede-17.01.4-Mod/raw/master/.github/backup/apt-fast
sudo -E chmod -R 755 /usr/local/sbin/apt-fast
sudo -E apt-fast -y -qq install dos2unix dwarves quilt llvm clang lldb lld build-essential rsync asciidoc binutils bzip2 gawk gettext git libncurses5-dev patch python2.7 unzip zlib1g-dev lib32gcc-s1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib p7zip-full msmtp libssl-dev texinfo libreadline-dev libglib2.0-dev xmlto qemu-utils upx-ucl libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget ccache curl swig coreutils vim nano python3 python3-dev python3-pip python3-ply python3-pyelftools lrzsz scons
pip3 install --user -U pylibfdt
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo -E git config --global user.name 'GitHub Actions' && git config --global user.email 'noreply@github.com'
sudo -E git config --global core.abbrev auto
df -h
- name: Prepare Mixedwrt
run: |
sudo chown -R runner:runner /home/runner/work/YAOF
cp -r ./SCRIPTS/X86/. ./SCRIPTS/
cp -r ./SCRIPTS/. ./
/bin/bash 01_get_ready.sh
- name: Prepare Package
working-directory: ${{ github.workspace }}/openwrt
run: |
cp -r ../SCRIPTS/. ./
/bin/bash 02_prepare_package.sh
/bin/bash 02_target_only.sh
/bin/bash 04_remove_upx.sh
- name: QTMDFW4
working-directory: ${{ github.workspace }}/openwrt
run: |
cp -rf ../SEED/X86/config.seed .config
- name: Convert Translation
working-directory: ${{ github.workspace }}/openwrt
run: |
/bin/bash 03_convert_translation.sh
- name: Add ACL
working-directory: ${{ github.workspace }}/openwrt
run: |
/bin/bash 05_create_acl_for_luci.sh -a
- name: Fix Permissions
working-directory: ${{ github.workspace }}/openwrt
run: |
sudo -E chmod -R 755 ./08_fix_permissions.sh
/bin/bash 08_fix_permissions.sh
- name: Make Config
working-directory: ${{ github.workspace }}/openwrt
run: |
make defconfig
- name: Get Architecture
working-directory: ${{ github.workspace }}/openwrt
run: |
TARGET_DEVICE_ARCH="$(grep "^CONFIG_TARGET_.*_.*=y$" ".config" | head -n 1 | sed 's/^CONFIG_TARGET_//g' | awk -F '_' '{print $1}')"
echo "TARGET_DEVICE_ARCH=${TARGET_DEVICE_ARCH}" >>$GITHUB_ENV
latest_release="$(curl -s https://github.com/openwrt/openwrt/tags | grep -Eo "v[0-9\.]+\-*r*c*[0-9]*.tar.gz" | sed -n '/[2-9][3-9]/p' | sed -n 1p | sed 's/.tar.gz//g' | sed 's/v//g')"
echo "latest_release=${latest_release}" >>$GITHUB_ENV
- name: Cache
uses: HiGarfield/cachewrtbuild@main
with:
mixkey: ${{ env.TARGET_DEVICE_ARCH }}
prefix: ${{ github.workspace }}/openwrt
- name: Make Download
working-directory: ${{ github.workspace }}/openwrt
run: |
make download -j50
- name: Compile Openwrt
working-directory: ${{ github.workspace }}/openwrt
id: compileopenwrt
continue-on-error: true
run: |
#echo | make kernel_oldconfig -j$(($(nproc) + 1))
IGNORE_ERRORS=1 make -j$(($(nproc) + 1))
echo $?
- name: If Error
working-directory: ${{ github.workspace }}/openwrt
if: steps.compileopenwrt.outcome == 'failure'
run: |
cat ./.config
echo '================================================================'
make -j1 V=s
- name: Organize files
id: organize
run: |
rm -rf ./artifact/
mkdir -p ./artifact/
mv openwrt/bin/targets/x86/64/*combined-efi.img* ./artifact/
cd ./artifact/
ls -Ahl
gzip -d *.gz && exit 0
gzip --best *.img
ls -Ahl
sha256sum openwrt*x86* | tee X86-GC404-$(date +%Y-%m-%d)-${{ env.latest_release }}.sha256sum
zip X86-GC404-Docker-$(date +%Y-%m-%d)-${{ env.latest_release }}-ext4.zip *ext4-combined*
zip X86-GC404-Docker-$(date +%Y-%m-%d)-${{ env.latest_release }}-sfs.zip *squashfs-combined*
ls -Ahl
- name: Create release
id: create_release
uses: ncipollo/release-action@main
with:
name: OpenWRT-${{ env.latest_release }}
allowUpdates: true
prerelease: false
tag: ${{ env.latest_release }}
commit: 23.05
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: ./artifact/*.zip
- name: Print Disk Space After
run: df -h