Skip to content

Commit

Permalink
gst
Browse files Browse the repository at this point in the history
  • Loading branch information
dnicknick committed Jan 10, 2024
1 parent 9856f1a commit b1a4580
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- NDybnov/hw21

env:
COMMENT: 'my-comment-env'
APP_VERSION: 'v01100600'

jobs:
deployment:
runs-on: ubuntu-latest
Expand All @@ -15,3 +19,5 @@ jobs:
- name: deploy
run: |
echo '..deploy...'
echo ${{ env.APP_VERSION }}
echo ${{ env.COMMENT }}
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test

on:
push:
branches:
- NDybnov/hw21

env:
COMMENT: 'my-comment-env'
APP_VERSION: 'v01100600'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: |
docker compose build
docker compose up --detach
- uses: actions/checkout@v3
- name: Copy .env
run: docker compose exec deploy-php-cli php -r "file_exists('.env') || copy('.env.example', '.env');"
#update values
- name: Install Dependencies
run: docker compose exec deploy-php-cli composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: docker compose exec deploy-php-cli vendor/phpunit/phpunit/phpunit tests
- name: Test run vie Curl
run: docker compose exec deploy-php-cli curl 0.0.0.0:8000
3 changes: 2 additions & 1 deletion app/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
APP_VERSION=3a4cdb6
OWN_NGINX_PORT=80
APP_VERSION=123
COMMENT='last comment'
2 changes: 2 additions & 0 deletions app/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"name": "hw/app-deploy",
"description": "nothing",
"type": "project",
"license": "proprietary",
"require": {
"ndybnov-hw03/cnf-read": "^1.1"
},
Expand Down
2 changes: 0 additions & 2 deletions app/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ version: '3'

services:
deploy-php-cli:
# image: php:8.3.1-cli-alpine
build:
context: ./.docker/php-cli/
dockerfile: Dockerfile
Expand All @@ -12,4 +11,3 @@ services:
- ./:/app
ports:
- ${OWN_NGINX_PORT}:8000
# command: php -S 0.0.0.0:8000 -t /app
47 changes: 32 additions & 15 deletions app/index.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
<?php

//echo PHP_VERSION_ID;
echo PHP_VERSION;
//echo 123;
// phpinfo();
require_once __DIR__ . '/vendor/autoload.php';

echo '<br/>';
print_r($_ENV);
echo '<br/>';
var_export($_SERVER);
echo '<br/>';
use NdybnovHw03\CnfRead\ConfigStorage;

print_r(getenv());
echo '<br/>';

putenv('app_version=c3224e0');
$config = (new ConfigStorage())
->fromDotEnvFile([__DIR__, '.env']);

echo '<br/>';
$version = $config->get('APP_VERSION');
$comment = $config->get('COMMENT');

print_r(getenv());
echo '<br/>';
putenv('app_version=' . $version);
putenv('comment=' . $comment);

$version = sprintf(
'%s:%s:%s',
PHP_VERSION,
getenv('app_version'),
getenv('comment'),
);
echo $version;

var_dump($_ENV);


function dddddd(): int
{
return 0;
}


class Dd {
public function ddd(): int
{
return 0;
}
}
12 changes: 12 additions & 0 deletions app/tests/DefaultTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php


use PHPUnit\Framework\TestCase;

class DefaultTest extends TestCase
{
public function testDefault(): void
{
$this->assertTrue(true);
}
}

0 comments on commit b1a4580

Please sign in to comment.