Skip to content

Commit

Permalink
ci: better display in CI + introduce 'ci' context
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Mar 15, 2024
1 parent f522001 commit 375c540
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
29 changes: 25 additions & 4 deletions .castor/docker.php
Expand Up @@ -287,7 +287,6 @@ function create_default_context(): Context
'power_shell' => false,
'user_id' => posix_geteuid(),
'root_dir' => \dirname(__DIR__),
'env' => $_SERVER['CI'] ?? false ? 'ci' : 'dev',
];

if (file_exists($data['root_dir'] . '/infrastructure/docker/docker-compose.override.yml')) {
Expand Down Expand Up @@ -331,9 +330,32 @@ function create_default_context(): Context
$data['user_id'] = 1000;
}

return new Context($data, pty: 'dev' === $data['env']);
return new Context(
$data,
pty: Process::isPtySupported(),
environment: [
'BUILDKIT_PROGRESS' => 'plain',
]
);
}

#[AsContext(name: 'ci')]
function create_ci_context(): Context
{
$c = create_default_context();

return $c
->withData([
// override the default context here
])
->withEnvironment([
'BUILDKIT_PROGRESS' => 'plain',
'COMPOSE_ANSI' => 'never',
])
;
}


/**
* @param array<string> $subCommand
*/
Expand All @@ -353,8 +375,7 @@ function docker_compose(array $subCommand, ?Context $c = null, bool $withBuilder
'USER_ID' => variable('user_id'),
'COMPOSER_CACHE_DIR' => variable('composer_cache_dir'),
'PHP_VERSION' => variable('php_version'),
'BUILDKIT_PROGRESS' => 'plain',
])
], true)
;

$command = [
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -11,6 +11,9 @@ name: Continuous Integration
permissions:
contents: read

env:
COMPOSE_ANSI: never

jobs:
check-dockerfiles:
name: Check Dockerfile
Expand All @@ -33,8 +36,6 @@ jobs:
runs-on: ubuntu-latest
env:
DS_PHP_VERSION: ${{ matrix.php-version }}
BUILDKIT_PROGRESS: plain
CI: 1
steps:
- uses: actions/checkout@v4

Expand Down

0 comments on commit 375c540

Please sign in to comment.