Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Build Massdns Binaries #58

Build Massdns Binaries

Build Massdns Binaries #58

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'