diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index 67df008c220df..7815253143c35 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -1,5 +1,4 @@ name: Build container - on: workflow_call: inputs: @@ -8,22 +7,38 @@ on: required: true type: string file: - description: "Path to Dockerfile" + description: "Path to main Dockerfile" required: true type: string name: - description: "Container name" + description: "Main container name" + required: true + type: string + slim-file: + description: "Path to slim Dockerfile" required: true type: string + slim-name: + description: "Slim container name" + required: true + type: string + runs-on: + description: "Runner to use" + required: false + type: string + default: "ubuntu-24.04" outputs: path: - description: "Path to built container" + description: "Path to built main container" value: ghcr.io/${{ jobs.build.outputs.repo }}/${{ inputs.name }}:${{ jobs.build.outputs.tag }} + slim-path: + description: "Path to built slim container" + value: ghcr.io/${{ jobs.build.outputs.repo }}/${{ inputs.slim-name }}:${{ jobs.build.outputs.tag }} jobs: build: name: Build container - runs-on: ubuntu-24.04 + runs-on: ${{ inputs.runs-on }} outputs: tag: ${{ steps.prepare.outputs.tag }} repo: ${{ steps.prepare.outputs.repo }} @@ -51,7 +66,23 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push Docker image + - name: Build and push SLIM Docker image + uses: docker/build-push-action@v6 + with: + context: ${{ inputs.context }} + file: ${{ inputs.slim-file }} + push: true + tags: | + ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.slim-name }}:${{ hashFiles(inputs.slim-file) }} + ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.slim-name }}:${{ steps.prepare.outputs.tag }} + ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.slim-name }}:latest + cache-from: | + type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.slim-name }}:${{ hashFiles(inputs.slim-file) }} + type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.slim-name }}:${{ steps.prepare.outputs.tag }} + type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo }}/${{ inputs.slim-name }}:latest + cache-to: type=inline + + - name: Build and push MAIN Docker image uses: docker/build-push-action@v6 with: context: ${{ inputs.context }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f77a9a4d26aa7..7038ff84d903b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,20 +19,25 @@ concurrency: jobs: container: - name: Build container + name: Build containers (amd64) uses: ./.github/workflows/build-container.yml with: context: ./contrib/containers/ci file: ./contrib/containers/ci/ci.Dockerfile name: dashcore-ci-runner + slim-file: ./contrib/containers/ci/ci-slim.Dockerfile + slim-name: dashcore-ci-slim - container-slim: - name: Build slim container + container-arm64: + name: Build containers (ARM64) uses: ./.github/workflows/build-container.yml with: context: ./contrib/containers/ci - file: ./contrib/containers/ci/ci-slim.Dockerfile - name: dashcore-ci-slim + file: ./contrib/containers/ci/ci.Dockerfile + name: dashcore-ci-runner + slim-file: ./contrib/containers/ci/ci-slim.Dockerfile + slim-name: dashcore-ci-slim + runs-on: ubuntu-24.04-arm depends-arm-linux: name: arm-linux-gnueabihf @@ -193,53 +198,62 @@ jobs: test-linux64: name: linux64-test uses: ./.github/workflows/test-src.yml - needs: [container-slim, src-linux64] + needs: [container, src-linux64] with: bundle-key: ${{ needs.src-linux64.outputs.key }} build-target: linux64 - container-path: ${{ needs.container-slim.outputs.path }} + container-path: ${{ needs.container.outputs.slim-path }} test-linux64_multiprocess: name: linux64_multiprocess-test uses: ./.github/workflows/test-src.yml - needs: [container-slim, src-linux64_multiprocess] + needs: [container, src-linux64_multiprocess] with: bundle-key: ${{ needs.src-linux64_multiprocess.outputs.key }} build-target: linux64_multiprocess - container-path: ${{ needs.container-slim.outputs.path }} + container-path: ${{ needs.container.outputs.slim-path }} test-linux64_nowallet: name: linux64_nowallet-test uses: ./.github/workflows/test-src.yml - needs: [container-slim, src-linux64_nowallet] + needs: [container, src-linux64_nowallet] with: bundle-key: ${{ needs.src-linux64_nowallet.outputs.key }} build-target: linux64_nowallet - container-path: ${{ needs.container-slim.outputs.path }} + container-path: ${{ needs.container.outputs.slim-path }} test-linux64_sqlite: name: linux64_sqlite-test uses: ./.github/workflows/test-src.yml - needs: [container-slim, src-linux64_sqlite] + needs: [container, src-linux64_sqlite] with: bundle-key: ${{ needs.src-linux64_sqlite.outputs.key }} build-target: linux64_sqlite - container-path: ${{ needs.container-slim.outputs.path }} + container-path: ${{ needs.container.outputs.slim-path }} test-linux64_tsan: name: linux64_tsan-test uses: ./.github/workflows/test-src.yml - needs: [container-slim, src-linux64_tsan] + needs: [container, src-linux64_tsan] with: bundle-key: ${{ needs.src-linux64_tsan.outputs.key }} build-target: linux64_tsan - container-path: ${{ needs.container-slim.outputs.path }} + container-path: ${{ needs.container.outputs.slim-path }} test-linux64_ubsan: name: linux64_ubsan-test uses: ./.github/workflows/test-src.yml - needs: [container-slim, src-linux64_ubsan] + needs: [container, src-linux64_ubsan] with: bundle-key: ${{ needs.src-linux64_ubsan.outputs.key }} build-target: linux64_ubsan - container-path: ${{ needs.container-slim.outputs.path }} + container-path: ${{ needs.container.outputs.slim-path }} + + test-arm-linux: + name: arm-linux-test + uses: ./.github/workflows/test-src.yml + needs: [container, src-arm-linux] + with: + bundle-key: ${{ needs.src-arm-linux.outputs.key }} + build-target: arm-linux + container-path: ${{ needs.container.outputs.slim-path }} diff --git a/contrib/containers/ci/ci-slim.Dockerfile b/contrib/containers/ci/ci-slim.Dockerfile index 2bfb3baea2432..c7002a6db443f 100644 --- a/contrib/containers/ci/ci-slim.Dockerfile +++ b/contrib/containers/ci/ci-slim.Dockerfile @@ -88,7 +88,9 @@ RUN set -ex; \ ARG SHELLCHECK_VERSION=v0.7.1 RUN set -ex; \ - curl -fL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" -o /tmp/shellcheck.tar.xz; \ + ARCH=$(uname -m); \ + if [ "$ARCH" = "aarch64" ]; then SHELLCHECK_ARCH="aarch64"; else SHELLCHECK_ARCH="x86_64"; fi; \ + curl -fL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.${SHELLCHECK_ARCH}.tar.xz" -o /tmp/shellcheck.tar.xz; \ mkdir -p /opt/shellcheck && tar -xf /tmp/shellcheck.tar.xz -C /opt/shellcheck --strip-components=1 && rm /tmp/shellcheck.tar.xz ENV PATH="/opt/shellcheck:${PATH}"