forked from QiuSimons/YAOF
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (125 loc) · 4.86 KB
/
X86-OpenWrt.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: X86-OpenWrt
on:
# schedule:
# - cron: 5 6 * * 0
watch:
types: started
jobs:
build:
runs-on: ubuntu-22.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'
ulimit -a
- 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 build-essential rsync asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc-s1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libreadline-dev libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget ccache curl swig coreutils vim nano python3 python3-pip python3-ply haveged lrzsz scons libpython3-dev
sudo -E pip3 install pyelftools
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'
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
run: |
cd openwrt
cp -r ../SCRIPTS/. ./
/bin/bash 02_prepare_package.sh
/bin/bash 02_target_only.sh
/bin/bash 04_remove_upx.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
cp -rf ../SEED/X86/config.seed .config
#echo -e 'CONFIG_DEVEL=y\nCONFIG_CCACHE=y' >> .config
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][0-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
run: |
cd openwrt
make download -j50
- name: Compile Openwrt
id: compileopenwrt
continue-on-error: true
run: |
cd openwrt
#echo | make kernel_oldconfig -j$(($(nproc) + 1))
make -j$(($(nproc) + 1)) || make -j$(($(nproc) + 1)) V=s
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/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: Upload artifact
uses: actions/upload-artifact@main
with:
name: OpenWRT_${{ env.latest_release }}
path: ./artifact/
- 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: 22.03
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: ./artifact/*.zip