diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2e1c39e7..c58c6a9b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,42 +50,29 @@ jobs: build: runs-on: ubuntu-latest - needs: smoke-tests - - container: ghcr.io/pi-hole/ftl-build:v1.28-${{ matrix.arch }} - + container: ghcr.io/pi-hole/ftl-build:v2.0 strategy: fail-fast: false - matrix: include: - - arch: x86_64 - bin_name: pihole-FTL-linux-x86_64 - - arch: x86_64 - arch_extra: _full - bin_name: pihole-FTL-linux-x86_64_full - - arch: x86_64-musl - bin_name: pihole-FTL-musl-linux-x86_64 - - arch: x86_32 - bin_name: pihole-FTL-linux-x86_32 - - arch: armv4t - bin_name: pihole-FTL-armv4-linux-gnueabi - - arch: armv5te - bin_name: pihole-FTL-armv5-linux-gnueabi - - arch: armv6hf - bin_name: pihole-FTL-armv6-linux-gnueabihf - - arch: armv7hf - bin_name: pihole-FTL-armv7-linux-gnueabihf - - arch: armv8a - bin_name: pihole-FTL-armv8-linux-gnueabihf - - arch: aarch64 - bin_name: pihole-FTL-aarch64-linux-gnu - - arch: riscv64 - bin_name: pihole-FTL-riscv64-linux-gnu + - platform: linux/amd64 + bin_name: pihole-FTL-amd64 + - platform: linux/386 + bin_name: pihole-FTL-386 + - platform: linux/arm/v6 + bin_name: pi-hole-FTL-armv6 + - platform: linux/arm/v7 + bin_name: pi-hole-FTL-armv7 + - platform: linux/arm64/v8 + bin_name: pi-hole-FTL-arm64 + - platform: linux/riscv64 + bin_name: pi-hole-FTL-riscv64 env: - CI_ARCH: ${{ matrix.arch }}${{ matrix.arch_extra }} + CI_ARCH: ${{ matrix.platform }} + GIT_BRANCH: ${{ needs.smoke-tests.outputs.GIT_BRANCH }} + GIT_TAG: ${{ needs.smoke-tests.outputs.GIT_TAG }} steps: - @@ -95,13 +82,22 @@ jobs: name: "Fix ownership of repository" run: chown -R root . - - name: "Fix ownership of repository" - run: chown -R root . + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Build and push + uses: docker/build-push-action@v3 + with: + # tags: ghcr.io/pi-hole/ftl-build:v2.0 + platforms: ${{ matrix.platform }} + # Always load latest container image + pull: true + # Do not push anything + push: false + # Load into daemon for subsequent steps + load: true - name: "Build" - env: - GIT_BRANCH: ${{ needs.smoke-tests.outputs.GIT_BRANCH }} - GIT_TAG: ${{ needs.smoke-tests.outputs.GIT_TAG }} run: | bash build.sh "-DSTATIC=${STATIC}" - @@ -109,8 +105,7 @@ jobs: run: | bash test/arch_test.sh - - name: "Test x86_32/64 binaries" - if: matrix.arch == 'x86_64' || matrix.arch == 'x86_64-musl' || matrix.arch == 'x86_32' + name: "Test binaries" run: | bash test/run.sh - @@ -127,11 +122,11 @@ jobs: path: '${{ matrix.bin_name }}*' - name: Tar documentation files - if: github.event_name != 'pull_request' && matrix.arch == 'x86_64' + if: github.event_name != 'pull_request' && matrix.platform == 'linux/amd64' run: tar -C src/api/docs/content/ -czvf api-docs.tar.gz . - name: Upload documentation artifacts for deployoment - if: github.event_name != 'pull_request' && matrix.arch == 'x86_64' + if: github.event_name != 'pull_request' && matrix.platform == 'linux/amd64' uses: actions/upload-artifact@v3.1.1 with: name: tmp-storage diff --git a/test/arch_test.sh b/test/arch_test.sh index 3ec0046e..bb88b75c 100644 --- a/test/arch_test.sh +++ b/test/arch_test.sh @@ -73,85 +73,53 @@ check_static() { echo "Static executable check: OK" } -if [[ "${CI_ARCH}" == "x86_64" || "${CI_ARCH}" == "x86_64_full" ]]; then - - check_machine "ELF64" "Advanced Micro Devices X86-64" - if [[ "${CI_ARCH}" == "x86_64_full" ]]; then - check_libs "[libm.so.6] [librt.so.1] [libdbus-1.so.3] [libmnl.so.0] [libnftables.so.1] [libnftnl.so.11] [libnfnetlink.so.0] [libnetfilter_conntrack.so.3] [libpthread.so.0] [libc.so.6]" - else - check_libs "[libm.so.6] [librt.so.1] [libpthread.so.0] [libc.so.6]" - fi - check_file "ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, with debug_info, not stripped" - -elif [[ "${CI_ARCH}" == "x86_64-musl" ]]; then +if [[ "${CI_ARCH}" == "linux/amd64" ]]; then check_machine "ELF64" "Advanced Micro Devices X86-64" check_static # Binary should not rely on any dynamic interpreter check_libs "" # No dependency on any shared library is intended check_file "ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped" -elif [[ "${CI_ARCH}" == "x86_32" ]]; then +elif [[ "${CI_ARCH}" == "linux/386" ]]; then check_machine "ELF32" "Intel 80386" - check_libs "[libm.so.6] [librt.so.1] [libpthread.so.0] [libc.so.6]" - check_file "ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 3.2.0, with debug_info, not stripped" + check_static # Binary should not rely on any dynamic interpreter + check_libs "" # No dependency on any shared library is intended + check_file "ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, with debug_info, not stripped" -elif [[ "${CI_ARCH}" == "aarch64" ]]; then +elif [[ "${CI_ARCH}" == "linux/arm64/v8" || "${CI_ARCH}" == "linux/arm64" ]]; then check_machine "ELF64" "AArch64" - check_libs "[libm.so.6] [librt.so.1] [libpthread.so.0] [libc.so.6] [ld-linux-aarch64.so.1]" + check_static # Binary should not rely on any dynamic interpreter + check_libs "" # No dependency on any shared library is intended check_file "ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, with debug_info, not stripped" -elif [[ "${CI_ARCH}" == "armv4t" ]]; then +elif [[ "${CI_ARCH}" == "linux/arm/v6" ]]; then check_machine "ELF32" "ARM" - check_libs "[libm.so.6] [librt.so.1] [libgcc_s.so.1] [libpthread.so.0] [libc.so.6] [ld-linux.so.3]" - check_file "ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 3.2.0, not stripped" - - check_CPU_arch "v4T" - check_FP_arch "" # No specified FP arch - -elif [[ "${CI_ARCH}" == "armv5te" ]]; then - - check_machine "ELF32" "ARM" - check_libs "[libm.so.6] [librt.so.1] [libgcc_s.so.1] [libpthread.so.0] [libc.so.6] [ld-linux.so.3]" - check_file "ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 3.2.0, with debug_info, not stripped" - - check_CPU_arch "v5TE" - check_FP_arch "" # No specified FP arch - -elif [[ "${CI_ARCH}" == "armv6hf" ]]; then - - check_machine "ELF32" "ARM" - check_libs "[libm.so.6] [librt.so.1] [libgcc_s.so.1] [libpthread.so.0] [libc.so.6] [ld-linux-armhf.so.3]" - check_file "ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, with debug_info, not stripped" + check_static # Binary should not rely on any dynamic interpreter + check_libs "" # No dependency on any shared library is intended + check_file "ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped" check_CPU_arch "v6" check_FP_arch "VFPv2" -elif [[ "${CI_ARCH}" == "armv7hf" ]]; then +elif [[ "${CI_ARCH}" == "linux/arm/v7" ]]; then check_machine "ELF32" "ARM" - check_libs "[libm.so.6] [librt.so.1] [libgcc_s.so.1] [libpthread.so.0] [libc.so.6] [ld-linux-armhf.so.3]" - check_file "ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, with debug_info, not stripped" + check_static # Binary should not rely on any dynamic interpreter + check_libs "" # No dependency on any shared library is intended + check_file "ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped" check_CPU_arch "v7" check_FP_arch "VFPv3-D16" -elif [[ "${CI_ARCH}" == "armv8a" ]]; then - - check_machine "ELF32" "ARM" - check_libs "[libm.so.6] [librt.so.1] [libgcc_s.so.1] [libpthread.so.0] [libc.so.6] [ld-linux-armhf.so.3]" - check_file "ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, with debug_info, not stripped" - - check_CPU_arch "v8" - check_FP_arch "VFPv3-D16" - -elif [[ "${CI_ARCH}" == "riscv64" ]]; then +elif [[ "${CI_ARCH}" == "linux/riscv64" ]]; then check_machine "ELF64" "RISC-V" - check_libs "[libm.so.6] [libc.so.6] [ld-linux-riscv64-lp64d.so.1]" - check_file "ELF 64-bit LSB pie executable, UCB RISC-V, RVC, double-float ABI, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv64-lp64d.so.1, for GNU/Linux 4.15.0, with debug_info, not stripped" + check_static # Binary should not rely on any dynamic interpreter + check_libs "" # No dependency on any shared library is intended + check_file "ELF 64-bit LSB executable, UCB RISC-V, RVC, double-float ABI, version 1 (SYSV), statically linked, with debug_info, not stripped" else