From 3c96e86ab0b05fc0211b4dddf7f3bc0c1c475015 Mon Sep 17 00:00:00 2001 From: Travis Shivers Date: Mon, 21 Sep 2020 22:20:21 -0500 Subject: [PATCH] ci: add multiarch testing --- .github/workflows/10-alpine3.10.yml | 27 +++++++++++++-- .github/workflows/10-alpine3.11.yml | 27 +++++++++++++-- .github/workflows/10-alpine3.9.yml | 27 +++++++++++++-- .github/workflows/10-buster-slim.yml | 27 +++++++++++++-- .github/workflows/10-buster.yml | 27 +++++++++++++-- .github/workflows/10-stretch-slim.yml | 27 +++++++++++++-- .github/workflows/10-stretch.yml | 27 +++++++++++++-- .github/workflows/12-alpine3.10.yml | 27 +++++++++++++-- .github/workflows/12-alpine3.11.yml | 27 +++++++++++++-- .github/workflows/12-alpine3.12.yml | 27 +++++++++++++-- .github/workflows/12-alpine3.9.yml | 27 +++++++++++++-- .github/workflows/12-buster-slim.yml | 27 +++++++++++++-- .github/workflows/12-buster.yml | 27 +++++++++++++-- .github/workflows/12-stretch-slim.yml | 27 +++++++++++++-- .github/workflows/12-stretch.yml | 27 +++++++++++++-- .github/workflows/14-alpine3.10.yml | 27 +++++++++++++-- .github/workflows/14-alpine3.11.yml | 27 +++++++++++++-- .github/workflows/14-alpine3.12.yml | 27 +++++++++++++-- .github/workflows/14-buster-slim.yml | 27 +++++++++++++-- .github/workflows/14-buster.yml | 27 +++++++++++++-- .github/workflows/14-stretch-slim.yml | 27 +++++++++++++-- .github/workflows/14-stretch.yml | 27 +++++++++++++-- functions.sh | 48 +++++++++++++++++++++++++++ test-build.sh | 30 +++++++++++------ test-image.bats | 6 ++-- update.sh | 30 +++++++++++++++-- 26 files changed, 625 insertions(+), 83 deletions(-) diff --git a/.github/workflows/10-alpine3.10.yml b/.github/workflows/10-alpine3.10.yml index 1e27cc11f..84544a680 100644 --- a/.github/workflows/10-alpine3.10.yml +++ b/.github/workflows/10-alpine3.10.yml @@ -18,7 +18,28 @@ jobs: build: name: 10 on alpine3.10 runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v6","arm32v7","arm64v8","i386","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 10 alpine3.10 + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 10 alpine3.10 ${{ matrix.arch }} diff --git a/.github/workflows/10-alpine3.11.yml b/.github/workflows/10-alpine3.11.yml index e7f459afe..525148e02 100644 --- a/.github/workflows/10-alpine3.11.yml +++ b/.github/workflows/10-alpine3.11.yml @@ -18,7 +18,28 @@ jobs: build: name: 10 on alpine3.11 runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v6","arm32v7","arm64v8","i386","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 10 alpine3.11 + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 10 alpine3.11 ${{ matrix.arch }} diff --git a/.github/workflows/10-alpine3.9.yml b/.github/workflows/10-alpine3.9.yml index cfc60915a..229aba8ad 100644 --- a/.github/workflows/10-alpine3.9.yml +++ b/.github/workflows/10-alpine3.9.yml @@ -18,7 +18,28 @@ jobs: build: name: 10 on alpine3.9 runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v6","arm32v7","arm64v8","i386","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 10 alpine3.9 + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 10 alpine3.9 ${{ matrix.arch }} diff --git a/.github/workflows/10-buster-slim.yml b/.github/workflows/10-buster-slim.yml index 7d1b53e9a..c7c19f7aa 100644 --- a/.github/workflows/10-buster-slim.yml +++ b/.github/workflows/10-buster-slim.yml @@ -18,7 +18,28 @@ jobs: build: name: 10 on buster-slim runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 10 buster-slim + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 10 buster-slim ${{ matrix.arch }} diff --git a/.github/workflows/10-buster.yml b/.github/workflows/10-buster.yml index 648f5f7b9..774e413f8 100644 --- a/.github/workflows/10-buster.yml +++ b/.github/workflows/10-buster.yml @@ -18,7 +18,28 @@ jobs: build: name: 10 on buster runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 10 buster + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 10 buster ${{ matrix.arch }} diff --git a/.github/workflows/10-stretch-slim.yml b/.github/workflows/10-stretch-slim.yml index 846ec74de..e33577f77 100644 --- a/.github/workflows/10-stretch-slim.yml +++ b/.github/workflows/10-stretch-slim.yml @@ -18,7 +18,28 @@ jobs: build: name: 10 on stretch-slim runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 10 stretch-slim + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 10 stretch-slim ${{ matrix.arch }} diff --git a/.github/workflows/10-stretch.yml b/.github/workflows/10-stretch.yml index 7a9dc1b22..3c0648203 100644 --- a/.github/workflows/10-stretch.yml +++ b/.github/workflows/10-stretch.yml @@ -18,7 +18,28 @@ jobs: build: name: 10 on stretch runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 10 stretch + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 10 stretch ${{ matrix.arch }} diff --git a/.github/workflows/12-alpine3.10.yml b/.github/workflows/12-alpine3.10.yml index e81565fe7..b7e3351d3 100644 --- a/.github/workflows/12-alpine3.10.yml +++ b/.github/workflows/12-alpine3.10.yml @@ -18,7 +18,28 @@ jobs: build: name: 12 on alpine3.10 runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v6","arm32v7","arm64v8","i386","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 12 alpine3.10 + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 12 alpine3.10 ${{ matrix.arch }} diff --git a/.github/workflows/12-alpine3.11.yml b/.github/workflows/12-alpine3.11.yml index 531a09680..474f99c8f 100644 --- a/.github/workflows/12-alpine3.11.yml +++ b/.github/workflows/12-alpine3.11.yml @@ -18,7 +18,28 @@ jobs: build: name: 12 on alpine3.11 runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v6","arm32v7","arm64v8","i386","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 12 alpine3.11 + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 12 alpine3.11 ${{ matrix.arch }} diff --git a/.github/workflows/12-alpine3.12.yml b/.github/workflows/12-alpine3.12.yml index f18fc554e..afe9cf22e 100644 --- a/.github/workflows/12-alpine3.12.yml +++ b/.github/workflows/12-alpine3.12.yml @@ -18,7 +18,28 @@ jobs: build: name: 12 on alpine3.12 runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v6","arm32v7","arm64v8","i386","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 12 alpine3.12 + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 12 alpine3.12 ${{ matrix.arch }} diff --git a/.github/workflows/12-alpine3.9.yml b/.github/workflows/12-alpine3.9.yml index 385ff52a2..ee9746fa0 100644 --- a/.github/workflows/12-alpine3.9.yml +++ b/.github/workflows/12-alpine3.9.yml @@ -18,7 +18,28 @@ jobs: build: name: 12 on alpine3.9 runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v6","arm32v7","arm64v8","i386","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 12 alpine3.9 + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 12 alpine3.9 ${{ matrix.arch }} diff --git a/.github/workflows/12-buster-slim.yml b/.github/workflows/12-buster-slim.yml index 04f8e8b11..03befbefd 100644 --- a/.github/workflows/12-buster-slim.yml +++ b/.github/workflows/12-buster-slim.yml @@ -18,7 +18,28 @@ jobs: build: name: 12 on buster-slim runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 12 buster-slim + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 12 buster-slim ${{ matrix.arch }} diff --git a/.github/workflows/12-buster.yml b/.github/workflows/12-buster.yml index 0b16ee6a9..30e3389aa 100644 --- a/.github/workflows/12-buster.yml +++ b/.github/workflows/12-buster.yml @@ -18,7 +18,28 @@ jobs: build: name: 12 on buster runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 12 buster + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 12 buster ${{ matrix.arch }} diff --git a/.github/workflows/12-stretch-slim.yml b/.github/workflows/12-stretch-slim.yml index 608160eeb..c99d431fe 100644 --- a/.github/workflows/12-stretch-slim.yml +++ b/.github/workflows/12-stretch-slim.yml @@ -18,7 +18,28 @@ jobs: build: name: 12 on stretch-slim runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 12 stretch-slim + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 12 stretch-slim ${{ matrix.arch }} diff --git a/.github/workflows/12-stretch.yml b/.github/workflows/12-stretch.yml index 8019f3e1f..f45479c8f 100644 --- a/.github/workflows/12-stretch.yml +++ b/.github/workflows/12-stretch.yml @@ -18,7 +18,28 @@ jobs: build: name: 12 on stretch runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 12 stretch + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 12 stretch ${{ matrix.arch }} diff --git a/.github/workflows/14-alpine3.10.yml b/.github/workflows/14-alpine3.10.yml index e0d04a271..f7477121f 100644 --- a/.github/workflows/14-alpine3.10.yml +++ b/.github/workflows/14-alpine3.10.yml @@ -18,7 +18,28 @@ jobs: build: name: 14 on alpine3.10 runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v6","arm32v7","arm64v8","i386","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 14 alpine3.10 + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 14 alpine3.10 ${{ matrix.arch }} diff --git a/.github/workflows/14-alpine3.11.yml b/.github/workflows/14-alpine3.11.yml index c401f9389..9d6f879c7 100644 --- a/.github/workflows/14-alpine3.11.yml +++ b/.github/workflows/14-alpine3.11.yml @@ -18,7 +18,28 @@ jobs: build: name: 14 on alpine3.11 runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v6","arm32v7","arm64v8","i386","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 14 alpine3.11 + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 14 alpine3.11 ${{ matrix.arch }} diff --git a/.github/workflows/14-alpine3.12.yml b/.github/workflows/14-alpine3.12.yml index 3a20d9520..79cd3f205 100644 --- a/.github/workflows/14-alpine3.12.yml +++ b/.github/workflows/14-alpine3.12.yml @@ -18,7 +18,28 @@ jobs: build: name: 14 on alpine3.12 runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v6","arm32v7","arm64v8","i386","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 14 alpine3.12 + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 14 alpine3.12 ${{ matrix.arch }} diff --git a/.github/workflows/14-buster-slim.yml b/.github/workflows/14-buster-slim.yml index b7d027f93..bf37a88e7 100644 --- a/.github/workflows/14-buster-slim.yml +++ b/.github/workflows/14-buster-slim.yml @@ -18,7 +18,28 @@ jobs: build: name: 14 on buster-slim runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 14 buster-slim + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 14 buster-slim ${{ matrix.arch }} diff --git a/.github/workflows/14-buster.yml b/.github/workflows/14-buster.yml index 4481aadc2..061a4fdab 100644 --- a/.github/workflows/14-buster.yml +++ b/.github/workflows/14-buster.yml @@ -18,7 +18,28 @@ jobs: build: name: 14 on buster runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8","ppc64le","s390x"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 14 buster + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 14 buster ${{ matrix.arch }} diff --git a/.github/workflows/14-stretch-slim.yml b/.github/workflows/14-stretch-slim.yml index d7c68f026..d9e1e9a66 100644 --- a/.github/workflows/14-stretch-slim.yml +++ b/.github/workflows/14-stretch-slim.yml @@ -18,7 +18,28 @@ jobs: build: name: 14 on stretch-slim runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 14 stretch-slim + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 14 stretch-slim ${{ matrix.arch }} diff --git a/.github/workflows/14-stretch.yml b/.github/workflows/14-stretch.yml index dfbfea496..43caa5d73 100644 --- a/.github/workflows/14-stretch.yml +++ b/.github/workflows/14-stretch.yml @@ -18,7 +18,28 @@ jobs: build: name: 14 on stretch runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8"]}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh 14 stretch + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh 14 stretch ${{ matrix.arch }} diff --git a/functions.sh b/functions.sh index be9c57539..25b6b26bc 100755 --- a/functions.sh +++ b/functions.sh @@ -359,3 +359,51 @@ function tests_updated() { fi return 0 } + +function arch_to_buildx_platform() { + local arch + local platform + arch=$1 + shift + + case $arch in + amd64) + platform="amd64" + ;; + arm32v6) + platform="arm/v6" + ;; + arm32v7) + platform="arm/v7" + ;; + arm64v8) + platform="arm64" + ;; + i386) + platform="386" + ;; + ppc64le) + platform="ppc64le" + ;; + s390x) + platform="s390x" + ;; + *) + echo "$0 does not support architecture ${arch} ... aborting" + exit 1 + ;; + esac + + echo "${platform}" +} + +function json_array() { + echo -n '[' + while [ $# -gt 0 ]; do + x=${1//\\/\\\\} + echo -n \""${x//\"/\\\"}"\" + [ $# -gt 1 ] && echo -n ',' + shift + done + echo ']' +} diff --git a/test-build.sh b/test-build.sh index 6614725d3..682772007 100755 --- a/test-build.sh +++ b/test-build.sh @@ -11,6 +11,7 @@ set -euo pipefail # "10,12" becomes "10 12" and "slim,alpine" becomes "slim alpine" IFS=',' read -ra versions_arg <<< "${1:-}" IFS=',' read -ra variant_arg <<< "${2:-}" +IFS=',' read -ra arches_arg <<< "${3:-}" default_variant=$(get_config "./" "default_variant") @@ -18,6 +19,7 @@ function build() { local version local tag local variant + local platform local full_tag local path version="$1" @@ -26,13 +28,15 @@ function build() { shift tag="$1" shift + platform="$1" + shift full_tag=$(get_full_tag "${variant}" "${tag}") path=$(get_path "${version}" "${variant}") - info "Building ${full_tag}..." + info "Building ${full_tag} on ${platform}..." - if ! docker build --cpuset-cpus="0,1" -t node:"${full_tag}" "${path}"; then + if ! docker buildx build --load --platform "${platform}" -t node:"${full_tag}" "${path}"; then fatal "Build of ${full_tag} failed!" fi info "Build of ${full_tag} succeeded." @@ -41,6 +45,7 @@ function build() { function test_image() { local full_version local variant + local platform local tag local full_tag full_version="$1" @@ -49,25 +54,23 @@ function test_image() { shift tag="$1" shift + platform="$1" + shift full_tag=$(get_full_tag "${variant}" "${tag}") - info "Testing ${full_tag}" + info "Testing ${full_tag} on ${platform}" ( export full_version=${full_version} export full_tag=${full_tag} + export platform=${platform} bats test-image.bats ) } cd "$(cd "${0%/*}" && pwd -P)" || exit -IFS=' ' read -ra versions <<< "$(get_versions . "${versions_arg[@]}")" -if [ ${#versions[@]} -eq 0 ]; then - fatal "No valid versions found!" -fi - -for version in "${versions[@]}"; do +for version in "${versions_arg[@]}"; do # Skip "docs" and other non-docker directories [ -f "${version}/Dockerfile" ] || [ -a "${version}/${default_variant}/Dockerfile" ] || continue @@ -82,8 +85,13 @@ for version in "${versions[@]}"; do # Skip non-docker directories [ -f "${version}/${variant}/Dockerfile" ] || continue - build "${version}" "${variant}" "${tag}" - test_image "${full_version}" "${variant}" "${tag}" + for arch in "${arches_arg[@]}"; do + buildx_platform=$(arch_to_buildx_platform "${arch}") + + build "${version}" "${variant}" "${tag}" "linux/${buildx_platform}" + test_image "${full_version}" "${variant}" "${tag}" "linux/${buildx_platform}" + done + done done diff --git a/test-image.bats b/test-image.bats index b424b95a4..5eba95b2a 100755 --- a/test-image.bats +++ b/test-image.bats @@ -1,17 +1,17 @@ #!/usr/bin/env bats @test "Test for node and version" { - run docker run --rm node:"$full_tag" node -e "process.stdout.write(process.versions.node)" + run docker run --platform ${platform} --rm node:"$full_tag" node -e "process.stdout.write(process.versions.node)" [ "$status" -eq 0 ] [ "$output" == "${full_version}" ] } @test "Test for npm" { - run docker run --rm node:"$full_tag" npm --version + run docker run --platform ${platform} --rm node:"$full_tag" npm --version [ "$status" -eq 0 ] } @test "Test for yarn" { - run docker run --rm node:"$full_tag" yarn --version + run docker run --platform ${platform} --rm node:"$full_tag" yarn --version [ "$status" -eq 0 ] } diff --git a/update.sh b/update.sh index 8b66a6e55..72c539559 100755 --- a/update.sh +++ b/update.sh @@ -196,6 +196,9 @@ function add_stage() { local variant=${1} shift + IFS=' ' read -ra supportedArches <<< "$(get_supported_arches "${version}" "${variant}")" + read -r arch_json <<< "$(json_array "${supportedArches[@]}")" + echo "name: ${version} on ${variant} on: @@ -216,10 +219,31 @@ jobs: build: name: ${version} on ${variant} runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: \${{fromJson('{\"arch\":${arch_json}}')}} steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install bats - - run: ./test-build.sh ${version} ${variant}" > ".github/workflows/${version}-${variant}.yml" + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Write experimental docker flag + run: | + echo '{\"experimental\": true}' | sudo tee /etc/docker/daemon.json + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh ${version} ${variant} \${{ matrix.arch }}" > ".github/workflows/${version}-${variant}.yml" } for version in "${versions[@]}"; do