Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix github action dep #4939

Merged
merged 16 commits into from
Mar 7, 2021
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
extensions: imagick, mbstring, dom, fileinfo
extensions: imagick, redis
coverage: none
- name: Check PHP Version
run: php -v
Expand All @@ -63,7 +63,7 @@ jobs:
${{ runner.os }}-composer-

- name: Install composer dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader --ignore-platform-req=php
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

# Yarn
- name: Setup Node.js
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: imagick, mbstring, dom, fileinfo
extensions: imagick, redis
coverage: none
- name: Check PHP Version
run: php -v
Expand All @@ -56,7 +56,7 @@ jobs:
${{ runner.os }}-composer-

- name: Install composer dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader --ignore-platform-req=php
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

# Yarn
- name: Setup Node.js
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/migration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: imagick, mbstring, dom, fileinfo, ${{ matrix.connection }}
extensions: imagick, redis, ${{ matrix.connection }}
coverage: none
- name: Check PHP Version
run: php -v
Expand All @@ -62,7 +62,7 @@ jobs:
${{ runner.os }}-composer-

- name: Install composer dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader --ignore-platform-req=php
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

# Prepare
- name: Prepare environment
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
extensions: imagick, mbstring, dom, fileinfo
extensions: imagick, redis
coverage: none

# Composer
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
extensions: imagick, mbstring, dom, fileinfo
extensions: imagick, redis
coverage: none

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
extensions: imagick, mbstring, dom, fileinfo
extensions: imagick, redis
coverage: none

- name: Get Composer Cache Directory
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: [7.4, 8.0]
php-version: [7.4, '8.0']
connection: [mysql]
testsuite: [Api, Feature, Unit-Models, Unit-Services]

Expand All @@ -41,7 +41,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: imagick, mbstring, dom, fileinfo, ${{ matrix.connection }}
extensions: imagick, redis, ${{ matrix.connection }}
coverage: none
- name: Check PHP Version
run: php -v
Expand All @@ -68,7 +68,9 @@ jobs:
${{ runner.os }}-composer-

- name: Install composer dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader --ignore-platform-req=php
run: |
test '${{ matrix.php-version }}' == '8.0' && ext='--ignore-platform-req=php'
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader $ext

# Prepare
- name: Prepare environment
Expand Down Expand Up @@ -144,7 +146,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: [7.4, 8.0]
php-version: [7.4, '8.0']
connection: [mysql]

steps:
Expand All @@ -155,7 +157,8 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: imagick, ${{ matrix.connection }}
extensions: imagick, redis, ${{ matrix.connection }}
coverage: xdebug
- name: Check PHP Version
run: php -v
- name: Check Composer Version
Expand All @@ -181,7 +184,9 @@ jobs:
${{ runner.os }}-composer-

- name: Install composer dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader --ignore-platform-req=php
run: |
test '${{ matrix.php-version }}' == '8.0' && ext='--ignore-platform-req=php'
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader $ext

# Yarn
- name: Setup Node.js
Expand Down Expand Up @@ -235,6 +240,9 @@ jobs:
- name: Cache route
run: php artisan route:cache

- name: Test coverage page
run: REQUEST_URI=/ php scripts/tests/server-cc.php

# Test
- name: Upgrade Chrome Driver
run: php artisan dusk:chrome-driver $(google-chrome -version | awk '{ print $3 }' | cut -d . -f 1)
Expand Down
22 changes: 15 additions & 7 deletions app/Http/Controllers/Settings/RecoveryCodesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace App\Http\Controllers\Settings;

use PragmaRX\Random\Random;
use Illuminate\Http\Request;
use App\Models\User\RecoveryCode;
use App\Http\Controllers\Controller;
use App\Traits\JsonRespondController;
use PragmaRX\Recovery\Recovery as PragmaRXRecovery;

class RecoveryCodesController extends Controller
{
Expand Down Expand Up @@ -77,12 +77,20 @@ private function response($codes)
private function generate()
{
// Generate new codes
$recovery = new PragmaRXRecovery();
$codes = $recovery->setCount(config('auth.recovery.count'))
->setBlocks(config('auth.recovery.blocks'))
->setChars(config('auth.recovery.chars'))
->uppercase()
->toArray();
$random = new Random();
$random->uppercase(true);

$codes = [];

for ($i = 1; $i <= (int) config('auth.recovery.count'); $i++) {
$blocks = [];

for ($j = 1; $j <= (int) config('auth.recovery.blocks'); $j++) {
$blocks[] = $random->size(config('auth.recovery.chars'))->get();
}

$codes[] = implode('-', $blocks);
}

foreach ($codes as $code) {
RecoveryCode::create([
Expand Down
15 changes: 7 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"license": "AGPL",
"require": {
"php": "^7.4",
"php": "^7.4 || ^8.0",
"ext-bcmath": "*",
"ext-gd": "*",
"ext-gmp": "*",
Expand All @@ -30,8 +30,7 @@
"laravel/framework": "^8.0",
"laravel/passport": "^10.0",
"laravel/socialite": "^5.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.0",
"laravel/ui": "^3.0",
"laravolt/avatar": "^4.0",
"league/flysystem-aws-s3-v3": "~1.0",
"league/flysystem-cached-adapter": "^1.0",
Expand All @@ -44,9 +43,8 @@
"pragmarx/countries-laravel": "^0",
"pragmarx/google2fa": "^8.0",
"pragmarx/google2fa-laravel": "^1.3",
"pragmarx/recovery": "^0",
"pragmarx/random": "^0",
"predis/predis": "^1.1",
"ralouphie/mimey": "^2.0",
"sabre/dav": "^4.0",
"sentry/sentry-laravel": "^2.0",
"stevebauman/location": "^5.2",
Expand All @@ -58,19 +56,20 @@
"web-token/jwt-key-mgmt": "^2.1",
"web-token/jwt-signature-algorithm-ecdsa": "^2.1",
"web-token/jwt-signature-algorithm-eddsa": "^2.1",
"web-token/jwt-signature-algorithm-rsa": "^2.1"
"web-token/jwt-signature-algorithm-rsa": "^2.1",
"xantios/mimey": "^2.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3",
"fakerphp/faker": "^1.10",
"khanamiryan/qrcode-detector-decoder": "^1.0",
"laravel/dusk": "^6.0",
"laravel/legacy-factories": "^1.0",
"matthiasnoback/live-code-coverage": "^1.0",
"matthiasnoback/live-code-coverage": "^1",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^5.0",
"nunomaduro/larastan": "^0",
"phpunit/phpcov": "^7.0",
"phpunit/phpcov": "^8.0",
"phpunit/phpunit": "^9.0",
"psalm/plugin-laravel": "^1.4",
"roave/security-advisories": "dev-master",
Expand Down
Loading