Skip to content

Commit

Permalink
Merge pull request #2237 from shlinkio/develop
Browse files Browse the repository at this point in the history
Release 4.2.4
  • Loading branch information
acelaya authored Oct 27, 2024
2 parents 51de4b1 + 0d627ce commit 02e48ae
Show file tree
Hide file tree
Showing 162 changed files with 897 additions and 959 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bin/rr
config/autoload/*local*
config/params/shlink_dev_env.*
data/infra
data/cache/*
data/log/*
Expand Down
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
.travis.yml export-ignore
build.sh export-ignore
CHANGELOG.md export-ignore
docker-compose.override.yml.dist export-ignore
docker-compose.yml export-ignore
indocker export-ignore
phpcs.xml export-ignore
Expand Down
3 changes: 1 addition & 2 deletions .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ runs:
php-version: ${{ inputs.php-version }}
tools: composer
extensions: ${{ inputs.php-extensions }}
coverage: pcov
ini-values: pcov.directory=module
coverage: xdebug
- name: Install dependencies
if: ${{ inputs.install-deps == 'yes' }}
run: composer install --no-interaction --prefer-dist ${{ inputs.php-version == '8.4' && '--ignore-platform-req=php' || '' }}
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/ci-docker-image-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build docker image
name: Test docker image build

on:
pull_request:
Expand All @@ -7,8 +7,4 @@ on:

jobs:
build-docker-image:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- run: docker build -t shlink-docker-image:temp .
uses: shlinkio/github-actions/.github/workflows/docker-image-build-ci.yml@main
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ data/GeoLite2-City.*
data/infra/matomo
docs/swagger-ui*
docs/mercure.html
docker-compose.override.yml
.phpunit.result.cache
docs/swagger/swagger-inlined.json
phpcov*
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).

## [4.2.4] - 2024-10-27
### Added
* *Nothing*

### Changed
* [#2231](https://github.com/shlinkio/shlink/issues/2231) Update to `endroid/qr-code` 6.0.
* [#2221](https://github.com/shlinkio/shlink/issues/2221) Switch to env vars to handle dev/local options.

### Deprecated
* *Nothing*

### Removed
* *Nothing*

### Fixed
* [#2232](https://github.com/shlinkio/shlink/issues/2232) Run RoadRunner in docker with `exec` to ensure signals are properly handled.


## [4.2.3] - 2024-10-17
### Added
* *Nothing*
Expand Down
9 changes: 6 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ The first thing you need to do is fork the repository, and clone it in your loca

Then you will have to follow these steps:

* Copy all files with `.local.php.dist` extension from `config/autoload` by removing the dist extension.
* Copy the `config/params/shlink_dev_env.php.dist` in the same directory, but removing the `.dist` extension:

For example the `common.local.php.dist` file should be copied as `common.local.php`.
```
cp config/params/shlink_dev_env.php.dist config/params/shlink_dev_env.php
```

The `shlink_dev_env.php` file is gitignored, so you can customize it as you want. For example, by adding your own GeoLite license key.

* Copy the file `docker-compose.override.yml.dist` by also removing the `dist` extension.
* Start-up the project by running `docker compose up`.

The first time this command is run, it will create several containers that are used during development, so it may take some time.
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ RUN apk add --no-cache git && \
php composer.phar install --no-dev --prefer-dist --optimize-autoloader --no-progress --no-interaction && \
php composer.phar clear-cache && \
rm -r docker composer.* && \
sed -i "s/%SHLINK_VERSION%/${SHLINK_VERSION}/g" config/autoload/app_options.global.php
sed -i "s/%SHLINK_VERSION%/${SHLINK_VERSION}/g" module/Core/src/Config/Options/AppOptions.php


# Prepare final image
Expand All @@ -61,7 +61,6 @@ EXPOSE 8080

# Copy config specific for the image
COPY docker/docker-entrypoint.sh docker-entrypoint.sh
COPY docker/config/shlink_in_docker.local.php config/autoload/shlink_in_docker.local.php
COPY docker/config/php.ini ${PHP_INI_DIR}/conf.d/

USER ${USER_ID}
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

[![Mastodon](https://img.shields.io/mastodon/follow/109329425426175098?color=%236364ff&domain=https%3A%2F%2Ffosstodon.org&label=follow&logo=mastodon&logoColor=white&style=flat-square)](https://fosstodon.org/@shlinkio)
[![Bluesky](https://img.shields.io/badge/follow-shlinkio-0285FF.svg?style=flat-square&logo=bluesky&logoColor=white)](https://bsky.app/profile/shlinkio.bsky.social)
[![Twitter](https://img.shields.io/badge/follow-shlinkio-blue.svg?style=flat-square&logo=x&color=black)](https://twitter.com/shlinkio)
[![Paypal donate](https://img.shields.io/badge/Donate-paypal-blue.svg?style=flat-square&logo=paypal&colorA=aaaaaa)](https://slnk.to/donate)

A PHP-based self-hosted URL shortener that can be used to serve shortened URLs under your own domain.
Expand Down
2 changes: 2 additions & 0 deletions bin/test/run-api-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export TEST_RUNTIME="${TEST_RUNTIME:-"rr"}" # rr is the only runtime currently s
export DB_DRIVER="${DB_DRIVER:-"postgres"}"
export GENERATE_COVERAGE="${GENERATE_COVERAGE:-"no"}"

[ "$GENERATE_COVERAGE" != 'no' ] && export XDEBUG_MODE=coverage

# Reset logs
OUTPUT_LOGS=data/log/api-tests/output.log
rm -rf data/log/api-tests
Expand Down
14 changes: 14 additions & 0 deletions bin/test/run-cli-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env sh

export APP_ENV=test
export TEST_ENV=cli
export DB_DRIVER="${DB_DRIVER:-"maria"}"
export GENERATE_COVERAGE="${GENERATE_COVERAGE:-"no"}"

[ "$GENERATE_COVERAGE" != 'no' ] && export XDEBUG_MODE=coverage

vendor/bin/phpunit --order-by=random --testdox --testdox-summary -c phpunit-cli.xml $*
TESTS_EXIT_CODE=$?

# Exit this script with the same code as the tests. If tests failed, this script has to fail
exit $TESTS_EXIT_CODE
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ ${composerBin} install --no-dev --prefer-dist --optimize-autoloader --no-progres
echo 'Deleting dev files...'
rm composer.*

# Update Shlink version in config
sed -i "s/%SHLINK_VERSION%/${version}/g" config/autoload/app_options.global.php
# Update Shlink version
sed -i "s/%SHLINK_VERSION%/${version}/g" module/Core/src/Config/Options/AppOptions.php

# Compressing file
echo 'Compressing files...'
Expand Down
114 changes: 65 additions & 49 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,64 +18,64 @@
"ext-json": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
"akrabat/ip-address-middleware": "^2.1",
"cakephp/chronos": "^3.0.2",
"doctrine/dbal": "^4.1",
"doctrine/migrations": "^3.6",
"doctrine/orm": "^3.2",
"endroid/qr-code": "^5.0",
"akrabat/ip-address-middleware": "^2.3",
"cakephp/chronos": "^3.1",
"doctrine/dbal": "^4.2",
"doctrine/migrations": "^3.8",
"doctrine/orm": "^3.3",
"endroid/qr-code": "^6.0",
"friendsofphp/proxy-manager-lts": "^1.0",
"geoip2/geoip2": "^3.0",
"guzzlehttp/guzzle": "^7.5",
"guzzlehttp/guzzle": "^7.9",
"hidehalo/nanoid-php": "^1.1",
"jaybizzle/crawler-detect": "^1.2.116",
"laminas/laminas-config": "^3.8",
"laminas/laminas-config": "^3.9",
"laminas/laminas-config-aggregator": "^1.15",
"laminas/laminas-diactoros": "^3.3",
"laminas/laminas-inputfilter": "^2.27",
"laminas/laminas-servicemanager": "^3.21",
"laminas/laminas-stdlib": "^3.17",
"matomo/matomo-php-tracker": "^3.2",
"mezzio/mezzio": "^3.17",
"mezzio/mezzio-fastroute": "^3.11",
"mezzio/mezzio-problem-details": "^1.13",
"laminas/laminas-diactoros": "^3.5",
"laminas/laminas-inputfilter": "^2.30",
"laminas/laminas-servicemanager": "^3.22",
"laminas/laminas-stdlib": "^3.19",
"matomo/matomo-php-tracker": "^3.3",
"mezzio/mezzio": "^3.20",
"mezzio/mezzio-fastroute": "^3.12",
"mezzio/mezzio-problem-details": "^1.15",
"mlocati/ip-lib": "^1.18",
"mobiledetect/mobiledetectlib": "^4.8",
"pagerfanta/core": "^3.8",
"ramsey/uuid": "^4.7",
"shlinkio/doctrine-specification": "^2.1.1",
"shlinkio/shlink-common": "^6.3",
"shlinkio/shlink-config": "^3.2.1",
"shlinkio/shlink-common": "^6.4",
"shlinkio/shlink-config": "^3.3",
"shlinkio/shlink-event-dispatcher": "^4.1",
"shlinkio/shlink-importer": "^5.3.2",
"shlinkio/shlink-installer": "^9.2",
"shlinkio/shlink-ip-geolocation": "^4.0",
"shlinkio/shlink-ip-geolocation": "^4.1",
"shlinkio/shlink-json": "^1.1",
"spiral/roadrunner": "^2024.1",
"spiral/roadrunner-cli": "^2.6",
"spiral/roadrunner-http": "^3.5",
"spiral/roadrunner-jobs": "^4.5",
"symfony/console": "^7.0",
"symfony/filesystem": "^7.0",
"symfony/lock": "^7.0",
"symfony/process": "^7.0",
"symfony/string": "^7.0"
"symfony/console": "^7.1",
"symfony/filesystem": "^7.1",
"symfony/lock": "^7.1",
"symfony/process": "^7.1",
"symfony/string": "^7.1"
},
"require-dev": {
"devizzent/cebe-php-openapi": "^1.0.1",
"devster/ubench": "^2.1",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-doctrine": "^1.4",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-doctrine": "^1.5",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-symfony": "^1.4",
"phpunit/php-code-coverage": "^11.0",
"phpunit/phpcov": "^10.0",
"phpunit/phpunit": "^11.3",
"phpunit/phpunit": "^11.4",
"roave/security-advisories": "dev-master",
"shlinkio/php-coding-standard": "~2.3.0",
"shlinkio/shlink-test-utils": "^4.1",
"symfony/var-dumper": "^7.0",
"veewee/composer-run-parallel": "^1.3"
"shlinkio/shlink-test-utils": "^4.1.1",
"symfony/var-dumper": "^7.1",
"veewee/composer-run-parallel": "^1.4"
},
"conflict": {
"symfony/var-exporter": ">=6.3.9,<=6.4.0"
Expand Down Expand Up @@ -114,31 +114,47 @@
],
"cs": "phpcs -s",
"cs:fix": "phpcbf",
"stan": "APP_ENV=test php vendor/bin/phpstan analyse",
"stan": ["@putenv APP_ENV=test", "phpstan analyse"],
"test": [
"@parallel test:unit test:db",
"@parallel test:api test:cli"
],
"test:unit": "COLUMNS=120 vendor/bin/phpunit --order-by=random --testdox --testdox-summary",
"test:unit:ci": "@test:unit --coverage-php=build/coverage-unit.cov",
"test:unit:pretty": "@test:unit --coverage-html build/coverage-unit/coverage-html",
"test:unit": ["@putenv COLUMNS=120", "phpunit --order-by=random --testdox --testdox-summary"],
"test:unit:ci": ["@putenv XDEBUG_MODE=coverage", "@test:unit --coverage-php=build/coverage-unit.cov"],
"test:unit:pretty": ["@putenv XDEBUG_MODE=coverage", "@test:unit --coverage-html build/coverage-unit/coverage-html"],
"test:db": "@parallel test:db:sqlite:ci test:db:mysql test:db:maria test:db:postgres test:db:ms",
"test:db:sqlite": "APP_ENV=test php vendor/bin/phpunit --order-by=random --testdox --testdox-summary -c phpunit-db.xml",
"test:db:sqlite:ci": "@test:db:sqlite --coverage-php build/coverage-db.cov",
"test:db:mysql": "DB_DRIVER=mysql composer test:db:sqlite -- $*",
"test:db:maria": "DB_DRIVER=maria composer test:db:sqlite -- $*",
"test:db:postgres": "DB_DRIVER=postgres composer test:db:sqlite -- $*",
"test:db:ms": "DB_DRIVER=mssql composer test:db:sqlite -- $*",
"test:db:sqlite": ["@putenv APP_ENV=test", "phpunit --order-by=random --testdox --testdox-summary -c phpunit-db.xml"],
"test:db:sqlite:ci": ["@putenv XDEBUG_MODE=coverage", "@test:db:sqlite --coverage-php build/coverage-db.cov"],
"test:db:mysql": ["@putenv DB_DRIVER=mysql", "@test:db:sqlite"],
"test:db:maria": ["@putenv DB_DRIVER=maria", "@test:db:sqlite"],
"test:db:postgres": ["@putenv DB_DRIVER=postgres", "@test:db:sqlite"],
"test:db:ms": ["@putenv DB_DRIVER=mssql", "@test:db:sqlite"],
"test:api": "bin/test/run-api-tests.sh",
"test:api:sqlite": "DB_DRIVER=sqlite composer test:api -- $*",
"test:api:mysql": "DB_DRIVER=mysql composer test:api -- $*",
"test:api:maria": "DB_DRIVER=maria composer test:api -- $*",
"test:api:mssql": "DB_DRIVER=mssql composer test:api -- $*",
"test:api:ci": "GENERATE_COVERAGE=yes composer test:api && vendor/bin/phpcov merge build/coverage-api --php build/coverage-api.cov && rm build/coverage-api/*.cov",
"test:api:pretty": "GENERATE_COVERAGE=yes composer test:api && vendor/bin/phpcov merge build/coverage-api --html build/coverage-api/coverage-html && rm build/coverage-api/*.cov",
"test:cli": "APP_ENV=test DB_DRIVER=maria TEST_ENV=cli php vendor/bin/phpunit --order-by=random --testdox --testdox-summary -c phpunit-cli.xml",
"test:cli:ci": "GENERATE_COVERAGE=yes composer test:cli && vendor/bin/phpcov merge build/coverage-cli --php build/coverage-cli.cov && rm build/coverage-cli/*.cov",
"test:cli:pretty": "GENERATE_COVERAGE=yes composer test:cli && vendor/bin/phpcov merge build/coverage-cli --html build/coverage-cli/coverage-html && rm build/coverage-cli/*.cov",
"test:api:sqlite": ["@putenv DB_DRIVER=sqlite", "@test:api"],
"test:api:mysql": ["@putenv DB_DRIVER=mysql", "@test:api"],
"test:api:maria": ["@putenv DB_DRIVER=maria", "@test:api"],
"test:api:mssql": ["@putenv DB_DRIVER=mssql", "@test:api"],
"test:api:ci": [
"@putenv GENERATE_COVERAGE=yes",
"@test:api",
"phpcov merge build/coverage-api --php build/coverage-api.cov && rm build/coverage-api/*.cov"
],
"test:api:pretty": [
"@putenv GENERATE_COVERAGE=yes",
"@test:api",
"phpcov merge build/coverage-api --html build/coverage-api/coverage-html && rm build/coverage-api/*.cov"
],
"test:cli": "bin/test/run-cli-tests.sh",
"test:cli:ci": [
"@putenv GENERATE_COVERAGE=yes",
"@test:cli",
"vendor/bin/phpcov merge build/coverage-cli --php build/coverage-cli.cov && rm build/coverage-cli/*.cov"
],
"test:cli:pretty": [
"@putenv GENERATE_COVERAGE=yes",
"@test:cli",
"phpcov merge build/coverage-cli --html build/coverage-cli/coverage-html && rm build/coverage-cli/*.cov"
],
"swagger:validate": "php-openapi validate docs/swagger/swagger.json",
"swagger:inline": "php-openapi inline docs/swagger/swagger.json docs/swagger/swagger-inlined.json",
"clean:dev": "rm -f data/database.sqlite && rm -f config/params/generated_config.php"
Expand Down
2 changes: 0 additions & 2 deletions config/autoload/.gitignore

This file was deleted.

12 changes: 0 additions & 12 deletions config/autoload/app_options.global.php

This file was deleted.

11 changes: 0 additions & 11 deletions config/autoload/app_options.local.php.dist

This file was deleted.

17 changes: 11 additions & 6 deletions config/autoload/common.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
declare(strict_types=1);

use Laminas\ConfigAggregator\ConfigAggregator;
use Shlinkio\Shlink\Core\Config\EnvVars;

return [
return (function () {
$isDev = EnvVars::isDevEnv();

'debug' => false,
return [

// Disabling config cache for cli, ensures it's never used for RoadRunner, and also that console
// commands don't generate a cache file that's then used by php-fpm web executions
ConfigAggregator::ENABLE_CACHE => PHP_SAPI !== 'cli',
'debug' => $isDev,

];
// Disabling config cache for cli, ensures it's never used for RoadRunner, and also that console
// commands don't generate a cache file that's then used by php-fpm web executions
ConfigAggregator::ENABLE_CACHE => ! $isDev && PHP_SAPI !== 'cli',

];
})();
12 changes: 0 additions & 12 deletions config/autoload/common.local.php.dist

This file was deleted.

Loading

0 comments on commit 02e48ae

Please sign in to comment.