mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-23 13:23:33 +03:00
Merge pull request #1187 from acelaya-forks/feature/build-8.1
Feature/build 8.1
This commit is contained in:
commit
95ab64ba77
7 changed files with 83 additions and 47 deletions
93
.github/workflows/ci.yml
vendored
93
.github/workflows/ci.yml
vendored
|
@ -21,7 +21,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
tools: composer
|
tools: composer
|
||||||
extensions: swoole-4.6.7
|
extensions: swoole-4.7.1
|
||||||
coverage: none
|
coverage: none
|
||||||
- run: composer install --no-interaction --prefer-dist
|
- run: composer install --no-interaction --prefer-dist
|
||||||
- run: composer cs
|
- run: composer cs
|
||||||
|
@ -39,7 +39,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
tools: composer
|
tools: composer
|
||||||
extensions: swoole-4.6.7
|
extensions: swoole-4.7.1
|
||||||
coverage: none
|
coverage: none
|
||||||
- run: composer install --no-interaction --prefer-dist
|
- run: composer install --no-interaction --prefer-dist
|
||||||
- run: composer stan
|
- run: composer stan
|
||||||
|
@ -48,7 +48,8 @@ jobs:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-version: ['8.0']
|
php-version: ['8.0', '8.1']
|
||||||
|
continue-on-error: ${{ matrix.php-version == '8.1' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -57,10 +58,13 @@ jobs:
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
tools: composer
|
tools: composer
|
||||||
extensions: swoole-4.6.7
|
extensions: swoole-4.7.1
|
||||||
coverage: pcov
|
coverage: pcov
|
||||||
ini-values: pcov.directory=module
|
ini-values: pcov.directory=module
|
||||||
- run: composer install --no-interaction --prefer-dist
|
- if: ${{ matrix.php-version == '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
|
||||||
|
- if: ${{ matrix.php-version != '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist
|
||||||
- run: composer test:unit:ci
|
- run: composer test:unit:ci
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
if: ${{ matrix.php-version == '8.0' }}
|
if: ${{ matrix.php-version == '8.0' }}
|
||||||
|
@ -74,7 +78,8 @@ jobs:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-version: ['8.0']
|
php-version: ['8.0', '8.1']
|
||||||
|
continue-on-error: ${{ matrix.php-version == '8.1' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -83,10 +88,13 @@ jobs:
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
tools: composer
|
tools: composer
|
||||||
extensions: swoole-4.6.7
|
extensions: swoole-4.7.1
|
||||||
coverage: pcov
|
coverage: pcov
|
||||||
ini-values: pcov.directory=module
|
ini-values: pcov.directory=module
|
||||||
- run: composer install --no-interaction --prefer-dist
|
- if: ${{ matrix.php-version == '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
|
||||||
|
- if: ${{ matrix.php-version != '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist
|
||||||
- run: composer test:db:sqlite:ci
|
- run: composer test:db:sqlite:ci
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
if: ${{ matrix.php-version == '8.0' }}
|
if: ${{ matrix.php-version == '8.0' }}
|
||||||
|
@ -100,7 +108,8 @@ jobs:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-version: ['8.0']
|
php-version: ['8.0', '8.1']
|
||||||
|
continue-on-error: ${{ matrix.php-version == '8.1' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -111,16 +120,20 @@ jobs:
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
tools: composer
|
tools: composer
|
||||||
extensions: swoole-4.6.7
|
extensions: swoole-4.7.1
|
||||||
coverage: none
|
coverage: none
|
||||||
- run: composer install --no-interaction --prefer-dist
|
- if: ${{ matrix.php-version == '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
|
||||||
|
- if: ${{ matrix.php-version != '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist
|
||||||
- run: composer test:db:mysql
|
- run: composer test:db:mysql
|
||||||
|
|
||||||
db-tests-maria:
|
db-tests-maria:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-version: ['8.0']
|
php-version: ['8.0', '8.1']
|
||||||
|
continue-on-error: ${{ matrix.php-version == '8.1' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -131,16 +144,20 @@ jobs:
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
tools: composer
|
tools: composer
|
||||||
extensions: swoole-4.6.7
|
extensions: swoole-4.7.1
|
||||||
coverage: none
|
coverage: none
|
||||||
- run: composer install --no-interaction --prefer-dist
|
- if: ${{ matrix.php-version == '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
|
||||||
|
- if: ${{ matrix.php-version != '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist
|
||||||
- run: composer test:db:maria
|
- run: composer test:db:maria
|
||||||
|
|
||||||
db-tests-postgres:
|
db-tests-postgres:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-version: ['8.0']
|
php-version: ['8.0', '8.1']
|
||||||
|
continue-on-error: ${{ matrix.php-version == '8.1' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -151,16 +168,20 @@ jobs:
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
tools: composer
|
tools: composer
|
||||||
extensions: swoole-4.6.7
|
extensions: swoole-4.7.1
|
||||||
coverage: none
|
coverage: none
|
||||||
- run: composer install --no-interaction --prefer-dist
|
- if: ${{ matrix.php-version == '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
|
||||||
|
- if: ${{ matrix.php-version != '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist
|
||||||
- run: composer test:db:postgres
|
- run: composer test:db:postgres
|
||||||
|
|
||||||
db-tests-ms:
|
db-tests-ms:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-version: ['8.0']
|
php-version: ['8.0', '8.1']
|
||||||
|
continue-on-error: ${{ matrix.php-version == '8.1' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -169,13 +190,25 @@ jobs:
|
||||||
- name: Start database server
|
- name: Start database server
|
||||||
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_ms
|
run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_ms
|
||||||
- name: Use PHP
|
- name: Use PHP
|
||||||
|
if: ${{ matrix.php-version == '8.1' }}
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
tools: composer
|
tools: composer
|
||||||
extensions: swoole-4.6.7, pdo_sqlsrv-5.9.0
|
extensions: swoole-4.7.1, pdo_sqlsrv-5.10.0beta1
|
||||||
coverage: none
|
coverage: none
|
||||||
- run: composer install --no-interaction --prefer-dist
|
- name: Use PHP
|
||||||
|
if: ${{ matrix.php-version != '8.1' }}
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php-version }}
|
||||||
|
tools: composer
|
||||||
|
extensions: swoole-4.7.1, pdo_sqlsrv-5.9.0
|
||||||
|
coverage: none
|
||||||
|
- if: ${{ matrix.php-version == '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
|
||||||
|
- if: ${{ matrix.php-version != '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist
|
||||||
- name: Create test database
|
- name: Create test database
|
||||||
run: docker-compose exec -T shlink_db_ms /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Passw0rd!' -Q "CREATE DATABASE shlink_test;"
|
run: docker-compose exec -T shlink_db_ms /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Passw0rd!' -Q "CREATE DATABASE shlink_test;"
|
||||||
- run: composer test:db:ms
|
- run: composer test:db:ms
|
||||||
|
@ -184,7 +217,8 @@ jobs:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-version: ['8.0']
|
php-version: ['8.0', '8.1']
|
||||||
|
continue-on-error: ${{ matrix.php-version == '8.1' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -195,10 +229,13 @@ jobs:
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
tools: composer
|
tools: composer
|
||||||
extensions: swoole-4.6.7
|
extensions: swoole-4.7.1
|
||||||
coverage: pcov
|
coverage: pcov
|
||||||
ini-values: pcov.directory=module
|
ini-values: pcov.directory=module
|
||||||
- run: composer install --no-interaction --prefer-dist
|
- if: ${{ matrix.php-version == '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
|
||||||
|
- if: ${{ matrix.php-version != '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist
|
||||||
- run: bin/test/run-api-tests.sh
|
- run: bin/test/run-api-tests.sh
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
if: ${{ matrix.php-version == '8.0' }}
|
if: ${{ matrix.php-version == '8.0' }}
|
||||||
|
@ -216,8 +253,9 @@ jobs:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php-version: ['8.0']
|
php-version: ['8.0', '8.1']
|
||||||
test-group: ['unit', 'db']
|
test-group: ['unit', 'db']
|
||||||
|
continue-on-error: ${{ matrix.php-version == '8.1' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -226,10 +264,13 @@ jobs:
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
tools: composer
|
tools: composer
|
||||||
extensions: swoole-4.6.7
|
extensions: swoole-4.7.1
|
||||||
coverage: pcov
|
coverage: pcov
|
||||||
ini-values: pcov.directory=module
|
ini-values: pcov.directory=module
|
||||||
- run: composer install --no-interaction --prefer-dist
|
- if: ${{ matrix.php-version == '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php
|
||||||
|
- if: ${{ matrix.php-version != '8.1' }}
|
||||||
|
run: composer install --no-interaction --prefer-dist
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
path: build
|
path: build
|
||||||
|
|
|
@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
|
||||||
### Changed
|
### Changed
|
||||||
* [#1142](https://github.com/shlinkio/shlink/issues/1142) Replaced `doctrine/cache` package with `symfony/cache`.
|
* [#1142](https://github.com/shlinkio/shlink/issues/1142) Replaced `doctrine/cache` package with `symfony/cache`.
|
||||||
* [#1157](https://github.com/shlinkio/shlink/issues/1157) All routes now support CORS, not only rest ones.
|
* [#1157](https://github.com/shlinkio/shlink/issues/1157) All routes now support CORS, not only rest ones.
|
||||||
|
* [#1144](https://github.com/shlinkio/shlink/issues/1144) Added experimental builds under PHP 8.1.
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
* [#1164](https://github.com/shlinkio/shlink/issues/1164) Deprecated `SHORT_DOMAIN_HOST` and `SHORT_DOMAIN_SCHEMA` env vars. Use `DEFAULT_DOMAIN` and `USE_HTTPS=true|false` instead.
|
* [#1164](https://github.com/shlinkio/shlink/issues/1164) Deprecated `SHORT_DOMAIN_HOST` and `SHORT_DOMAIN_SCHEMA` env vars. Use `DEFAULT_DOMAIN` and `USE_HTTPS=true|false` instead.
|
||||||
|
|
|
@ -2,9 +2,9 @@ FROM php:8.0.9-alpine3.14 as base
|
||||||
|
|
||||||
ARG SHLINK_VERSION=latest
|
ARG SHLINK_VERSION=latest
|
||||||
ENV SHLINK_VERSION ${SHLINK_VERSION}
|
ENV SHLINK_VERSION ${SHLINK_VERSION}
|
||||||
ENV SWOOLE_VERSION 4.7.0
|
ENV SWOOLE_VERSION 4.7.1
|
||||||
ENV PDO_SQLSRV_VERSION 5.9.0
|
ENV PDO_SQLSRV_VERSION 5.9.0
|
||||||
ENV MS_ODBC_SQL_VERSION 17.5.2.1
|
ENV MS_ODBC_SQL_VERSION 17.5.2.2
|
||||||
ENV LC_ALL "C"
|
ENV LC_ALL "C"
|
||||||
|
|
||||||
WORKDIR /etc/shlink
|
WORKDIR /etc/shlink
|
||||||
|
|
|
@ -3,7 +3,7 @@ MAINTAINER Alejandro Celaya <alejandro@alejandrocelaya.com>
|
||||||
|
|
||||||
ENV APCU_VERSION 5.1.20
|
ENV APCU_VERSION 5.1.20
|
||||||
ENV PDO_SQLSRV_VERSION 5.9.0
|
ENV PDO_SQLSRV_VERSION 5.9.0
|
||||||
ENV MS_ODBC_SQL_VERSION 17.5.2.1
|
ENV MS_ODBC_SQL_VERSION 17.5.2.2
|
||||||
|
|
||||||
RUN apk update
|
RUN apk update
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@ FROM php:8.0.9-alpine3.14
|
||||||
MAINTAINER Alejandro Celaya <alejandro@alejandrocelaya.com>
|
MAINTAINER Alejandro Celaya <alejandro@alejandrocelaya.com>
|
||||||
|
|
||||||
ENV APCU_VERSION 5.1.20
|
ENV APCU_VERSION 5.1.20
|
||||||
ENV PDO_SQLSRV_VERSION 5.9.0
|
|
||||||
ENV INOTIFY_VERSION 3.0.0
|
ENV INOTIFY_VERSION 3.0.0
|
||||||
ENV SWOOLE_VERSION 4.7.0
|
ENV SWOOLE_VERSION 4.7.1
|
||||||
ENV MS_ODBC_SQL_VERSION 17.5.2.1
|
ENV PDO_SQLSRV_VERSION 5.9.0
|
||||||
|
ENV MS_ODBC_SQL_VERSION 17.5.2.2
|
||||||
|
|
||||||
RUN apk update
|
RUN apk update
|
||||||
|
|
||||||
|
|
|
@ -27,16 +27,9 @@ class NotFoundRedirectHandler implements MiddlewareInterface
|
||||||
/** @var NotFoundType $notFoundType */
|
/** @var NotFoundType $notFoundType */
|
||||||
$notFoundType = $request->getAttribute(NotFoundType::class);
|
$notFoundType = $request->getAttribute(NotFoundType::class);
|
||||||
$authority = $request->getUri()->getAuthority();
|
$authority = $request->getUri()->getAuthority();
|
||||||
$domainSpecificRedirect = $this->resolveDomainSpecificRedirect($authority, $notFoundType);
|
$redirectConfig = $this->domainService->findByAuthority($authority) ?? $this->redirectOptions;
|
||||||
|
$redirectResponse = $this->redirectResolver->resolveRedirectResponse($notFoundType, $redirectConfig);
|
||||||
|
|
||||||
return $domainSpecificRedirect
|
return $redirectResponse ?? $handler->handle($request);
|
||||||
?? $this->redirectResolver->resolveRedirectResponse($notFoundType, $this->redirectOptions)
|
|
||||||
?? $handler->handle($request);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function resolveDomainSpecificRedirect(string $authority, NotFoundType $notFoundType): ?ResponseInterface
|
|
||||||
{
|
|
||||||
$domain = $this->domainService->findByAuthority($authority);
|
|
||||||
return $domain === null ? null : $this->redirectResolver->resolveRedirectResponse($notFoundType, $domain);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,17 +72,18 @@ class NotFoundRedirectHandlerTest extends TestCase
|
||||||
$domainService->findByAuthority(Argument::cetera())
|
$domainService->findByAuthority(Argument::cetera())
|
||||||
->willReturn(null)
|
->willReturn(null)
|
||||||
->shouldBeCalledOnce();
|
->shouldBeCalledOnce();
|
||||||
$resolver->resolveRedirectResponse(Argument::cetera())
|
$resolver->resolveRedirectResponse(
|
||||||
->willReturn(null)
|
Argument::type(NotFoundType::class),
|
||||||
->shouldBeCalledOnce();
|
Argument::type(NotFoundRedirectOptions::class),
|
||||||
|
)->willReturn(null)->shouldBeCalledOnce();
|
||||||
}];
|
}];
|
||||||
yield 'non-redirecting domain' => [function (ObjectProphecy $domainService, ObjectProphecy $resolver): void {
|
yield 'non-redirecting domain' => [function (ObjectProphecy $domainService, ObjectProphecy $resolver): void {
|
||||||
$domainService->findByAuthority(Argument::cetera())
|
$domainService->findByAuthority(Argument::cetera())
|
||||||
->willReturn(Domain::withAuthority(''))
|
->willReturn(Domain::withAuthority(''))
|
||||||
->shouldBeCalledOnce();
|
->shouldBeCalledOnce();
|
||||||
$resolver->resolveRedirectResponse(Argument::cetera())
|
$resolver->resolveRedirectResponse(Argument::type(NotFoundType::class), Argument::type(Domain::class))
|
||||||
->willReturn(null)
|
->willReturn(null)
|
||||||
->shouldBeCalledTimes(2);
|
->shouldBeCalledOnce();
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue