Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: ${{ startsWith(github.ref, 'refs/tags/v') && 0 || 1 }}
fetch-depth: ${{ startsWith(github.ref, 'refs/tags/v') && '0' || '1' }}

- name: Retrieve the previous release version
if: startsWith(github.ref, 'refs/tags/v')
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build-%:
BUILD_ARGS="$(shell awk '/^[a-zA-Z0-9]+ *=/ { printf "--build-arg %s_VERSION=%s ", toupper($$1), $$3 }' "$*/dependencies.ini" | xargs)" && \
docker buildx build $$BUILD_ARGS $(DOCKER_BUILD_EXTRA) \
--load \
-t $(DOCKER_BUILD_EXTRA)/$(DOCKER_IMAGE):$(subst php,,$*) \
-t $(DOCKER_REGISTRY)/$(DOCKER_IMAGE):$(subst php,,$*) \
.

build: $(addprefix build-,$(VARIANTS))
Expand All @@ -21,7 +21,10 @@ test-setup:

test-%:
cd tests; \
DEW_PHP_VERSION="$*" composer run test
DEW_PHP_VERSION="$*" \
DOCKER_REGISTRY="$(DOCKER_REGISTRY)" \
DOCKER_IMAGE="$(DOCKER_IMAGE)" \
composer run test

test: test-setup $(addprefix test-,$(VARIANTS))

Expand Down
2 changes: 2 additions & 0 deletions tests/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
</testsuites>
<php>
<env name="DEW_PHP_VERSION" value=""/>
<env name="DOCKER_REGISTRY" value="ghcr.io"/>
<env name="DOCKER_IMAGE" value="dew-serverless/php"/>
</php>
</phpunit>
13 changes: 12 additions & 1 deletion tests/tests/FeatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,24 @@ private function execute(string $command): array
$exit = null;

$version = $_ENV['DEW_PHP_VERSION'];
$registry = $_ENV['DOCKER_REGISTRY'];
$image = $_ENV['DOCKER_IMAGE'];

if ($version === '') {
$this->markTestSkipped('The environment variable "DEW_PHP_VERSION" is missing.');
}

if ($registry === '') {
$this->markTestSkipped('The environment variable "DOCKER_REGISTRY" is missing.');
}

if ($image === '') {
$this->markTestSkipped('The environment variable "DOCKER_IMAGE" is missing.');
}

$tag = str_replace('php', '', $version);
$cmd = preg_replace(
'/^php /', "docker run --rm dew/{$version} ", $command
'/^php /', sprintf('docker run --rm %s/%s:%s ', $registry, $image, $tag), $command
);

exec($cmd, $output, $exit);
Expand Down