Skip to content

Commit

Permalink
Merge pull request #456 from andres-montanez/galactica
Browse files Browse the repository at this point in the history
Galactica
  • Loading branch information
andres-montanez authored Apr 15, 2022
2 parents d6432d7 + a41e07e commit 0ccc2bb
Show file tree
Hide file tree
Showing 113 changed files with 1,370 additions and 1,012 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Linters

on:
push:
branches:
- master
- galactica
pull_request:
release:
types:
- created

jobs:
linters:
name: Linters
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Composer install
uses: php-actions/composer@v5
with:
command: install
args: --ignore-platform-reqs --no-scripts
version: 2
php_version: 8.0
- name: PHPStan
run: ./vendor/bin/phpstan analyse
- name: PHP Code Sniffer
run: ./vendor/bin/phpcs
60 changes: 60 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: PHPUnit

on:
push:
branches:
- master
- galactica
pull_request:
release:
types:
- created

jobs:
unit_tests_80:
name: Unit tests with PHP 8.0
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Composer install
uses: php-actions/composer@v5
with:
command: install
args: --ignore-platform-reqs --no-scripts
version: 2
php_version: 8.0
- name: Run tests
env:
XDEBUG_MODE: coverage
run: |
mkdir .logs
./vendor/bin/phpunit --coverage-clover build/logs/coverage.xml
- name: Run Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./vendor/bin/php-coveralls -v --coverage_clover build/logs/coverage.xml

unit_tests_81:
name: Unit tests with PHP 8.1
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Composer install
uses: php-actions/composer@v5
with:
command: install
args: --ignore-platform-reqs --no-scripts
version: 2
php_version: 8.1
- name: Run tests
env:
XDEBUG_MODE: coverage
run: |
mkdir .logs
./vendor/bin/phpunit --coverage-clover build/logs/coverage.xml
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
composer.lock
.mage.yml
.phpunit.result.cache

.phpcs-cache
.logs
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
language: php
php:
- '7.2'
- '7.4'
- '8.0'
- '8.1'

install:
- composer install
Expand Down
35 changes: 13 additions & 22 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
CHANGELOG for 4.X
CHANGELOG for 5.X
=================

* 4.1.1 (2021-02-20)
* Add `copyDirectory` option
* Bug fixes
* Improve testing and coverage


