Skip to content

Commit

Permalink
Merge pull request #105 from shlinkio/develop
Browse files Browse the repository at this point in the history
Release 5.4.0
  • Loading branch information
acelaya authored Feb 13, 2021
2 parents cb5617f + f2b1f2d commit 30926cf
Show file tree
Hide file tree
Showing 13 changed files with 305 additions and 55 deletions.
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ test-resources export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.phpstorm.meta.php export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
CHANGELOG.md export-ignore
docker-compose.override.yml.dist export-ignore
docker-compose.yml export-ignore
Expand Down
130 changes: 130 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Continuous integration

on:
pull_request: null
push:
branches:
- develop
- main

jobs:
lint:
runs-on: ubuntu-20.04
strategy:
matrix:
php-version: ['7.4']
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer
coverage: none
- run: composer install --no-interaction --prefer-dist
- run: composer cs

static-analysis:
runs-on: ubuntu-20.04
strategy:
matrix:
php-version: ['7.4']
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer
coverage: none
- run: composer install --no-interaction --prefer-dist
- run: composer stan

unit-tests:
runs-on: ubuntu-20.04
strategy:
matrix:
php-version: ['7.4', '8.0']
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer
coverage: none
- if: ${{ matrix.php-version == '8.0' }}
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
- if: ${{ matrix.php-version != '8.0' }}
run: composer install --no-interaction --prefer-dist
- run: composer test:ci
- uses: actions/upload-artifact@v2
with:
name: build-${{ matrix.php-version }}
path: build

mutation-tests:
needs:
- unit-tests
runs-on: ubuntu-20.04
strategy:
matrix:
php-version: ['7.4', '8.0']
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer
coverage: none
- if: ${{ matrix.php-version == '8.0' }}
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
- if: ${{ matrix.php-version != '8.0' }}
run: composer install --no-interaction --prefer-dist
- uses: actions/download-artifact@v2
with:
name: build-${{ matrix.php-version }}
path: build
- run: composer infect:ci

upload-coverage:
needs:
- unit-tests
runs-on: ubuntu-20.04
strategy:
matrix:
php-version: ['7.4']
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
- uses: actions/download-artifact@v2
with:
name: build-${{ matrix.php-version }}
path: build
- name: Publish coverage
uses: codecov/codecov-action@v1
with:
file: ./build/clover.xml

delete-artifacts:
needs:
- mutation-tests
- upload-coverage
runs-on: ubuntu-20.04
strategy:
matrix:
php-version: ['7.4', '8.0']
steps:
- uses: geekyeggo/delete-artifact@v1
with:
name: build-${{ matrix.php-version }}
12 changes: 0 additions & 12 deletions .scrutinizer.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).

