From 3d529c1b5752d151f79ef54937a4e3cf0007bc41 Mon Sep 17 00:00:00 2001 From: Travis Shivers Date: Thu, 24 Sep 2020 21:58:22 -0500 Subject: [PATCH] ci: single test action --- .github/workflows/10-alpine3.10.yml | 45 ----------- .github/workflows/10-alpine3.11.yml | 45 ----------- .github/workflows/10-alpine3.9.yml | 45 ----------- .github/workflows/10-buster-slim.yml | 45 ----------- .github/workflows/10-buster.yml | 45 ----------- .github/workflows/10-stretch-slim.yml | 45 ----------- .github/workflows/10-stretch.yml | 45 ----------- .github/workflows/12-alpine3.10.yml | 45 ----------- .github/workflows/12-alpine3.11.yml | 45 ----------- .github/workflows/12-alpine3.12.yml | 45 ----------- .github/workflows/12-alpine3.9.yml | 45 ----------- .github/workflows/12-buster-slim.yml | 45 ----------- .github/workflows/12-buster.yml | 45 ----------- .github/workflows/12-stretch-slim.yml | 45 ----------- .github/workflows/12-stretch.yml | 45 ----------- .github/workflows/14-alpine3.10.yml | 45 ----------- .github/workflows/14-alpine3.11.yml | 45 ----------- .github/workflows/14-alpine3.12.yml | 45 ----------- .github/workflows/14-buster-slim.yml | 45 ----------- .github/workflows/14-buster.yml | 45 ----------- .github/workflows/14-stretch-slim.yml | 45 ----------- .github/workflows/14-stretch.yml | 45 ----------- .github/workflows/build-test.yml | 70 ++++++++++++++++ genMatrix.js | 110 ++++++++++++++++++++++++++ 24 files changed, 180 insertions(+), 990 deletions(-) delete mode 100644 .github/workflows/10-alpine3.10.yml delete mode 100644 .github/workflows/10-alpine3.11.yml delete mode 100644 .github/workflows/10-alpine3.9.yml delete mode 100644 .github/workflows/10-buster-slim.yml delete mode 100644 .github/workflows/10-buster.yml delete mode 100644 .github/workflows/10-stretch-slim.yml delete mode 100644 .github/workflows/10-stretch.yml delete mode 100644 .github/workflows/12-alpine3.10.yml delete mode 100644 .github/workflows/12-alpine3.11.yml delete mode 100644 .github/workflows/12-alpine3.12.yml delete mode 100644 .github/workflows/12-alpine3.9.yml delete mode 100644 .github/workflows/12-buster-slim.yml delete mode 100644 .github/workflows/12-buster.yml delete mode 100644 .github/workflows/12-stretch-slim.yml delete mode 100644 .github/workflows/12-stretch.yml delete mode 100644 .github/workflows/14-alpine3.10.yml delete mode 100644 .github/workflows/14-alpine3.11.yml delete mode 100644 .github/workflows/14-alpine3.12.yml delete mode 100644 .github/workflows/14-buster-slim.yml delete mode 100644 .github/workflows/14-buster.yml delete mode 100644 .github/workflows/14-stretch-slim.yml delete mode 100644 .github/workflows/14-stretch.yml create mode 100644 .github/workflows/build-test.yml create mode 100644 genMatrix.js diff --git a/.github/workflows/10-alpine3.10.yml b/.github/workflows/10-alpine3.10.yml deleted file mode 100644 index 84544a680..000000000 --- a/.github/workflows/10-alpine3.10.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 10 on alpine3.10 - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/alpine3.10/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/alpine3.10/Dockerfile - -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: - - 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 deleted file mode 100644 index 525148e02..000000000 --- a/.github/workflows/10-alpine3.11.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 10 on alpine3.11 - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/alpine3.11/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/alpine3.11/Dockerfile - -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: - - 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 deleted file mode 100644 index 229aba8ad..000000000 --- a/.github/workflows/10-alpine3.9.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 10 on alpine3.9 - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/alpine3.9/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/alpine3.9/Dockerfile - -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: - - 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 deleted file mode 100644 index c7c19f7aa..000000000 --- a/.github/workflows/10-buster-slim.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 10 on buster-slim - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/buster-slim/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/buster-slim/Dockerfile - -jobs: - build: - name: 10 on buster-slim - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8","ppc64le","s390x"]}')}} - steps: - - 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 deleted file mode 100644 index 774e413f8..000000000 --- a/.github/workflows/10-buster.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 10 on buster - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/buster/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/buster/Dockerfile - -jobs: - build: - name: 10 on buster - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8","ppc64le","s390x"]}')}} - steps: - - 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 deleted file mode 100644 index e33577f77..000000000 --- a/.github/workflows/10-stretch-slim.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 10 on stretch-slim - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/stretch-slim/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/stretch-slim/Dockerfile - -jobs: - build: - name: 10 on stretch-slim - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8"]}')}} - steps: - - 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 deleted file mode 100644 index 3c0648203..000000000 --- a/.github/workflows/10-stretch.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 10 on stretch - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/stretch/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 10/stretch/Dockerfile - -jobs: - build: - name: 10 on stretch - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8"]}')}} - steps: - - 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 deleted file mode 100644 index b7e3351d3..000000000 --- a/.github/workflows/12-alpine3.10.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 12 on alpine3.10 - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/alpine3.10/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/alpine3.10/Dockerfile - -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: - - 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 deleted file mode 100644 index 474f99c8f..000000000 --- a/.github/workflows/12-alpine3.11.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 12 on alpine3.11 - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/alpine3.11/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/alpine3.11/Dockerfile - -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: - - 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 deleted file mode 100644 index afe9cf22e..000000000 --- a/.github/workflows/12-alpine3.12.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 12 on alpine3.12 - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/alpine3.12/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/alpine3.12/Dockerfile - -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: - - 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 deleted file mode 100644 index ee9746fa0..000000000 --- a/.github/workflows/12-alpine3.9.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 12 on alpine3.9 - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/alpine3.9/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/alpine3.9/Dockerfile - -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: - - 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 deleted file mode 100644 index 03befbefd..000000000 --- a/.github/workflows/12-buster-slim.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 12 on buster-slim - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/buster-slim/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/buster-slim/Dockerfile - -jobs: - build: - name: 12 on buster-slim - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8","ppc64le","s390x"]}')}} - steps: - - 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 deleted file mode 100644 index 30e3389aa..000000000 --- a/.github/workflows/12-buster.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 12 on buster - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/buster/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/buster/Dockerfile - -jobs: - build: - name: 12 on buster - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8","ppc64le","s390x"]}')}} - steps: - - 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 deleted file mode 100644 index c99d431fe..000000000 --- a/.github/workflows/12-stretch-slim.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 12 on stretch-slim - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/stretch-slim/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/stretch-slim/Dockerfile - -jobs: - build: - name: 12 on stretch-slim - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8"]}')}} - steps: - - 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 deleted file mode 100644 index f45479c8f..000000000 --- a/.github/workflows/12-stretch.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 12 on stretch - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/stretch/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 12/stretch/Dockerfile - -jobs: - build: - name: 12 on stretch - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8"]}')}} - steps: - - 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 deleted file mode 100644 index f7477121f..000000000 --- a/.github/workflows/14-alpine3.10.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 14 on alpine3.10 - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/alpine3.10/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/alpine3.10/Dockerfile - -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: - - 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 deleted file mode 100644 index 9d6f879c7..000000000 --- a/.github/workflows/14-alpine3.11.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 14 on alpine3.11 - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/alpine3.11/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/alpine3.11/Dockerfile - -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: - - 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 deleted file mode 100644 index 79cd3f205..000000000 --- a/.github/workflows/14-alpine3.12.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 14 on alpine3.12 - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/alpine3.12/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/alpine3.12/Dockerfile - -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: - - 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 deleted file mode 100644 index bf37a88e7..000000000 --- a/.github/workflows/14-buster-slim.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 14 on buster-slim - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/buster-slim/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/buster-slim/Dockerfile - -jobs: - build: - name: 14 on buster-slim - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8","ppc64le","s390x"]}')}} - steps: - - 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 deleted file mode 100644 index 061a4fdab..000000000 --- a/.github/workflows/14-buster.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 14 on buster - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/buster/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/buster/Dockerfile - -jobs: - build: - name: 14 on buster - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8","ppc64le","s390x"]}')}} - steps: - - 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 deleted file mode 100644 index d9e1e9a66..000000000 --- a/.github/workflows/14-stretch-slim.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 14 on stretch-slim - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/stretch-slim/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/stretch-slim/Dockerfile - -jobs: - build: - name: 14 on stretch-slim - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8"]}')}} - steps: - - 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 deleted file mode 100644 index 43caa5d73..000000000 --- a/.github/workflows/14-stretch.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: 14 on stretch - -on: - push: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/stretch/Dockerfile - pull_request: - paths: - - functions.sh - - test-build.sh - - test-image.bats - - 14/stretch/Dockerfile - -jobs: - build: - name: 14 on stretch - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{fromJson('{"arch":["amd64","arm32v7","arm64v8"]}')}} - steps: - - 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/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 000000000..6de9ff193 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,70 @@ +name: test-build + +on: + push: + pull_request: + +jobs: + gen-matrix: + name: generate-matrix + runs-on: ubuntu-latest + + steps: + - name: Calculate file differences + uses: lots0logs/gh-action-get-changed-files@2.1.4 + id: diff + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Checkout + uses: actions/checkout@v2 + + - name: Generate testing matrix + uses: actions/github-script@v3 + id: generator + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const script = require(`${process.env.GITHUB_WORKSPACE}/genMatrix.js`) + return script( + ${{ steps.diff.outputs.added }}, + ${{ steps.diff.outputs.modified }}, + ${{ steps.diff.outputs.renamed }}, + ); + + - name: Matrix + run: echo "${{ toJson(steps.generator.outputs.result) }}" + + outputs: + matrix: ${{ steps.generator.outputs.result }} + + build: + needs: gen-matrix + name: build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.gen-matrix.outputs.matrix) }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install bats + run: sudo apt-get install bats + + - name: Write experimental docker flag + run: | + echo '{\"experimental\": true}' | sudo tee /etc/docker/daemon.json + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Restart docker daemon + run: sudo systemctl restart docker + + - name: Build and test + run: ./test-build.sh ${{ matrix.version }} ${{ matrix.variant }} ${{ matrix.arch }} diff --git a/genMatrix.js b/genMatrix.js new file mode 100644 index 000000000..162a0f4d9 --- /dev/null +++ b/genMatrix.js @@ -0,0 +1,110 @@ +const path = require('path'); +const fs = require('fs'); + +const testFiles = [ + 'functions.sh', + 'test-build.sh', + 'test-image.bats', +]; + +const nodeDirRegex = /^\d+$/; + +const areTestFilesChanged = (changedFiles) => changedFiles + .filter((file) => testFiles.includes(file)).length; + +// Returns a list of the child directories in the given path +const getChildDirectories = (parent) => fs.readdirSync(parent, { withFileTypes: true }) + .filter((dirent) => dirent.isDirectory()) + .map(({ name }) => path.resolve(parent, name)); + + +const getNodeVerionDirs = (base) => getChildDirectories(base) + .filter((childPath) => nodeDirRegex.test(path.basename(childPath))); + +// Returns the paths of Dockerfiles that are at: base/*/Dockerfile +const getDockerfilesInChildDirs = (base) => getChildDirectories(base) + .map((childDir) => path.resolve(childDir, 'Dockerfile')); + +const getAllDockerfiles = (base) => getNodeVerionDirs(base).flatMap(getDockerfilesInChildDirs); + +// Get the Dockerfiles affected by the architectures file +const getArchAffectedDockerfiles = (archFile) => getDockerfilesInChildDirs(path.dirname(archFile)); + +const getAffectedDockerfiles = (filesAdded, filesModified, filesRenamed) => { + const files = [ + ...filesAdded, + ...filesModified, + ...filesRenamed, + ]; + + // If the test files were changed, include everything + if (areTestFilesChanged(files)) { + console.log('Test files changed so scheduling all Dockerfiles'); + return getAllDockerfiles(__dirname); + } + + const dockerfiles = files.filter((file) => file.endsWith('/Dockerfile')); + + // Look Dockerfiles affected by changed architectures files + const archAffectedFiles = files.filter((file) => file.endsWith('/architectures')) + .flatMap(getArchAffectedDockerfiles); + + return [ + ...dockerfiles, + ...archAffectedFiles, + ]; +}; + +// Parses an arch line like: +// amd64 stretch,stretch-slim +// Into ["amd64", ["stretch", "stretch-slim"]] +const parseArchLine = (line) => { + const [arch, rawVariants] = line.split(/\s+/); + const variants = rawVariants.split(','); + + return [ + arch, + variants + ]; +}; + +// Parses an architectures file into an object like: +// { +// "amd64": ["stretch", "stretch-slim"], +// // .... +// } +const parseArchFile = (file) => Object.fromEntries( + fs.readFileSync(file, { encoding: 'utf8' }) + .split('\n') + .slice(1) + .filter((line) => line) + .map(parseArchLine), +); + +// Given a Dockerfile path, this function returns an array of the supported arches +const getDockerfileArches = (file, variant) => { + const archVariants = parseArchFile(path.resolve(path.basename(file), '../architectures')); + return Object.keys(archVariants).filter((arch) => archVariants[arch].includes(variant)); +}; + +const getDockerfileMatrixEntries = (file) => { + const [version, variant] = path.dirname(file).split(path.sep).slice(-2); + const supportedArches = getDockerfileArches(file, variant); + + return supportedArches.map((arch) => ({ + version, + variant, + arch, + })); +}; + +const generateBuildMatrix = (filesAdded, filesModified, filesRenamed) => { + // The Dockerfile paths contain the version in variant. + const dockerfiles = [...new Set(getAffectedDockerfiles(filesAdded, filesModified, filesRenamed))]; + + return { + include: dockerfiles.flatMap(getDockerfileMatrixEntries), + }; +}; + +module.exports = generateBuildMatrix;