Files
coolify/tests/Unit/ProductionImageWorkflowTest.php
T
peaklabs-dev 06ad71439c build: move the helper image to coollabsio/coolify-helper
- Docker Compose builds the development helper from the main branch of that repository, scripts/dev-helper from there or from a local checkout
- Remove buildHelperImage from the settings, nothing calls it since its button was removed
2026-11-02 00:03:45 +01:00

68 lines
3.7 KiB
PHP

<?php
it('reads the Coolify and helper versions by key from the versions.json of the CDN in install.sh', function () {
$versions = shell_exec("jq --indent 4 --arg version 4.6.0-beta.1 '{coolify: ({v4: {\$version}} + del(.traefik)), traefik}' ".escapeshellarg(dirname(__DIR__, 2).'/upstream.json'));
$parse = implode("\n", preg_grep('/^LATEST_(HELPER_)?VERSION=\$\(echo "\$VERSIONS_JSON"/', file(dirname(__DIR__, 2).'/scripts/install.sh')));
$output = shell_exec('VERSIONS_JSON='.escapeshellarg($versions).' bash -c '.escapeshellarg($parse."\necho \"\$LATEST_VERSION \$LATEST_HELPER_VERSION\""));
$helper = json_decode(file_get_contents(dirname(__DIR__, 2).'/upstream.json'), true)['helper']['version'];
expect(trim($output))->toBe("4.6.0-beta.1 {$helper}");
});
it('builds the development helper image from the coolify-helper repository', function (string $file) {
expect(file_get_contents(dirname(__DIR__, 2)."/{$file}"))->toContain('https://github.com/coollabsio/coolify-helper.git#main:src');
})->with(['scripts/dev-helper', 'docker-compose.dev.yml', 'docker-compose.dev-multi.yml']);
it('publishes the testing host only to Docker Hub', function () {
$workflow = file_get_contents(dirname(__DIR__, 2).'/.github/workflows/coolify-testing-host.yml');
$cleanupWorkflow = file_get_contents(dirname(__DIR__, 2).'/.github/workflows/cleanup-ghcr-untagged.yml');
$windowsCompose = file_get_contents(dirname(__DIR__, 2).'/docker-compose.windows.yml');
$developmentCompose = file_get_contents(dirname(__DIR__, 2).'/docker-compose.dev.yml');
expect($workflow)
->toContain('DOCKER_REGISTRY: docker.io')
->toContain('IMAGE_NAME: "coollabsio/coolify-testing-host"')
->toContain('docker/testing-host/Dockerfile')
->not->toContain('ghcr.io')
->not->toContain('GITHUB_REGISTRY')
->and($cleanupWorkflow)->not->toContain('coolify-testing-host')
->and($windowsCompose)->toContain('docker.io/coollabsio/coolify-testing-host:latest')
->and($developmentCompose)->toContain('image: coolify-testing-host:dev')
->toContain('dockerfile: ./docker/testing-host/Dockerfile');
});
it('documents pull request targets for fixes and features', function () {
$contributingGuide = file_get_contents(dirname(__DIR__, 2).'/CONTRIBUTING.md');
expect($contributingGuide)
->toContain('Fixes and small improvements')
->toContain('target `main`')
->toContain('New features and larger changes')
->toContain('target `next`')
->toContain('branch from `main`')
->toContain('branch from `next`')
->not->toContain('All pull requests must target the `next` branch');
});
it('guides issue authors to the correct contribution branch', function () {
$bugReport = file_get_contents(dirname(__DIR__, 2).'/.github/ISSUE_TEMPLATE/01_BUG_REPORT.yml');
$issueConfig = file_get_contents(dirname(__DIR__, 2).'/.github/ISSUE_TEMPLATE/config.yml');
expect($bugReport)
->toContain('branch from `main` and target `main`')
->and($issueConfig)
->toContain('Feature code should branch from `next` and target `next`')
->toContain('Small fixes should target `main`; larger changes should target `next`');
});
it('writes versions.json in the production image from upstream.json so version checks work right after an upgrade', function () {
$dockerfile = file_get_contents(dirname(__DIR__, 2).'/docker/production/Dockerfile');
$dockerignore = file_get_contents(dirname(__DIR__, 2).'/.dockerignore');
expect($dockerfile)
->toContain('COPY --chown=www-data:www-data release.json upstream.json ./')
->toContain('upstream.json > versions.json')
->and($dockerignore)
->not->toMatch('/^\/?(release|upstream)\.json$/m');
});