Skip to content

Commit

Permalink
Merge pull request #15 from studio24/update-to-deployer-7
Browse files Browse the repository at this point in the history
Update to deployer 7
  • Loading branch information
simonrjones authored May 7, 2024
2 parents 52b105c + 7ad5b8c commit a86dbbb
Show file tree
Hide file tree
Showing 56 changed files with 2,048 additions and 720 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ jobs:

strategy:
matrix:
php-versions: ['7.3', '7.4']
php-versions: ['8.0', '8.1', '8.2', '8.3']

runs-on: ubuntu-latest

steps:
# https://github.com/marketplace/actions/checkout
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

# https://github.com/marketplace/actions/setup-php-action
- name: Setup PHP
Expand All @@ -28,8 +29,6 @@ jobs:
ini-values: post_max_size=256M, max_execution_time=180
tools: composer

- uses: actions/checkout@v2

- name: Check PHP version
run: php -v

Expand All @@ -42,5 +41,3 @@ jobs:
- name: Coding standards
run: ./vendor/bin/phpcs

- name: PHPUnit
run: ./vendor/bin/phpunit
47 changes: 14 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,28 @@ must accept these license and copyright conditions.

## Organising code

New tasks must be added to the `tasks/` folder and required in the [`all.php`](all.php) file to ensure it is available for
New tasks must be added to the `tasks/` folder and required in the [`recipe/common.php`](all.php) file to ensure it is available for
users who load all Studio 24 Deployer tasks.

Where possible extract any testable code into a class in the `src/` folder with the `Studio24\Deployer` namespace. You
can then use these in your Deployer task via `use` statements. E.g.
## Code must be standalone

From v7 Deployer is distributed in a Phar file.
We recommend you do not use additional Composer packages in your code that do not already exist in Deployer,
to avoid the risk of clashing with the Deployer vendor packages.

## Coding standards

All contributions must be made on a branch and must pass coding standards.

To check these locally run:

```
use Studio24\Deployer\Check;
./vendor/bin/phplint
./vendor/bin/phpcs
```

