Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore development files on production env #373

Merged
merged 32 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ebfd1fb
ignore development files on production env
MarioRadu Dec 12, 2024
bd1e88d
ignore development files on production env
MarioRadu Dec 12, 2024
20d24c4
ignore development files on production env
MarioRadu Dec 12, 2024
62e6193
ignore development files on production env
MarioRadu Dec 12, 2024
a58181b
ignore development files on production env
MarioRadu Dec 12, 2024
d715ee1
ignore development files on production env
MarioRadu Dec 12, 2024
abf7322
ignore development files on production env
MarioRadu Dec 12, 2024
f2cae4f
ignore development files on production env
MarioRadu Dec 12, 2024
4d7bae9
ignore development files on production env
MarioRadu Dec 12, 2024
2e59e46
ignore development files on production env
MarioRadu Dec 12, 2024
dfce5a5
ignore development files on production env
MarioRadu Dec 12, 2024
2b3fb46
ignore development files on production env
MarioRadu Dec 12, 2024
e2ebd6e
ignore development files on production env
MarioRadu Dec 12, 2024
e18b11f
ignore development files on production env
MarioRadu Dec 12, 2024
94511b8
ignore development files on production env
MarioRadu Dec 12, 2024
d45b2e0
ignore development files on production env
MarioRadu Dec 12, 2024
385b746
ignore development files on production env
MarioRadu Dec 12, 2024
e2d7f50
ignore development files on production env
MarioRadu Dec 12, 2024
a9905ad
ignore development files on production env
MarioRadu Dec 12, 2024
84043db
ignore development files on production env
MarioRadu Dec 12, 2024
64d5e82
ignore development files on production env
MarioRadu Dec 12, 2024
a1671b8
ignore development files on production env
MarioRadu Dec 12, 2024
67f686c
ignore development files on production env
MarioRadu Dec 12, 2024
644710c
ignore development files on production env
MarioRadu Dec 12, 2024
71ebe0e
ignore development files on production env
MarioRadu Dec 12, 2024
a7fb0cd
ignore development files on production env
MarioRadu Dec 12, 2024
e035b67
ignore development files on production env
MarioRadu Dec 12, 2024
81a3b71
ignore development files on production env
MarioRadu Dec 12, 2024
8b69410
ignore development files on production env
MarioRadu Dec 12, 2024
f55d182
ignore development files on production env
MarioRadu Dec 12, 2024
fbfae3c
ignore development files on production env
MarioRadu Dec 12, 2024
5e68754
ignore development files on production env
MarioRadu Dec 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
- name: Install dependencies with composer
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Setup project
run: |
mv config/autoload/local.test.php.dist config/autoload/local.test.php

- name: Collect code coverage with PHPUnit
run: vendor/bin/phpunit --colors=always --coverage-clover clover.xml

Expand Down
3 changes: 1 addition & 2 deletions .laminas-ci/pre-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ JOB=$3
PHP_VERSION=$4
COMMAND=$(echo "${JOB}" | jq -r '.command')

echo "Running $COMMAND"
echo "Running pre-run $COMMAND"

if [[ ${COMMAND} =~ phpunit ]];then

apt-get install php"${PHP_VERSION}"-sqlite3

cp config/autoload/local.php.dist config/autoload/local.php
cp config/autoload/mail.global.php.dist config/autoload/mail.global.php
cp config/autoload/local.test.php.dist config/autoload/local.test.php

fi
23 changes: 20 additions & 3 deletions bin/composer-post-install-script.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,50 @@

declare(strict_types=1);

const ENVIRONMENT_DEVELOPMENT = 'development';
const ENVIRONMENT_PRODUCTION = 'production';

// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols

function copyFile(array $file): void
{
if (is_readable($file['destination'])) {
echo "File {$file['destination']} already exists." . PHP_EOL;
} else {
if (! copy($file['source'], $file['destination'])) {
echo "Cannot copy {$file['source']} file to {$file['destination']}" . PHP_EOL;
if (! in_array(getEnvironment(), $file['environment'])) {
MarioRadu marked this conversation as resolved.
Show resolved Hide resolved
echo "Skipping the copy of {$file['source']} due to environment settings." . PHP_EOL;
} else {
echo "File {$file['source']} copied successfully to {$file['destination']}." . PHP_EOL;
if (! copy($file['source'], $file['destination'])) {
echo "Cannot copy {$file['source']} file to {$file['destination']}" . PHP_EOL;
} else {
echo "File {$file['source']} copied successfully to {$file['destination']}." . PHP_EOL;
}
}
}
}

function getEnvironment(): string
{
return file_exists('config/development.local.php') ? ENVIRONMENT_DEVELOPMENT : ENVIRONMENT_PRODUCTION;
}

// when adding files to the below array the `source` and `destination` paths must be relative to the project root folder
// the `environment` key will indicate on what environments the file will be copied,
$files = [
[
'source' => 'config/autoload/local.php.dist',
'destination' => 'config/autoload/local.php',
'environment' => [ENVIRONMENT_DEVELOPMENT, ENVIRONMENT_PRODUCTION],
],
[
'source' => 'config/autoload/local.test.php.dist',
'destination' => 'config/autoload/local.test.php',
'environment' => [ENVIRONMENT_DEVELOPMENT],
],
[
'source' => 'vendor/dotkernel/dot-mail/config/mail.global.php.dist',
'destination' => 'config/autoload/mail.global.php',
'environment' => [ENVIRONMENT_DEVELOPMENT, ENVIRONMENT_PRODUCTION],
],
];

Expand Down
Loading