From f4957592cb41f70f9fa45325548426dbc8662edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Fri, 15 Mar 2024 20:08:24 +0100 Subject: [PATCH] ci: better display in CI + introduce 'ci' context --- .castor/docker.php | 25 ++++++++++++++++++++++--- .github/workflows/ci.yml | 7 +++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.castor/docker.php b/.castor/docker.php index 7505789..fc4088c 100644 --- a/.castor/docker.php +++ b/.castor/docker.php @@ -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')) { @@ -331,7 +330,28 @@ 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([ + 'COMPOSE_ANSI' => 'never', + ]) + ; } /** @@ -353,7 +373,6 @@ 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', ]) ; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3bb9b0..f4bda5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,11 @@ name: Continuous Integration permissions: contents: read +env: + # Fix for symfony/color detection. We know GitHub Actions can handle it + ANSICON: 1 + CASTOR_CONTEXT: ci + jobs: check-dockerfiles: name: Check Dockerfile @@ -33,8 +38,6 @@ jobs: runs-on: ubuntu-latest env: DS_PHP_VERSION: ${{ matrix.php-version }} - BUILDKIT_PROGRESS: plain - CI: 1 steps: - uses: actions/checkout@v4