* 4.1.0 (2021-02-19)
* PHP 8 and Symfony 5 compatibility [PR#448]
* Timeout option for SSH [PR#436]
* Improve compatibility with Windows [PR#434] [PR#429]
* Improve config load [PR#422]
* Bug fixes [PR#448] [PR#424]
* Readme Update [PR#438]


* 4.0.0 (2018-04-02)
* v4 series release
* Refactored for Symfony 4 and PHP 7.1
* Symfony Pool Clear task added
* Symfony Pool Prune task added
* Symfony Assetic task removed
* 5.0.0 (2022-04-15)
* v5 series release.
* Refactored for Symfony 6 and PHP 8.
* Added strong types.
* Removed task `composer/self-update`.
* Allow `exec` task to interpolate `%environment%` and `%release%`.
* Added new `sleep` task to day execution [PR#414].
* Added new `symlink` option to define the name of symbolic link on the Release [PR#425].
* Improved Windows compatibility [PR#427].
* Added new `log_limit` option to limit how many logs are kept [Issue#403].
* Add new deploy option `--tag` to specify deploying a specific tag [Issue#192] [Issue#315].
* Added new `scp_flags` option for the `scp` command when SSH flags are incompatible with [Issue#439].
25 changes: 11 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Please read the following guidelines to make your and our work easier and cleane

1. Write clean code with no mess left
2. Contribute the docs when adding configurable new feature
3. Create your pull request from `nostromo` branch
3. Create your pull request from `galactica` branch
4. Ensure your code is fully covered by tests

----------
Expand All @@ -28,39 +28,36 @@ In order to have the PRs prioritized name them with the following tags.
[FEATURE] Create new PermissionsTask
[HOTFIX] Exception not caught on deployment
```
All Pull Requests must be done to the `nostromo` branch, only exception are Hotfixes.
All Pull Requests must be done to the `galactica` branch, only exception are Hotfixes.
Remember of square brackets when adding issue number. If you'd forget adding them, your whole message will be a comment!

# Developing Magallanes
## Branches
The flow is pretty simple.
In most common cases we work on the `nostromo` branch. It's the branch with the main development for the current major version. All Pull Requests must merge with that branch. The `master` branch is used to move the validated code and generate the releases in an orderly fashion, also we could use it for hotfixes.
In most common cases we work on the `galactica` branch. It's the branch with the main development for the current major version. All Pull Requests must merge with that branch. The `master` branch is used to move the validated code and generate the releases in an orderly fashion, also we could use it for hotfixes.

If you want to use developing branch in your code, simple pass `dev-nostromo` to dependency version in your `composer.json` file:
If you want to use developing branch in your code, simple pass `dev-galactica` to dependency version in your `composer.json` file:
```json
{
"require": {
"andres-montanez/magallanes": "dev-nostromo"
"andres-montanez/magallanes": "dev-galactica"
}
}
```

## Organization and code quality
We use [PSR2](http://www.php-fig.org/psr/psr-2/) as PHP coding standard.
We use [PSR-12](http://www.php-fig.org/psr/psr-12/) as PHP coding standard.

### Tools you can use to ensure your code quality

1. PHP-CodeSniffer
2. [PHP Mess Detector](https://phpmd.org/)
3. PHP Copy/Paste Detector
4. PHP Dead Code Detector
5. [PHP Coding Standards Fixer](http://cs.sensiolabs.org) with --level=psr2
1. PHPStan `./vendor/bin/phpstan analyse`
2. PHP Code Sniffer `./vendor/bin/phpcs`

## Testing and quality
We use PHPUnit to test our code. Most of the project is covered with tests, so if you want your code to be merged push it with proper testing and coverage (at least 95%). To execute the tests with code coverage report:
```
vendor/bin/phpunit --coverage-clover build/logs/coverage.xml
vendor/bin/coveralls -v --coverage_clover build/logs/coverage.xml
```bash
./vendor/bin/phpunit --coverage-clover build/logs/coverage.xml --coverage-text
./vendor/bin/php-coveralls -v --coverage_clover build/logs/coverage.xml
```

Tests structure follow almost the same structure as production code with `Test` suffix in class and file name. Follow the tests already made as guidelines.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2011 - 2017 Andrés Montañez
Copyright (c) 2011 - 2022 Andrés Montañez

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Magallanes
[![SymfonyInsight](https://insight.symfony.com/projects/ed0de53a-a12e-459b-9464-34def5907b56/mini.svg)](https://insight.symfony.com/projects/ed0de53a-a12e-459b-9464-34def5907b56)
[![Build Status](https://img.shields.io/travis/andres-montanez/Magallanes/master.svg)](https://travis-ci.org/andres-montanez/Magallanes)
![Linters](https://github.com/andres-montanez/Magallanes/actions/workflows/linters.yml/badge.svg?)
![Tests](https://github.com/andres-montanez/Magallanes/actions/workflows/tests.yml/badge.svg?)
[![Coverage Status](https://img.shields.io/coveralls/andres-montanez/Magallanes/master.svg)](https://coveralls.io/github/andres-montanez/Magallanes?branch=master)
[![Code Quality](https://img.shields.io/scrutinizer/g/andres-montanez/Magallanes.svg)](https://scrutinizer-ci.com/g/andres-montanez/Magallanes/)
[![Latest Stable Version](https://img.shields.io/packagist/v/andres-montanez/magallanes.svg?label=stable)](https://packagist.org/packages/andres-montanez/magallanes)
Expand All @@ -16,7 +16,7 @@ Simply add the following dependency to your project’s composer.json file:

```json
"require-dev": {
"andres-montanez/magallanes": "^4.0"
"andres-montanez/magallanes": "^5.0"
}
```
Finally you can use **Magallanes** from the vendor's bin:
Expand All @@ -25,5 +25,5 @@ Finally you can use **Magallanes** from the vendor's bin:
vendor/bin/mage version
```

### Codename Discovery One
Each new mayor version of **Magallanes** will have a codename (like Ubuntu), version 3 was _Nostromo_, and in the current version it is **_Discovery One_**, in homage to the spaceship from the ground breaking film *2001: A Space Odyssey (1968)*.
### Codename Galactica
Each new mayor version of **Magallanes** will have a codename (like Ubuntu), version 3 was _Nostromo_, version 4 was _Discovery One_, and in the current version it is **_Galactica_**, in homage to the space battleship from the TV series Battlestar Galactica, both the '70s and the mind blowing revision of 2005.
26 changes: 14 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@
}
],
"require": {
"php": "^7.2 | ^8.0",
"monolog/monolog": "~1.11 | ^2.0",
"symfony/console": "^4.0 | ^5.0",
"symfony/filesystem": "^4.0 | ^5.0",
"symfony/event-dispatcher": "^4.0 | ^5.0",
"symfony/finder": "^4.0 | ^5.0",
"symfony/yaml": "^4.0 | ^5.0",
"symfony/process": "^4.0 | ^5.0"
"php": "^8.0",
"monolog/monolog": "^2.5",
"symfony/console": "^6.0",
"symfony/filesystem": "^6.0",
"symfony/event-dispatcher": "^6.0",
"symfony/finder": "^6.0",
"symfony/yaml": "^6.0",
"symfony/process": "^6.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0",
"php-coveralls/php-coveralls": "~2.0"
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.5",
"squizlabs/php_codesniffer": "^3.6",
"php-coveralls/php-coveralls": "^2.5"
},
"suggest": {
"ext-posix": "*"
Expand All @@ -41,8 +43,8 @@
"bin": ["bin/mage"],
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev",
"dev-discovery-one": "4.x-dev"
"dev-master": "5.0.x-dev",
"dev-discovery-one": "5.x-dev"
}
}
}
6 changes: 3 additions & 3 deletions docs/dockers/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '2'
services:
php7.4:
container_name: mage-php7.4
build: ./php7.4
php8.0:
container_name: mage-php8.0
build: ./php8.0
volumes:
- ../../:/home/magephp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM ubuntu:20.04
FROM ubuntu:21.10

ENV DEBIAN_FRONTEND=noninteractive \
TZ=UTC

RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y vim curl git unzip
RUN apt-get install -y php7.4-cli php-zip php7.4-curl php7.4-xml php7.4-mbstring php7.4-xdebug
RUN apt-get install -y php8.0-cli php8.0-zip php8.0-curl php8.0-xml php8.0-mbstring php8.0-xdebug

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer

Expand Down
8 changes: 3 additions & 5 deletions docs/example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ magephp:
host_path: /var/www/test
releases: 4
exclude:
- vendor
- app/cache
- app/log
- web/app_dev.php
- var/cache
- var/log
hosts:
- webserver1
- webserver2
- webserver3
pre-deploy:
- git/update
- composer/install
- composer/generate-autoload
- composer/dump-autoload
on-deploy:
- symfony/cache-warmup: { env: 'prod' }
- symfony/assets-install: { env: 'prod' }
Expand Down
14 changes: 14 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>

<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">

<arg name="basepath" value="."/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>

<rule ref="PSR12"/>

<file>src/</file>
</ruleset>
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: 6
paths:
- src
Loading

0 comments on commit 0ccc2bb

Please sign in to comment.