Skip to content

Commit

Permalink
added initial set of files
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrixx committed Mar 15, 2024
0 parents commit 1fbee42
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI

"on":
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ansi:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- run: |
set -ex
docker compose --ansi=always up -d
docker compose --ansi=always stop
no-ansi:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- run: |
set -ex
docker compose --ansi=never up -d
docker compose --ansi=never stop
castor:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cmd:
- ansi-false-false
- ansi-false-true
- ansi-true-false
- no-ansi-false-false
- no-ansi-false-true
- no-ansi-true-false
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: castor

- run: |
set -ex
castor debug
castor ${{ matrix.cmd }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.castor.stub.php
72 changes: 72 additions & 0 deletions castor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

use Castor\Attribute\AsTask;
use Castor\Context;

use function Castor\run;

#[AsTask()]
function ansi_false_false()
{
$c = new Context(
pty: false,
tty: false,
);
run(['docker', 'compose', '--ansi=always', 'up', '-d'], context: $c);
run(['docker', 'compose', '--ansi=always', 'stop'], context: $c);
}

#[AsTask()]
function ansi_true_false()
{
$c = new Context(
pty: true,
tty: false,
);
run(['docker', 'compose', '--ansi=always', 'up', '-d'], context: $c);
run(['docker', 'compose', '--ansi=always', 'stop'], context: $c);
}

#[AsTask()]
function ansi_false_true()
{
$c = new Context(
pty: false,
tty: true,
);
run(['docker', 'compose', '--ansi=always', 'up', '-d'], context: $c);
run(['docker', 'compose', '--ansi=always', 'stop'], context: $c);
}

#[AsTask()]
function no_ansi_false_false()
{
$c = new Context(
pty: false,
tty: false,
);
run(['docker', 'compose', '--ansi=never', 'up', '-d'], context: $c);
run(['docker', 'compose', '--ansi=never', 'stop'], context: $c);
}

#[AsTask()]
function no_ansi_true_false()
{
$c = new Context(
pty: true,
tty: false,
);
run(['docker', 'compose', '--ansi=never', 'up', '-d'], context: $c);
run(['docker', 'compose', '--ansi=never', 'stop'], context: $c);
}

#[AsTask()]
function no_ansi_false_true()
{
$c = new Context(
pty: false,
tty: true,
);
run(['docker', 'compose', '--ansi=never', 'up', '-d'], context: $c);
run(['docker', 'compose', '--ansi=never', 'stop'], context: $c);
}
13 changes: 13 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "3.7"

services:
s1:
image: hello-world
s2:
image: hello-world
s3:
image: hello-world
s4:
image: hello-world
s5:
image: hello-world

0 comments on commit 1fbee42

Please sign in to comment.