From d85492d1135ade8affc861f3d1e817895cd099af Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 7 Mar 2024 21:19:58 +0100 Subject: [PATCH] Independent building of RISCV64 Signed-off-by: DL6ER --- .github/workflows/build.yml | 132 ++++++++++++++++++++++++++++++++++-- 1 file changed, 127 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c659c42f..20e886ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,7 +50,7 @@ jobs: [[ $FAIL == 1 ]] && exit 1 || echo "Branch name depth check passed." shell: bash - build-x68: + build-gha-x86: runs-on: ubuntu-latest needs: smoke-tests strategy: @@ -128,7 +128,83 @@ jobs: name: pihole-api-docs path: 'api-docs.tar.gz' - build-risc: + build-gha-riscv64: + runs-on: ubuntu-latest + needs: smoke-tests + strategy: + fail-fast: false + matrix: + include: + - platform: linux/riscv64 + bin_name: pihole-FTL-riscv64 + + env: + CI_ARCH: ${{ matrix.platform }} + GIT_BRANCH: ${{ needs.smoke-tests.outputs.GIT_BRANCH }} + GIT_TAG: ${{ needs.smoke-tests.outputs.GIT_TAG }} + + steps: + - + name: Checkout code + uses: actions/checkout@v4.1.1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.1.0 + - + name: Print directory contents + run: ls -l + - + name: Build and test FTL in ftl-build container (QEMU) + uses: Wandalen/wretry.action@v1.4.5 + with: + attempt_limit: 3 + action: docker/build-push-action@v5.0.0 + with: | + platforms: ${{ matrix.platform }} + pull: true + push: false + context: . + target: result + file: .github/Dockerfile + outputs: | + type=tar,dest=build.tar + build-args: | + "CI_ARCH=${{ matrix.platform }}" + "GIT_BRANCH=${{ needs.smoke-tests.outputs.GIT_BRANCH }}" + "GIT_TAG=${{ needs.smoke-tests.outputs.GIT_TAG }}" + - + name: List files in current directory + run: ls -l + - + name: Extract FTL binary from container + run: | + tar -xf build.tar pihole-FTL + - + name: "Generate checksum file" + run: | + mv pihole-FTL "${{ matrix.bin_name }}" + sha1sum pihole-FTL-* > ${{ matrix.bin_name }}.sha1 + - + name: Store binary artifacts for later deployoment + if: github.event_name != 'pull_request' + uses: actions/upload-artifact@v4.3.1 + with: + name: riscv64-${{ matrix.bin_name }}-binary + path: '${{ matrix.bin_name }}*' + - + name: Extract documentation files from container + if: github.event_name != 'pull_request' && matrix.platform == 'linux/amd64' + run: | + tar -xf build.tar api-docs.tar.gz + - + name: Upload documentation artifacts for deployoment + if: github.event_name != 'pull_request' && matrix.platform == 'linux/amd64' + uses: actions/upload-artifact@v4.3.1 + with: + name: pihole-api-docs + path: 'api-docs.tar.gz' + + build-self-hosted: runs-on: self-hosted needs: smoke-tests strategy: @@ -141,8 +217,6 @@ jobs: bin_name: pihole-FTL-armv7 - platform: linux/arm64/v8 bin_name: pihole-FTL-arm64 - - platform: linux/riscv64 - bin_name: pihole-FTL-riscv64 env: CI_ARCH: ${{ matrix.platform }} @@ -212,7 +286,7 @@ jobs: deploy: if: github.event_name != 'pull_request' - needs: [smoke-tests, build-x68, build-risc] + needs: [smoke-tests, build-gha-x86, build-self-hosted] runs-on: ubuntu-latest steps: - @@ -263,3 +337,51 @@ jobs: with: files: | ftl_builds/* + + deploy-riscv64: + if: github.event_name != 'pull_request' + needs: [smoke-tests, build-gha-riscv64] + runs-on: ubuntu-latest + steps: + - + name: Checkout code + uses: actions/checkout@v4.1.1 + - + name: Get Binaries and documentation built in previous jobs + uses: actions/download-artifact@v4.1.4 + id: download + with: + path: ftl_builds/ + pattern: riscv64-pihole-* + merge-multiple: true + - + name: Display structure of downloaded files + run: ls -R + working-directory: ${{steps.download.outputs.download-path}} + - + name: Install SSH Key + uses: benoitchantre/setup-ssh-authentication-action@1.0.1 + with: + private-key: ${{ secrets.SSH_KEY }} + known-hosts: ${{ secrets.KNOWN_HOSTS }} + - + name: Display structure of files ready for upload + run: ls -R + working-directory: ftl_builds/ + - + name: Transfer Builds to Pi-hole server for pihole checkout + if: github.actor != 'dependabot[bot]' + env: + USER: ${{ secrets.SSH_USER }} + HOST: ${{ secrets.SSH_HOST }} + TARGET_DIR: ${{ needs.smoke-tests.outputs.OUTPUT_DIR }} + SOURCE_DIR: ftl_builds/ + run: | + bash ./deploy.sh + - + name: Attach binaries to release + if: github.event_name == 'release' + uses: softprops/action-gh-release@v1 + with: + files: | + ftl_builds/*