This repository has been archived by the owner on Jul 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
146 lines (132 loc) · 8.01 KB
/
massdns_builder.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
name: Build Massdns Binaries
on:
workflow_dispatch:
schedule:
- cron: "0 21 * * 6" # 09:00 PM UTC Every Saturday --> 02:45 AM Nepal Time Every Sunday
jobs:
build:
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: Install build dependencies
run: "\
sudo apt-get update\n
sudo apt-get install -y --no-install-recommends bison build-essential ca-certificates flex file pkg-config qemu-system qemu-user qemu-user-static wget \n"
- name: Setup Env
run: |
# Create Output Dir
mkdir -p "$GITHUB_WORKSPACE/main/massdns"
- name: Build --> linux-arm64-aarch64-gcc
run: |
# git clone
cd $(mktemp -d) && git clone https://github.com/blechschmidt/massdns
# Mark Safe
git config --global --add safe.directory $(pwd)
# Add static flag
sed -i 's/$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(PROJECT_FLAGS) -O3 -std=c11 -DHAVE_EPOLL -DHAVE_SYSINFO -Wall -fstack-protector-strong src\/main.c/$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(PROJECT_FLAGS) -O3 -std=c11 -DHAVE_EPOLL -DHAVE_SYSINFO -Wall -fstack-protector-strong src\/main.c -s -static/g' "./massdns/Makefile"
# Build
docker run --privileged -v $(pwd):/work dockcross/linux-arm64 bash -c "git config --global --add safe.directory /work/massdns ; cd ./massdns && make -j$(($(nproc)+1)) ; echo && chmod +x ./bin/massdns && ./bin/massdns --help ; echo"
# Move Bin
sudo mv ./massdns/bin/massdns "$GITHUB_WORKSPACE/main/massdns/massdns_linux_arm64_aarch64_gcc"
# Remove tmp files
#rm -rf /tmp >/dev/null 2>&1
continue-on-error: true
- name: Build --> linux-arm64-aarch64-musl
run: |
# git clone
cd $(mktemp -d) && git clone https://github.com/blechschmidt/massdns
# Mark Safe
git config --global --add safe.directory $(pwd)
# Add static flag
sed -i 's/$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(PROJECT_FLAGS) -O3 -std=c11 -DHAVE_EPOLL -DHAVE_SYSINFO -Wall -fstack-protector-strong src\/main.c/$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(PROJECT_FLAGS) -O3 -std=c11 -DHAVE_EPOLL -DHAVE_SYSINFO -Wall -fstack-protector-strong src\/main.c -s -static/g' "./massdns/Makefile"
# Build
docker run --privileged -v $(pwd):/work dockcross/linux-arm64-musl bash -c "git config --global --add safe.directory /work/massdns ; cd ./massdns && make -j$(($(nproc)+1)) ; echo && chmod +x ./bin/massdns && ./bin/massdns --help ; echo"
sudo mv ./massdns/bin/massdns "$GITHUB_WORKSPACE/main/massdns/massdns_linux_arm64_aarch64_musl"
# Remove tmp files
#rm -rf /tmp >/dev/null 2>&1
continue-on-error: true
#Compiling for 32bit fails
# - name: Build --> linux-x86-gcc
# run: |
# # git clone
# cd $(mktemp -d) && git clone https://github.com/blechschmidt/massdns
# # Mark Safe
# git config --global --add safe.directory $(pwd)
# # Add static flag
# sed -i 's/$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(PROJECT_FLAGS) -O3 -std=c11 -DHAVE_EPOLL -DHAVE_SYSINFO -Wall -fstack-protector-strong src\/main.c/$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(PROJECT_FLAGS) -O3 -std=c11 -DHAVE_EPOLL -DHAVE_SYSINFO -Wall -fstack-protector-strong src\/main.c -s -static/g' "./massdns/Makefile"
# # Build
# docker run --privileged -v $(pwd):/work dockcross/linux-x86 bash -c "git config --global --add safe.directory /work/massdns ; cd ./massdns && make -j$(($(nproc)+1)) ; echo && chmod +x ./bin/massdns && ./bin/massdns --help ; echo"
# sudo mv ./massdns/bin/massdns "$GITHUB_WORKSPACE/main/massdns/massdns_linux_x86_gcc"
# # Remove tmp files
# #rm -rf /tmp >/dev/null 2>&1
# continue-on-error: true
- name: Build --> linux-x86-64-gcc
run: |
# git clone
cd $(mktemp -d) && git clone https://github.com/blechschmidt/massdns
# Mark Safe
git config --global --add safe.directory $(pwd)
# Add static flag
sed -i 's/$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(PROJECT_FLAGS) -O3 -std=c11 -DHAVE_EPOLL -DHAVE_SYSINFO -Wall -fstack-protector-strong src\/main.c/$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(PROJECT_FLAGS) -O3 -std=c11 -DHAVE_EPOLL -DHAVE_SYSINFO -Wall -fstack-protector-strong src\/main.c -s -static/g' "./massdns/Makefile"
# Build
docker run --privileged -v $(pwd):/work dockcross/linux-x64 bash -c "git config --global --add safe.directory /work/massdns ; cd ./massdns && make -j$(($(nproc)+1)) ; echo && chmod +x ./bin/massdns && ./bin/massdns --help ; echo"
sudo mv ./massdns/bin/massdns "$GITHUB_WORKSPACE/main/massdns/massdns_linux_x86_64_gcc"
# Remove tmp files
#rm -rf /tmp >/dev/null 2>&1
continue-on-error: true
- name: Build --> linux-s390x-gcc
run: |
# git clone
cd $(mktemp -d) && git clone https://github.com/blechschmidt/massdns
# Mark Safe
git config --global --add safe.directory $(pwd)
# Add static flag
sed -i 's/$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(PROJECT_FLAGS) -O3 -std=c11 -DHAVE_EPOLL -DHAVE_SYSINFO -Wall -fstack-protector-strong src\/main.c/$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(PROJECT_FLAGS) -O3 -std=c11 -DHAVE_EPOLL -DHAVE_SYSINFO -Wall -fstack-protector-strong src\/main.c -s -static/g' "./massdns/Makefile"
# Build
docker run --privileged -v $(pwd):/work dockcross/linux-s390x bash -c "git config --global --add safe.directory /work/massdns ; cd ./massdns && make -j$(($(nproc)+1)) ; echo && chmod +x ./bin/massdns && ./bin/massdns --help ; echo"
sudo mv ./massdns/bin/massdns "$GITHUB_WORKSPACE/main/massdns/massdns_linux_s390x_gcc"
# Remove tmp files
#rm -rf /tmp >/dev/null 2>&1
continue-on-error: true
- name: Update README.md
run: |
cd "$GITHUB_WORKSPACE/main"
cat ./massdns/INFO.md > ./massdns/README.md
echo -e "" >> ./massdns/README.md
echo '---' >> ./massdns/README.md
echo '```console' >> ./massdns/README.md
/bin/bash -c 'PS4="$ "; set -x; file ./massdns/massdns_*' &>> ./massdns/README.md
echo -e "" >> ./massdns/README.md
echo -e "--> SHA256SUM" >> ./massdns/README.md
/bin/bash -c 'PS4="$ "; set -x; sha256sum ./massdns/massdns_*' &>> ./massdns/README.md
echo -e '```\n' >> ./massdns/README.md
echo -e "" >> ./massdns/README.md
echo '---' >> ./massdns/README.md
echo -e "" >> ./massdns/README.md
echo '- #### Sizes' >> ./massdns/README.md
echo -e "" >> ./massdns/README.md
echo '```console' >> ./massdns/README.md
/bin/bash -c 'PS4="$ ";ls -lh ./massdns | awk "{print \$5, \$9}" | column -t' &>> ./massdns/README.md
echo '```' >> ./massdns/README.md
echo -e "" >> ./massdns/README.md
echo '---' >> ./massdns/README.md
echo -e "" >> ./massdns/README.md
working-directory: main
continue-on-error: true
- name: Git Pull
run: |
cd "$GITHUB_WORKSPACE/main" && git pull origin main
continue-on-error: true
- 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: Cross-Compile MassDNS Binaries
#push_options: '--force'