diff --git a/.dockerignore b/.dockerignore index 3e59b8b2..f853ba4e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,5 @@ -Makefile -Dockerfile -docker-bake.hcl -tests-docker-output +devtools +tests-outputs *.lo *.o diff --git a/.gitignore b/.gitignore index 108bbabb..97c165d8 100644 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,4 @@ tmp-php.ini coverage_report/** -tests-docker-output +tests-outputs diff --git a/Makefile b/Makefile index 1b86154d..9a02754e 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,15 @@ SHELL := bash MAKEFLAGS += --no-builtin-rules -.PHONY: help +.PHONY: help tests-outputs -# use local source code here -BAKE = docker buildx bake --set main.contexts.php-v8js-source-code=. +BAKE = docker buildx bake --file devtools/docker-bake.hcl help: @grep -E '(^[a-zA-Z0-9\./_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/' -build: php84 ## Build the project on latest PHP version +tests-outputs: php84 ## Run tests inside docker containers and save outputs inside `tests-outputs` directory -matrix: ## Build the project on each actively maintained PHP version +tests-outputs-all-versions: ## Same, but with each actively maintained PHP version make -j4 build-matrix build-matrix: php84 php83 php82 php81 @@ -28,4 +27,4 @@ php81: PHP_VERSION=8.1 $(BAKE) clean: - rm -rf tests-docker-output + rm -rf tests-outputs diff --git a/devtools/docker-bake.hcl b/devtools/docker-bake.hcl new file mode 100644 index 00000000..4922de5d --- /dev/null +++ b/devtools/docker-bake.hcl @@ -0,0 +1,25 @@ +## Usage from the root directory: +# docker buildx bake -f devtools/docker-bake.hcl +# PHP_VERSION=8.3 docker buildx bake -f devtools/docker-bake.hcl +# PHP_VERSION=8.2 docker buildx bake -f devtools/docker-bake.hcl +# PHP_VERSION=8.1 docker buildx bake -f devtools/docker-bake.hcl +# docker buildx bake -f devtools/docker-bake.hcl --set *.contexts.php-v8js-source-code=https://github.com/your-fork/v8js.git#your-branch + +group "default" { + targets = ["main"] + platforms = ["linux/amd64", "linux/arm64"] +} + +variable "PHP_VERSION" { + default = "8.4" +} + +target "main" { + dockerfile = "make-test.Dockerfile" + context = "./devtools" + contexts = { + "php-specified-version" = "docker-image://php:${PHP_VERSION}" + "php-v8js-source-code" = "." + } + output = ["type=local,dest=tests-outputs/"] +} diff --git a/Dockerfile b/devtools/make-test.Dockerfile similarity index 54% rename from Dockerfile rename to devtools/make-test.Dockerfile index 9659dfab..0b58caed 100644 --- a/Dockerfile +++ b/devtools/make-test.Dockerfile @@ -1,7 +1,6 @@ # syntax=docker/dockerfile:1 FROM php-specified-version AS build - RUN < php$(php -r 'echo PHP_VERSION;')_$(uname -m)-make_test_std 2>&1 || true - ls php_test_results_*.txt && mv php_test_results_*.txt php$(php -r 'echo PHP_VERSION;')_$(uname -m)-make_test_report || true EOF - +RUN < ${PREFIX}1-std 2>&1 || true + ls php_test_results_*.txt && mv php_test_results_*.txt ${PREFIX}2-report || true +EOF FROM scratch -COPY --from=build /tmp/php-v8js/*-make_test_* / +COPY --from=build /tmp/php-v8js/*__* / diff --git a/docker-bake.hcl b/docker-bake.hcl deleted file mode 100644 index 23c5252d..00000000 --- a/docker-bake.hcl +++ /dev/null @@ -1,23 +0,0 @@ -## Usage: -# docker buildx bake -# PHP_VERSION=8.3 docker buildx bake -# PHP_VERSION=8.2 docker buildx bake -# PHP_VERSION=8.1 docker buildx bake - -group "default" { - targets = ["main"] - platforms = ["linux/amd64", "linux/arm64"] -} - -variable "PHP_VERSION" { - default = "8.4" -} - -target "main" { - dockerfile = "Dockerfile" - contexts = { - "php-specified-version" = "docker-image://php:${PHP_VERSION}" - "php-v8js-source-code" = "https://github.com/phpv8/v8js.git#php8" - } - output = ["type=local,dest=tests-docker-output/"] -}