## [5.4.0] - 2021-02-13
### Added
* [#101](https://github.com/shlinkio/shlink-installer/issues/101) Added new "auto generate titles" option.
* [#103](https://github.com/shlinkio/shlink-installer/issues/103) Added "track orphan visits" option.

### Changed
* Migrated build to Github Actions.

### Deprecated
* *Nothing*

### Removed
* *Nothing*

### Fixed
* *Nothing*


## [5.3.0] - 2020-12-11
### Added
* [#51](https://github.com/shlinkio/shlink-installer/issues/51) Created new command that allows updating the value of any configuration option.
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

A PHP command line tool used to install [shlink](https://shlink.io/).

[![Build Status](https://img.shields.io/travis/com/shlinkio/shlink-installer.svg?style=flat-square)](https://travis-ci.com/shlinkio/shlink-installer)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/shlinkio/shlink-installer.svg?style=flat-square)](https://scrutinizer-ci.com/g/shlinkio/shlink-installer/)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/shlinkio/shlink-installer.svg?style=flat-square)](https://scrutinizer-ci.com/g/shlinkio/shlink-installer/)
[![Build Status](https://img.shields.io/github/workflow/status/shlinkio/shlink-installer/Continuous%20integration?logo=github&style=flat-square)](https://github.com/shlinkio/shlink-installer/actions?query=workflow%3A%22Continuous+integration%22)
[![Code Coverage](https://img.shields.io/codecov/c/gh/shlinkio/shlink-installer/develop?style=flat-square)](https://app.codecov.io/gh/shlinkio/shlink-installer)
[![Latest Stable Version](https://img.shields.io/github/release/shlinkio/shlink-installer.svg?style=flat-square)](https://packagist.org/packages/shlinkio/shlink-installer)
[![License](https://img.shields.io/github/license/shlinkio/shlink-installer.svg?style=flat-square)](https://github.com/shlinkio/shlink-installer/blob/main/LICENSE)
[![Paypal donate](https://img.shields.io/badge/Donate-paypal-blue.svg?style=flat-square&logo=paypal&colorA=aaaaaa)](https://slnk.to/donate)
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"require-dev": {
"devster/ubench": "^2.0",
"infection/infection": "^0.20.0",
"infection/infection": "^0.21.0",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^0.12.52",
"phpunit/phpunit": "^9.4",
Expand Down Expand Up @@ -60,7 +60,7 @@
"infect:ci": "@infect --coverage=build --skip-initial-tests",
"infect:show": "@infect --show-mutations",
"infect:show:ci": "@infect --show-mutations --coverage=build",
"test:infect": [
"infect:test": [
"@test:ci",
"@infect:show:ci"
]
Expand Down
6 changes: 6 additions & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
'URL shortener > Schema' => Config\Option\UrlShortener\ShortDomainSchemaConfigOption::class,
'URL shortener > Validate URLs' => Config\Option\UrlShortener\ValidateUrlConfigOption::class,
'URL shortener > Short codes length' => Config\Option\UrlShortener\ShortCodeLengthOption::class,
'URL shortener > Auto resolve titles'
=> Config\Option\UrlShortener\AutoResolveTitlesConfigOption::class,
'URL shortener > Orphan visits tracking'
=> Config\Option\UrlShortener\OrphanVisitsTrackingConfigOption::class,
'Webhooks' => Config\Option\Visit\VisitsWebhooksConfigOption::class,
'GeoLite2 license key' => Config\Option\UrlShortener\GeoLiteLicenseKeyConfigOption::class,
'IP Anonymization' => Config\Option\UrlShortener\IpAnonymizationConfigOption::class,
Expand Down Expand Up @@ -101,6 +105,7 @@
Config\Option\UrlShortener\ShortDomainHostConfigOption::class => InvokableFactory::class,
Config\Option\UrlShortener\ShortDomainSchemaConfigOption::class => InvokableFactory::class,
Config\Option\UrlShortener\ValidateUrlConfigOption::class => InvokableFactory::class,
Config\Option\UrlShortener\AutoResolveTitlesConfigOption::class => InvokableFactory::class,
Config\Option\RedisServersConfigOption::class => InvokableFactory::class,
Config\Option\Visit\VisitsWebhooksConfigOption::class => ConfigAbstractFactory::class,
Config\Option\Worker\TaskWorkerNumConfigOption::class => ConfigAbstractFactory::class,
Expand All @@ -112,6 +117,7 @@
Config\Option\Mercure\MercureJwtSecretConfigOption::class => ConfigAbstractFactory::class,
Config\Option\UrlShortener\GeoLiteLicenseKeyConfigOption::class => InvokableFactory::class,
Config\Option\UrlShortener\IpAnonymizationConfigOption::class => InvokableFactory::class,
Config\Option\UrlShortener\OrphanVisitsTrackingConfigOption::class => InvokableFactory::class,
Config\Option\UrlShortener\RedirectStatusCodeConfigOption::class => InvokableFactory::class,
Config\Option\UrlShortener\RedirectCacheLifeTimeConfigOption::class => InvokableFactory::class,
],
Expand Down
26 changes: 26 additions & 0 deletions src/Config/Option/UrlShortener/AutoResolveTitlesConfigOption.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace Shlinkio\Shlink\Installer\Config\Option\UrlShortener;

use Shlinkio\Shlink\Config\Collection\PathCollection;
use Shlinkio\Shlink\Installer\Config\Option\BaseConfigOption;
use Symfony\Component\Console\Style\StyleInterface;

class AutoResolveTitlesConfigOption extends BaseConfigOption
{
public function getConfigPath(): array
{
return ['url_shortener', 'auto_resolve_titles'];
}

public function ask(StyleInterface $io, PathCollection $currentOptions): bool
{
return $io->confirm(
'Do you want Shlink to resolve the short URL title based on the long URL \'s title tag (if any)? '
. 'Otherwise, it will be kept empty unless explicitly provided.',
false,
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace Shlinkio\Shlink\Installer\Config\Option\UrlShortener;

use Shlinkio\Shlink\Config\Collection\PathCollection;
use Shlinkio\Shlink\Installer\Config\Option\BaseConfigOption;
use Symfony\Component\Console\Style\StyleInterface;

class OrphanVisitsTrackingConfigOption extends BaseConfigOption
{
public function getConfigPath(): array
{
return ['url_shortener', 'track_orphan_visits'];
}

public function ask(StyleInterface $io, PathCollection $currentOptions): bool
{
return $io->confirm(
'Do you want track orphan visits? (visits to the base URL, invalid short URLs or other "not found" URLs)',
true,
);
}
}
1 change: 1 addition & 0 deletions src/Config/Option/UrlShortener/ValidateUrlConfigOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Shlinkio\Shlink\Installer\Config\Option\BaseConfigOption;
use Symfony\Component\Console\Style\StyleInterface;

/** @deprecated */
class ValidateUrlConfigOption extends BaseConfigOption
{
public function getConfigPath(): array
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

declare(strict_types=1);

namespace ShlinkioTest\Shlink\Installer\Config\Option\UrlShortener;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Shlinkio\Shlink\Config\Collection\PathCollection;
use Shlinkio\Shlink\Installer\Config\Option\UrlShortener\AutoResolveTitlesConfigOption;
use Symfony\Component\Console\Style\StyleInterface;

class AutoResolveTitlesConfigOptionTest extends TestCase
{
use ProphecyTrait;

private AutoResolveTitlesConfigOption $configOption;

public function setUp(): void
{
$this->configOption = new AutoResolveTitlesConfigOption();
}

/** @test */
public function returnsExpectedConfig(): void
{
self::assertEquals(['url_shortener', 'auto_resolve_titles'], $this->configOption->getConfigPath());
}

/** @test */
public function expectedQuestionIsAsked(): void
{
$expectedAnswer = true;
$io = $this->prophesize(StyleInterface::class);
$confirm = $io->confirm(
'Do you want Shlink to resolve the short URL title based on the long URL \'s title tag (if any)? '
. 'Otherwise, it will be kept empty unless explicitly provided.',
false,
)->willReturn(
$expectedAnswer,
);

$answer = $this->configOption->ask($io->reveal(), new PathCollection());

self::assertEquals($expectedAnswer, $answer);
$confirm->shouldHaveBeenCalledOnce();
}
}
Loading

0 comments on commit 30926cf

Please sign in to comment.