diff --git a/.gitattributes b/.gitattributes
index e7ce42a..1ffb36b 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -7,6 +7,7 @@
/.gitignore export-ignore
/composer.lock export-ignore
/demo export-ignore
+/docker export-ignore
/phpstan.neon export-ignore
/phpunit.xml export-ignore
/pint.json export-ignore
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index e8a05fd..fabfc5d 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -50,10 +50,10 @@ PHPStan, Rector and the type coverage read `src` and `tests`; Pint reads the who
The code must run on PHP 8.4 and 8.5, on macOS, and on Linux with glibc and with musl. The Docker
jobs in CI run the suites as a non-root user, so that the file-mode tests run. To run
such a job locally, use a clean clone, because the command copies the whole directory. Use `debian`
-or `alpine` as the directory in `.github/docker/`:
+or `alpine` as the directory in `docker/`:
```sh
-docker build --quiet --tag tests .github/docker/debian
+docker build --quiet --tag tests docker/debian
docker run --rm --volume "$PWD:/src:ro" --entrypoint sh tests -euc '
cp -a /src /work
chown -R www-data /work
@@ -71,9 +71,9 @@ A workflow uses zizmor to audit the workflows and the Dependabot configuration i
actionlint to check the workflows. Run both when you change anything there:
```sh
-docker build --quiet --tag zizmor .github/docker/zizmor
+docker build --quiet --tag zizmor docker/zizmor
docker run --rm --volume "$PWD:/src:ro" --workdir /src zizmor --offline .github
-docker build --quiet --tag actionlint .github/docker/actionlint
+docker build --quiet --tag actionlint docker/actionlint
docker run --rm --volume "$PWD:/src:ro" --workdir /src actionlint -no-color
```
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 0d38b74..4fe41c1 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -13,14 +13,15 @@ updates:
actions:
patterns: ['*']
- # The images the jobs of Alpine, Debian and the workflows run in, and the image of the demo.
+ # The images the jobs of Alpine, Debian and the workflows run in, and the image of the demo. None
+ # is under .github: GitHub refuses a pull request of this ecosystem that changes a file there.
- package-ecosystem: docker
directories:
- /demo
- - /.github/docker/actionlint
- - /.github/docker/alpine
- - /.github/docker/debian
- - /.github/docker/zizmor
+ - /docker/actionlint
+ - /docker/alpine
+ - /docker/debian
+ - /docker/zizmor
schedule:
interval: monthly
cooldown:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 686fa37..92de1d5 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -12,8 +12,8 @@ on:
permissions:
contents: read
-# Dependabot updates the actions and the images of `.github/docker`. Composer, pinned by digest in
-# `tools`, is updated by hand, to the version of the Composer image in `.github/docker`.
+# Dependabot updates the actions and the images of `docker`. Composer, pinned by digest in
+# `tools`, is updated by hand, to the version of the Composer image in `docker`.
concurrency:
group: tests-${{ github.ref }}
@@ -249,7 +249,7 @@ jobs:
key: frankenphp-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('tests/Fixtures/frankenphp/release.lock') }}
- name: Build
- run: docker build --quiet --tag tests .github/docker/alpine
+ run: docker build --quiet --tag tests docker/alpine
# On the runner, because the image has no gh to check the attestation. Into the tree, so the
# cache keeps it and the container of the test copies it.
@@ -293,7 +293,7 @@ jobs:
key: frankenphp-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('tests/Fixtures/frankenphp/release.lock') }}
- name: Build
- run: docker build --quiet --tag tests .github/docker/debian
+ run: docker build --quiet --tag tests docker/debian
# On the runner, because the image has no gh to check the attestation. Into the tree, so the
# cache keeps it and the container of the test copies it.
@@ -331,10 +331,10 @@ jobs:
- name: Audit
run: |
- docker build --quiet --tag zizmor .github/docker/zizmor
+ docker build --quiet --tag zizmor docker/zizmor
docker run --rm --volume "$PWD:/src:ro" --workdir /src zizmor --offline .github
- name: Lint
run: |
- docker build --quiet --tag actionlint .github/docker/actionlint
+ docker build --quiet --tag actionlint docker/actionlint
docker run --rm --volume "$PWD:/src:ro" --workdir /src actionlint -no-color
diff --git a/.github/docker/actionlint/Dockerfile b/docker/actionlint/Dockerfile
similarity index 100%
rename from .github/docker/actionlint/Dockerfile
rename to docker/actionlint/Dockerfile
diff --git a/.github/docker/alpine/Dockerfile b/docker/alpine/Dockerfile
similarity index 100%
rename from .github/docker/alpine/Dockerfile
rename to docker/alpine/Dockerfile
diff --git a/.github/docker/debian/Dockerfile b/docker/debian/Dockerfile
similarity index 100%
rename from .github/docker/debian/Dockerfile
rename to docker/debian/Dockerfile
diff --git a/.github/docker/zizmor/Dockerfile b/docker/zizmor/Dockerfile
similarity index 100%
rename from .github/docker/zizmor/Dockerfile
rename to docker/zizmor/Dockerfile
diff --git a/phpunit.xml b/phpunit.xml
index d1175e9..bfdf6a6 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -60,6 +60,9 @@
tests/Example
+
+ tests/Repo
+
diff --git a/tests/GoNetHttp/GoNetHttpTest.php b/tests/GoNetHttp/GoNetHttpTest.php
index 7bc4b73..ff254e7 100644
--- a/tests/GoNetHttp/GoNetHttpTest.php
+++ b/tests/GoNetHttp/GoNetHttpTest.php
@@ -180,8 +180,8 @@ function scopeEvents(array $events, string $bytes, Closure $shown, int $maxHead)
expect('go'.$go)->toBe(GoReference::version())
->and(file_get_contents(__DIR__.'/install-go.php'))->toContain("'go".$go."' => [")
- ->and(file_get_contents(__DIR__.'/../../.github/docker/debian/Dockerfile'))->toContain('FROM golang:'.$go.'@')
- ->and(file_get_contents(__DIR__.'/../../.github/docker/alpine/Dockerfile'))->toContain('FROM golang:'.$go.'-alpine@');
+ ->and(file_get_contents(__DIR__.'/../../docker/debian/Dockerfile'))->toContain('FROM golang:'.$go.'@')
+ ->and(file_get_contents(__DIR__.'/../../docker/alpine/Dockerfile'))->toContain('FROM golang:'.$go.'-alpine@');
})->group('pins');
// A git blob is the SHA-1 of `blob \0`. VERSION is not in go.lock, because it
diff --git a/tests/Repo/DependabotTest.php b/tests/Repo/DependabotTest.php
new file mode 100644
index 0000000..30f24f3
--- /dev/null
+++ b/tests/Repo/DependabotTest.php
@@ -0,0 +1,39 @@
+ substr($line, 8), explode("\n", trim($match[1] ?? '', "\n")));
+
+ $dockerfiles = [];
+ $iterator = new RecursiveIteratorIterator(new RecursiveCallbackFilterIterator(
+ new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS),
+ static fn (SplFileInfo $file): bool => ! in_array($file->getFilename(), ['.claude', '.frankenphp', '.git', '.go', '.tmp', 'vendor'], true),
+ ));
+
+ foreach ($iterator as $file) {
+ assert($file instanceof SplFileInfo);
+
+ if ($file->getFilename() === 'Dockerfile') {
+ $dockerfiles[] = substr($file->getPath(), strlen($root));
+ }
+ }
+
+ sort($dockerfiles);
+
+ // GitHub refuses a pull request of the docker ecosystem that changes a file under .github.
+ expect(array_values(array_filter($directories, static fn (string $directory): bool => str_starts_with($directory, '/.github'))))->toBe([])
+ ->and($directories)->toBe($dockerfiles)
+ ->toContain('/demo', '/docker/debian');
+});
+
+it('leaves the Dockerfiles out of the package', function (): void {
+ $attributes = (string) file_get_contents(dirname(__DIR__, 2).'/.gitattributes');
+
+ expect($attributes)->toContain("\n/docker export-ignore\n", "\n/demo export-ignore\n");
+});