-
Notifications
You must be signed in to change notification settings - Fork 17
244 lines (223 loc) · 10.3 KB
/
build_weekly_toolpack_aarch64_arm64.yaml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
name: 🛍️ Build ⚙️ Weekly (toolpack_aarch64_arm64) Binaries 📦🗄️
#MAX_RUNTIME:
on:
workflow_dispatch:
schedule:
#- cron: "0 1 * * *" # 06:45 AM NPT Mrng Every Day
- cron: "0 0 */2 * *" #Every 2 days (48 Hr)
env:
GITHUB_TOKEN: ${{ secrets.TOOLPACKS }}
jobs:
#------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------#
build-fetch-binaries:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
filter: "blob:none" #https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
- name: Debloat Runner
run: |
#Presets
set -x ; set +e
#--------------#
#12.0 GB
sudo rm /usr/local/lib/android -rf 2>/dev/null
#8.2 GB
sudo rm /opt/hostedtoolcache/CodeQL -rf 2>/dev/null
#5.0 GB
sudo rm /usr/local/.ghcup -rf 2>/dev/null
#2.0 GB
sudo rm /usr/share/dotnet -rf 2>/dev/null
#1.7 GB
sudo rm /usr/share/swift -rf 2>/dev/null
#1.1 GB
#sudo rm /usr/local/lib/node_modules -rf 2>/dev/null
#1.0 GB
sudo rm /usr/local/share/powershell -rf 2>/dev/null
#500 MB
sudo rm /usr/local/lib/heroku -rf 2>/dev/null
continue-on-error: true
- name: Install CoreUtils & Deps
run: |
#Presets
set -x ; set +e
#--------------#
sudo apt-get update -y
sudo apt-get install automake b3sum build-essential ca-certificates ccache lzip jq make musl musl-dev musl-tools p7zip-full wget -y
sudo apt-get install -y --no-install-recommends autoconf automake autopoint binutils bison build-essential ca-certificates flex file jq patch patchelf pkg-config python3-pip qemu-user-static wget
#Bin Utils
sudo apt install binutils-aarch64-linux-gnu -y
#libpcap
sudo apt install 'libpcap*' -y
sudo apt install 'nmap' -y
continue-on-error: true
- name: Install Build Dependencies (arm64)
run: |
#Presets
set -x ; set +e
#--------------#
sudo apt-get install -y "g++-arm-linux-gnueabi" "g++-arm-linux-gnueabihf" "g++-aarch64-linux-gnu" qemu-user-static
- name: Install PythonUtils & Deps
run: |
#Presets
set -x ; set +e
#--------------#
sudo apt-get install libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev xcb -y
pip install ansi2txt
pip install scons
pip install staticx
pip install pyinstaller
pip install py2static
pip install typer
continue-on-error: true
- name: Install CargoUtils & Deps
run: |
#Presets
set -x ; set +e
#--------------#
cargo install cross --git "https://github.com/cross-rs/cross"
continue-on-error: true
##Needed until gh runners updates go version: https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
## It helps to be on bleeding edge anyway
- name: Install/Update golang
run: |
#Presets
set -x ; set +e
#--------------#
echo "yes" | bash <(curl -qfsSL "https://git.io/go-installer")
source "$HOME/.bashrc"
go version
continue-on-error: true
- name: Install Addons
run: |
#Presets
set -x ; set +e
#--------------#
#b3sum
sudo curl -qfsSL "https://raw.githubusercontent.com/Azathothas/Toolpacks/main/x86_64/b3sum" -o "/usr/bin/b3sum" && sudo chmod +xwr "/usr/bin/b3sum"
sudo curl -qfsSL "https://raw.githubusercontent.com/Azathothas/Toolpacks/main/x86_64/b3sum" -o "/usr/local/bin/b3sum" && sudo chmod +xwr "/usr/local/bin/b3sum"
#eget
curl -qfsSL "https://zyedidia.github.io/eget.sh" | bash
sudo mv ./eget* "/usr/local/bin/eget"
sudo chmod +xwr "/usr/local/bin/eget"
continue-on-error: true
- name: Install Crystal
run: |
#https://crystal-lang.org/install/on_ubuntu/
curl -fsSL https://crystal-lang.org/install.sh | sudo bash
continue-on-error: true
- name: Install Meson & Ninja
run: |
#Presets
set -x ; set +e
#Install
sudo rm "/usr/bin/meson" "/usr/bin/ninja" 2>/dev/null
pip install meson ninja --upgrade
#python3 -m pip install meson ninja --upgrade
sudo ln -s "$HOME/.local/bin/meson" "/usr/bin/meson" 2>/dev/null
sudo ln -s "$HOME/.local/bin/ninja" "/usr/bin/ninja" 2>/dev/null
sudo chmod +xwr "/usr/bin/meson" "/usr/bin/ninja"
#version
meson --version ; ninja --version
continue-on-error: true
- name: Install 7z
run: |
#Presets
set -x ; set +e
#--------------#
cd $(mktemp -d) && curl -qfsSLJO "https://www.7-zip.org/$(curl -qfsSL "https://www.7-zip.org/download.html" | grep -o 'href="[^"]*"' | sed 's/href="//' | grep 'linux-x64.tar.xz' | sed 's/"$//' | sort | tail -n 1)"
find . -type f -name '*.xz' -exec tar -xf {} \;
#sudo rm $(which 7z) 2>/dev/null ; sudo rm $(which 7z) 2>/dev/null
sudo find . -type f -name '7zzs' ! -name '*.xz' -exec cp {} "/usr/local/bin/7z" \;
sudo chmod +xwr "/usr/local/bin/7z"
sudo find . -type f -name '7zzs' ! -name '*.xz' -exec cp {} "/usr/bin/7z" \;
sudo chmod +xwr "/usr/bin/7z"
7z -h
continue-on-error: true
- name: Install upX
run: |
cd $(mktemp -d) && curl -qfLJO "$(curl -qfsSL https://api.github.com/repos/upx/upx/releases/latest | jq -r '.assets[].browser_download_url' | grep -i 'amd64_linux')"
find . -type f -name '*tar*' -exec tar -xvf {} \;
sudo find . -type f -name 'upx' -exec mv {} "$(which upx)" \;
continue-on-error: true
- name: Setup Env
run: |
# Create Output Dir
mkdir -p "$GITHUB_WORKSPACE/main/aarch64_arm64"
- name: Download || Build Binaries
run: |
eget --rate
bash <(curl -qfsSL "https://raw.githubusercontent.com/Azathothas/Toolpacks/main/.github/scripts/eget_build_binaries_aarch64_arm64.sh")
continue-on-error: true
#------------------------------------------------------------------------------------#
- name: Update Binaries
run: |
#Copy to Repo
#Exclude copying bins > 100 MB
find "$HOME/bin" -maxdepth 1 -type f ! -size +99M -exec cp {} "$GITHUB_WORKSPACE/main/aarch64_arm64" \;
continue-on-error: true
- name: Strip || Cleanup
run: |
#Presets
set -x ; set +e
#--------------#
cd "$GITHUB_WORKSPACE/main/aarch64_arm64"
find "$GITHUB_WORKSPACE/main/aarch64_arm64/" -maxdepth 1 -type f -exec aarch64-linux-gnu-objcopy --preserve-dates --verbose --strip-all {} \; 2>/dev/null
# Strip && Rename anything with *_aarch64_arm64_Linux*
find "$GITHUB_WORKSPACE/main/aarch64_arm64" -type f -name '*_Linux' -exec sh -c 'newname=$(echo "$1" | sed "s/_aarch64_arm64_Linux//"); mv "$1" "$newname"' sh {} \;
continue-on-error: true
- name: Update README.md
run: |
#Presets
set -x ; set +e
#--------------#
cd "$GITHUB_WORKSPACE/main"
echo -e "" > "./aarch64_arm64/README.md"
echo '---' >> "./aarch64_arm64/README.md"
echo '```console' >> "./aarch64_arm64/README.md"
echo -e "" >> "./aarch64_arm64/README.md"
echo -e "--> METATDATA" >> "./aarch64_arm64/README.md"
/bin/bash -c 'PS4="$ "; file ./aarch64_arm64/* | grep -v '.txt' ' &>> "./aarch64_arm64/README.md"
echo -e "" >> ./aarch64_arm64/README.md
echo -e "--> BLAKE3SUM" >> ./aarch64_arm64/README.md
/bin/bash -c 'PS4="$ ";b3sum ./aarch64_arm64/* | grep -v '.txt' ' &>> "./aarch64_arm64/README.md"
/bin/bash -c 'PS4="$ ";b3sum ./aarch64_arm64/* | grep -v '.txt' ' &> "./aarch64_arm64/BLAKE3SUM"
echo -e "" >> ./aarch64_arm64/README.md
echo -e "--> SHA256SUM" >> "./aarch64_arm64/README.md"
/bin/bash -c 'PS4="$ ";sha256sum ./aarch64_arm64/* | grep -v '.txt' ' &>> "./aarch64_arm64/README.md"
/bin/bash -c 'PS4="$ ";sha256sum ./aarch64_arm64/* | grep -v '.txt' ' &> "./aarch64_arm64/SHA256SUM"
echo -e '```\n' >> "./aarch64_arm64/README.md"
echo -e "" >> "./aarch64_arm64/README.md"
echo '---' >> "./aarch64_arm64/README.md"
echo -e "" >> "./aarch64_arm64/README.md"
echo '- #### Sizes' >> "./aarch64_arm64/README.md"
echo -e "" >> "./aarch64_arm64/README.md"
echo '```console' >> "./aarch64_arm64/README.md"
/bin/bash -c 'PS4="$ ";ls -lh ./aarch64_arm64/* | grep -v '.txt' | awk "{print \$5, \$9}" | column -t' &>> "./aarch64_arm64/README.md"
echo -e "\n[+] Total Size: $(du -h ./aarch64_arm64 | awk '{print $1}')\n"
echo '```' >> "./aarch64_arm64/README.md"
echo -e "" >> "./aarch64_arm64/README.md"
echo '---' >> "./aarch64_arm64/README.md"
echo -e "" >> "./aarch64_arm64/README.md"
continue-on-error: true
- name: Git Pull
run: |
cd "$GITHUB_WORKSPACE/main" && git pull origin main
continue-on-error: true
- name: Get DateTime
run: |
# Date Time
NEPALI_TIME=$(TZ='Asia/Kathmandu' date +'%Y-%m-%d (%I:%M:%S %p)')
echo "NEPALI_TIME=$NEPALI_TIME" >> $GITHUB_ENV
- uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: ./main
commit_user_name: Azathothas # defaults to "github-actions[bot]"
commit_user_email: [email protected] # defaults to "41898282+github-actions[bot]@users.noreply.github.com"
commit_message: "✅ 🛍️ Fetch | Build ⚙️ Weekly (aarch64_arm64) Package 📦🗄️ <-- ${{ env.NEPALI_TIME }} ⌚"
#push_options: '--force'