diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index dd50232..84bdbf1 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -71,11 +71,14 @@ jobs: - name: Install container-structure-test run: | - if [[ "${{ matrix.platform }}" == *"arm64"* ]]; then - curl -LO https://github.com/GoogleContainerTools/container-structure-test/releases/latest/download/container-structure-test-linux-arm64 && chmod +x container-structure-test-linux-arm64 && sudo mv container-structure-test-linux-arm64 /usr/local/bin/container-structure-test - else - curl -LO https://github.com/GoogleContainerTools/container-structure-test/releases/latest/download/container-structure-test-linux-amd64 && chmod +x container-structure-test-linux-amd64 && sudo mv container-structure-test-linux-amd64 /usr/local/bin/container-structure-test - fi + if [ "${{ matrix.platform }}" == "linux/arm64" ]; then + ARCH="arm64" + else + ARCH="amd64" + fi + curl -LO "https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-${ARCH}" + chmod +x "container-structure-test-linux-${ARCH}" + sudo mv "container-structure-test-linux-${ARCH}" /usr/local/bin/container-structure-test - name: Run tests run: | diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index e83a1e9..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: Test Docker image - -on: - pull_request: - branches: - - latest - push: - branches: - - latest - workflow_dispatch: - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - platform: [linux/amd64, linux/arm64] - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Install container-structure-test - run: | - if [ "${{ matrix.platform }}" == "linux/arm64" ]; then - ARCH="arm64" - else - ARCH="amd64" - fi - curl -LO "https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-${ARCH}" - chmod +x "container-structure-test-linux-${ARCH}" - sudo mv "container-structure-test-linux-${ARCH}" /usr/local/bin/container-structure-test - - - name: Run tests - run: ./test.sh "${{ matrix.platform }}" diff --git a/Dockerfile b/Dockerfile index ec7c3e4..4cd621f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,12 +69,12 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ && export SHFMT_VERSION=$(curl -s https://api.github.com/repos/mvdan/sh/releases/latest | jq -r '.tag_name') \ && if [ "$(uname -m)" = "aarch64" ]; then \ curl -o /usr/local/bin/snyk -L https://static.snyk.io/cli/latest/snyk-linux-arm64 \ - && curl -o /usr/local/bin/hadolint -L https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VERSION}/hadolint-Linux-arm64 \ + && curl -o /usr/local/bin/hadolint -L https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VERSION}/hadolint-linux-arm64 \ && curl -o /usr/local/bin/shfmt -L https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/shfmt_${SHFMT_VERSION}_linux_arm64 \ && curl -sL "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_arm64.tar.gz" | tar -xzf - -C /usr/local/bin actionlint ; \ else \ curl -o /usr/local/bin/snyk -L https://static.snyk.io/cli/latest/snyk-linux \ - && curl -o /usr/local/bin/hadolint -L https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VERSION}/hadolint-Linux-x86_64 \ + && curl -o /usr/local/bin/hadolint -L https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VERSION}/hadolint-linux-x86_64 \ && curl -o /usr/local/bin/shfmt -L https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/shfmt_${SHFMT_VERSION}_linux_amd64 \ && curl -sL "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" | tar -xzf - -C /usr/local/bin actionlint ; \ fi \ diff --git a/test.sh b/test.sh index 1c43891..b8a4581 100755 --- a/test.sh +++ b/test.sh @@ -41,19 +41,19 @@ build_and_test() { docker run --platform "$platform" --rm "$TEST_PLATFORM_IMAGE" uname -m # Conditionally add --platform flag - PLATFORM_ARG="" + PLATFORM_ARG=() if [ -n "$PLATFORM_FLAG" ]; then - PLATFORM_ARG="--platform $platform" + PLATFORM_ARG=(--platform "$platform") fi if [ "$platform" == "linux/amd64" ]; then - container-structure-test test "$PLATFORM_ARG" --image "$TEST_PLATFORM_IMAGE" --config tests/amd64.yaml + container-structure-test test "${PLATFORM_ARG[@]}" --image "$TEST_PLATFORM_IMAGE" --config tests/amd64.yaml else - container-structure-test test "$PLATFORM_ARG" --image "$TEST_PLATFORM_IMAGE" --config tests/arm64.yaml + container-structure-test test "${PLATFORM_ARG[@]}" --image "$TEST_PLATFORM_IMAGE" --config tests/arm64.yaml fi # Run the tests - container-structure-test test "$PLATFORM_ARG" --image "$TEST_PLATFORM_IMAGE" --config tests/specs.yaml + container-structure-test test "${PLATFORM_ARG[@]}" --image "$TEST_PLATFORM_IMAGE" --config tests/specs.yaml # Clean up docker rmi $TEST_IMAGE:"$tag" || true