You should then [write a unit test](https://phpunit.de/getting-started/phpunit-9.html) to help test functionality in the
`tests/` folder. In this manner the tasks become simple and rather like "thin controllers" with functionality
moved into classes in the `src/` folder

## Pull Requests

All contributions must be made on a branch and must pass coding standards.

Please create a Pull Request to merge changes into master, these will be automatically tested by
[GitHub Actions](https://github.com/studio24/deployer-recipes/actions/workflows/php.yml).

Expand All @@ -45,26 +49,3 @@ To create a new release do the following:
at GitHub. This will automatically create a new release at [Packagist](https://packagist.org/packages/studio24/deployer-recipes)
so code can be loaded via Composer.

## Tests

Please add unit tests for all bug fixes and new code changes.

Run PHPUnit tests via:

```
vendor/bin/phpunit
```

## Coding standards

Strata follows the [PSR-12](https://www.php-fig.org/psr/psr-12/) coding standard. You can check this with:

```
vendor/bin/phpcs
```

Where possible you can auto-fix code via:

```
vendor/bin/phpcbf
```
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) 2021 Studio 24
Copyright (c) 2021-2024 Studio 24

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
80 changes: 24 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,53 @@
# Deployer recipes

Deployer recipes to aid deployment via https://deployer.org
This package contains [Deployer](https://deployer.org/) recipes used to help deploy Studio 24 projects.

[![license][license-badge]][LICENSE]

## Installation

Install via Composer:
## Requirements

```
composer require studio24/deployer-recipes:^1.1 --dev
```
* PHP 8.0+ (Deployer 7)
* PHP 7.2 (Deployer 6)
* [Composer](https://getcomposer.org/)

Install all Studio 24 Deployer tasks by adding this to your `deploy.php`:
## Documentation

```php
require 'vendor/studio24/deployer-recipes/all.php';
```
View [documentation](docs/README.md).

To only install individual tasks, see the docs for each task.
If you want to contribute to this project, please read the [contribution guidelines](CONTRIBUTING.md).

### Running Deployer
## Installation

Please note this project uses a local Deployer installation (via Composer) not a global version of Deployer. This is so we
can make use of other Composer packages in deployment tasks reliably.
### Deployer 7 (PHP 8.0+)

To run deployments please use:
Install via Composer:

```
vendor/bin/dep deploy environment
```
composer require studio24/deployer-recipes:^2.0 --dev
```

rather than:
See [installation instructions](docs/installation.md).

```
dep deploy environment
```
### Deployer 6 (PHP 7.2–7.4)

If you wish, you can [install vendor binaries to another location](https://getcomposer.org/doc/articles/vendor-binaries.md#can-vendor-binaries-be-installed-somewhere-other-than-vendor-bin-)
by editing your project composer.json file. For example, to install to `bin` so you can run deployer via `bin/dep`:
Install via Composer:

```json
{
"config": {
"bin-dir": "bin"
}
}
```
composer require studio24/deployer-recipes:^1.1 --dev
```

## Tasks

The following tasks are available:

* [s24:build-summary](docs/build-summary.md) - create a `_build_summary.json` file to record deployment info
* [s24:check-branch](docs/check-branch.md) - ensure only default branch (main/master) is deployed to production
* [s24:check-local-deployer](docs/check-local-deployer.md) - checks that deployment is running via the local Deployer install
* [s24:confirm-continue](docs/confirm-continue.md) - ask confirmation from user before continuing with deployment
* [s24:display-disk-space](docs/display-disk-space.md) - display server disk usage prior to deployment
* [s24:notify-slack](docs/notify-slack.md) - send a notification to Slack on production deploy
* [s24:show-summary](docs/show-summary.md) - display a summary of the current deployment info
* [s24:vendors-subpath](docs/vendors-subpath.md) - Run composer install in a sub-path
* [sync](docs/sync.md) - sync files or folders from the remote host to local development

## Full deploy example

A sample of a full deploy file can be found in `examples/deploy.php`
See [installation instructions](https://github.com/studio24/deployer-recipes/tree/v1.1.0).

To use this file in a project copy it to your project root and update the config variables.
## Running Deployer

Please edit `deploy.php` depending on your needs. For example if you don't need to run Composer during deployment remove the line:
To run deployments use:

```
// Composer install
'deploy:vendors,',
```
dep deploy <environment> --branch=<branch name>
```

## Requirements
See [usage documentation](docs/usage.md).

* PHP 7.2+
* [Composer](https://getcomposer.org/)
* [Deployer](https://deployer.org/) 6.8+

[LICENSE]: ./LICENSE
[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg
12 changes: 0 additions & 12 deletions all.php

This file was deleted.

14 changes: 3 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,12 @@
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Studio24\\Deployer\\": "src/"
}
},
"require": {
"php": ">=7.2",
"ext-json": "*",
"deployer/deployer": "^6.8",
"symfony/http-client": "^5.2"
"php": ">=8.0",
"deployer/deployer": "^7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"overtrue/phplint": "^2.3",
"squizlabs/php_codesniffer": "^3.5"
"squizlabs/php_codesniffer": "^3.7"
}
}
37 changes: 37 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Studio 24 Deployer recipes documentation

This package contains [Deployer](https://deployer.org/) recipes used to help deploy Studio 24 projects.

## Installation

* [Installation](installation.md) - how to use Deployer for a project
* [Upgrading](upgrading.md) - how to upgrade from v1 (Deployer 6) to v2 (Deployer 7)

## How to use Deployer

* [Usage](usage.md) - how to perform different tasks with Deployer
* [Common issues](common-issues.md) - common issues and how to resolve them

## Recipes

* [Slack](recipes/slack.md) - send a notification to Slack when a deployment is complete

## Deployment tasks

* [build-summary](tasks/build-summary.md) - create a `_build_summary.json` file to record deployment info
* [check:branch](tasks/check-branch.md) - ensure only default branch (main/master) is deployed to production
* [check:disk-space](tasks/check-disk-space.md) - display server disk usage prior to deployment
* [confirm-continue](tasks/confirm-continue.md) - ask confirmation from user before continuing with deployment
* [show](tasks/show-summary.md) - display a summary of the current deployment info
* [vendors-subpath](tasks/vendors-subpath.md) - Run composer install in a sub-path

## Utility tasks

* [check:disk-space](tasks/check-disk-space.md) - display server disk usage prior to deployment
* [check:ssh](tasks/check-ssh.md) - check SSH connection to remote server
* [logs:list](tasks/logs.md) - list available log files
* [logs:view](tasks/logs.md) - view a log file
* [logs:search](tasks/logs.md) - search a log file
* [logs:download](tasks/download.md) - download a log file
* [show](tasks/show-summary.md) - display a summary of the current deployment info
* [sync](tasks/sync.md) - sync files or folders from the remote host to local development
55 changes: 0 additions & 55 deletions docs/check-branch.md

This file was deleted.

36 changes: 0 additions & 36 deletions docs/check-local-deployer.md

This file was deleted.

Loading

0 comments on commit a86dbbb

Please sign in to comment.