Skip to content

Commit e9f2da6

Browse files
committed
improve
1 parent 8b3b8b8 commit e9f2da6

File tree

10 files changed

+74
-37
lines changed

10 files changed

+74
-37
lines changed

.env.example

Lines changed: 0 additions & 2 deletions
This file was deleted.

.env.test

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,47 @@ on:
2222
name: build
2323

2424
jobs:
25-
build:
26-
uses: yiisoft/actions/.github/workflows/codeception.yml@master
27-
with:
28-
extensions: fileinfo, intl
29-
os: >-
30-
['ubuntu-latest', 'windows-latest']
31-
php: >-
32-
['8.1', '8.2', '8.3']
25+
codeception:
26+
name: PHP ${{ matrix.php }}-${{ matrix.os }}
27+
28+
env:
29+
key: cache-v1
30+
YII_C3: true
31+
YII_ENV: testing
32+
YII_DEBUG: false
33+
34+
runs-on: ${{ matrix.os }}
35+
36+
strategy:
37+
matrix:
38+
os:
39+
- ubuntu-latest
40+
- windows-latest
41+
php:
42+
- "8.1"
43+
- "8.2"
44+
- "8.3"
45+
46+
steps:
47+
- name: Checkout.
48+
uses: actions/checkout@v4
49+
50+
- name: Install PHP with extensions.
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
coverage: false
54+
extensions: fileinfo, intl
55+
ini-values: date.timezone='UTC'
56+
php-version: ${{ matrix.php }}
57+
58+
- name: Install Composer dependencies
59+
uses: ramsey/composer-install@v3
60+
61+
- name: Run tests with codeception with code coverage with shell bash.
62+
if: matrix.os == 'ubuntu-latest'
63+
run: vendor/bin/codecept run
64+
65+
- name: Run tests with codeception with code coverage with shell powershell.
66+
if: matrix.os == 'windows-latest'
67+
run: vendor/bin/codecept run
68+
shell: powershell

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ exec: ## Run a command within the existing container.
2929
run: ## Run a command within a temporary container.
3030
docker compose -f docker/compose.yml -f docker/compose.dev.yml run --rm --entrypoint $(CMD) app $(RUN_ARGS)
3131

32+
run-test: ## Run a command in testing environment.
33+
docker compose -f docker/compose.yml -f docker/compose.test.yml run --rm --entrypoint $(CMD) app $(RUN_ARGS)
34+
3235
shell: CMD="/bin/sh" ## Get into container shell.
3336
shell: exec
3437

@@ -39,7 +42,7 @@ composer: CMD="composer" ## Run Composer.
3942
composer: run
4043

4144
codecept: CMD="./vendor/bin/codecept" ## Run Codeception.
42-
codecept: run
45+
codecept: run-test
4346

4447
psalm: CMD="./vendor/bin/psalm" ## Run Psalm.
4548
psalm: run

codeception.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,3 @@ coverage:
2323
- src/Asset/*
2424
- src/Installer.php
2525
bootstrap: bootstrap.php
26-
params:
27-
- tests/params.php

composer.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,10 @@
3535
"test": "codecept run",
3636
"test-watch": "phpunit-watcher watch",
3737
"post-install-cmd": [
38-
"App\\Installer::postUpdate",
39-
"App\\Installer::copyEnvFile"
38+
"App\\Installer::postUpdate"
4039
],
4140
"post-update-cmd": [
42-
"App\\Installer::postUpdate",
43-
"App\\Installer::copyEnvFile"
44-
],
45-
"post-create-project-cmd": [
46-
"App\\Installer::copyEnvFile"
41+
"App\\Installer::postUpdate"
4742
]
4843
},
4944
"require": {

docker/compose.test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
services:
2+
app:
3+
build:
4+
dockerfile: docker/Dockerfile
5+
context: ..
6+
target: dev
7+
args:
8+
UID: ${UID}
9+
GID: ${GID}
10+
environment:
11+
XDEBUG_MODE: "off"
12+
YII_ENV: "testing"
13+
YII_DEBUG: "false"
14+
SERVER_NAME: ":80"
15+
volumes:
16+
- ../:/app
17+
- ../runtime:/app/runtime
18+
- ${COMPOSER_CACHE_DIR:-~/.cache/composer}:/var/www/.composer
19+
- caddy_data:/data
20+
- caddy_config:/config
21+
tty: true
22+

src/Installer.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,4 @@ private static function chmodRecursive(string $path, int $mode): void
3333
chmod($item, $mode);
3434
}
3535
}
36-
37-
public static function copyEnvFile(): void
38-
{
39-
if (!file_exists('.env')) {
40-
copy('.env.example', '.env');
41-
}
42-
}
4336
}

tests/Cli/ConsoleCest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
use App\Tests\Support\CliTester;
88

9+
use function dirname;
10+
911
final class ConsoleCest
1012
{
1113
public function testCommandYii(CliTester $I): void

tests/params.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)