Skip to content

Commit

Permalink
Upgrade to Deployer v7
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Sep 3, 2024
1 parent facfad8 commit ec23f49
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 173 deletions.
13 changes: 3 additions & 10 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
/etc export-ignore
/features export-ignore
/spec export-ignore
/tests export-ignore
/.github export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/easy-coding-standard.yaml export-ignore
/phpspec.yml.dist export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
/ecs.php export-ignore
/psalm.xml export-ignore
/README.md export-ignore
14 changes: 0 additions & 14 deletions .github/dependabot.yml

This file was deleted.

24 changes: 12 additions & 12 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "build"
on:
push:
branches:
- "master"
- "*.x"
paths-ignore:
- "*.md"
pull_request:
Expand All @@ -22,14 +22,14 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.1"

dependencies:
- "highest"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
Expand All @@ -39,7 +39,7 @@ jobs:
coverage: "none"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"

Expand All @@ -60,17 +60,17 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"

dependencies:
- "lowest"
- "highest"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
Expand All @@ -81,7 +81,7 @@ jobs:
tools: "composer-require-checker, composer-unused"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"

Expand All @@ -99,17 +99,17 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"

dependencies:
- "lowest"
- "highest"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
Expand All @@ -119,7 +119,7 @@ jobs:
coverage: "none"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Setono
Copyright (c) 2024 Setono

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,9 @@ The following Deployer parameters are defined:

| Parameter | Description | Default value |
|-------------------------|--------------------------------------------------------------------------------------------------|-----------------------------------------------|
| cron_source_dir | The directory to search for cronjob config files | `etc/cronjobs` |
| cron_config_dir | The directory to search for cronjob config files | `etc/cronjobs` |
| cron_delimiter | The marker in the crontab file that delimits the generated cronjobs from manually added cronjobs | `{{application}} ({{stage}})` |
| cron_variable_resolvers | An array of variable resolvers to add to the cron builder | `[]` |
| cron_context | The context to give as argument to the `CronBuilder::build` method | `[ 'stage' => get('stage') ]` |
| cron_user | The user onto which the crontab should be added | `get('http_user')` if you are root, else `''` |
| cron_dry_run | If true, this recipe will not apply the generated crontab | `false` |

**NOTICE** that the default value of `cron_variable_resolvers` is an empty array, but this lib will always add a
`ReplacingVariableResolver` with the variables described in the section [below](#extra-variables-available).
| cron_user | The user onto which the crontab should be added (default is `remote_user`) | `get('http_user')` if you are root, else `''` |

## Build context

Expand Down
24 changes: 14 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
}
],
"require": {
"php": ">=7.4",
"deployer/deployer": "^6.8",
"setono/cron-builder": "^0.3.1",
"symfony/console": "^4.4 || ^5.4 || ^6.0",
"php": ">=8.1",
"deployer/deployer": "^7.4",
"setono/cron-builder": "1.x-dev",
"symfony/console": "^5.4 || ^6.4 || ^7.0",
"symfony/finder": "^5.4 || ^6.4 || ^7.0",
"webmozart/assert": "^1.10"
},
"require-dev": {
"setono/code-quality-pack": "^2.1.3"
"setono/code-quality-pack": "^2.8.2"
},
"prefer-stable": true,
"autoload": {
Expand All @@ -28,18 +29,21 @@
"src/autoload.php"
]
},
"autoload-dev": {
"psr-4": {
"Deployer\\": "vendor/deployer/deployer/src/"
},
"files": [
"vendor/deployer/deployer/src/functions.php"
]
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false,
"ergebnis/composer-normalize": true
},
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"scripts": {
"analyse": "psalm",
"check-style": "ecs check",
Expand Down
9 changes: 4 additions & 5 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php');
$containerConfigurator->parameters()->set(Option::PATHS, [
return static function (ECSConfig $config): void {
$config->import('vendor/sylius-labs/coding-standard/ecs.php');
$config->paths([
'src',
]);
};
6 changes: 5 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0"?>
<psalm
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
errorLevel="1"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="false"
findUnusedCode="false"
findUnusedPsalmSuppress="false"
findUnusedVariablesAndParams="false"
errorLevel="2"
>
<projectFiles>
<directory name="src"/>
Expand Down
6 changes: 3 additions & 3 deletions src/recipe/cron.php → src/recipe/setono_cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
use function Deployer\after;
use function Deployer\before;

require_once 'task/cron.php';
require_once 'task/setono_cron.php';

before('deploy:prepare', 'cron:prepare');

// apply the cron just before symlinking. This is where all the necessary parameters are available, i.e. 'release_path'
before('deploy:symlink', 'cron:apply');
// apply the cron just before symlinking. This is where the release_path is available
before('deploy:symlink', 'cron:build');

// cleanup created files
after('cleanup', 'cron:cleanup');
Expand Down
109 changes: 0 additions & 109 deletions src/task/cron.php

This file was deleted.

Loading

0 comments on commit ec23f49

Please sign in to comment.