Skip to content

Commit

Permalink
feat: upgrade dependencies (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Sep 29, 2023
1 parent 0b41db7 commit 1d85427
Show file tree
Hide file tree
Showing 80 changed files with 8,527 additions and 5,976 deletions.
68 changes: 41 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ on:
release:
types: [created]

# workflow_run:
# workflows: [Compress images]
# types: [completed]

env:
default-php-version: '8.1'
default-php-version: '8.2'
coverage-with: 'sqlite'

concurrency:
Expand All @@ -29,35 +25,25 @@ jobs:
runs-on: ubuntu-latest
name: Testsuite ${{ matrix.testsuite }} with PHP ${{ matrix.php-version }} + ${{ matrix.connection }}

services:
pgsql:
image: postgres:13.0
env:
POSTGRES_DB: customers
POSTGRES_USER: customers
POSTGRES_PASSWORD: secret
ports:
- 5432:5432
options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: false
matrix:
php-version: ['8.1']
php-version: ['8.2']
connection: [sqlite, mysql, pgsql]
testsuite: [Unit]
coverage: [true] # run test with coverage, if 'coverage-with' match with the connection

steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, dom, fileinfo, ${{ matrix.connection }}
coverage: none
coverage: pcov
ini-values: pcov.directory=., pcov.exclude="~vendor~"
- name: Check PHP Version
run: php -v
- name: Check Composer Version
Expand Down Expand Up @@ -109,6 +95,13 @@ jobs:
run: |
sudo systemctl start mysql.service
mysql --protocol=tcp -u root -proot -e "CREATE DATABASE IF NOT EXISTS customers CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
- name: Create pgsql database
if: matrix.connection == 'pgsql'
run: |
sudo systemctl start postgresql.service
sudo -u postgres psql --command="CREATE USER customers PASSWORD 'secret'" --command="\du"
sudo -u postgres createdb --owner=customers customers
PGPASSWORD=secret psql --username=customers --host=localhost --list customers
- name: Generate key
run: php artisan key:generate
Expand All @@ -121,7 +114,7 @@ jobs:
# Test
- name: Run tests suite with coverage
if: matrix.connection == env.coverage-with && matrix.php-version == env.default-php-version && matrix.coverage
run: phpdbg -dmemory_limit=4G -qrr vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} --log-junit ./results/${{ matrix.connection }}/junit/results${{ matrix.testsuite }}.xml --coverage-clover ./results/${{ matrix.connection }}/coverage/coverage${{ matrix.testsuite }}.xml
run: vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} --log-junit ./results/${{ matrix.connection }}/junit/results${{ matrix.testsuite }}.xml --coverage-clover ./results/${{ matrix.connection }}/coverage/coverage${{ matrix.testsuite }}.xml
env:
DB_CONNECTION: ${{ matrix.connection }}
- name: Run tests
Expand All @@ -133,9 +126,10 @@ jobs:
- name: Fix results files
run: sed -i -e "s%$GITHUB_WORKSPACE/%%g" **/*.xml
working-directory: results/${{ matrix.connection }}
if: success() || failure()

- name: Store results
if: matrix.php-version == env.default-php-version
if: matrix.php-version == env.default-php-version && (success() || failure())
uses: actions/upload-artifact@v3
with:
name: results
Expand All @@ -145,15 +139,15 @@ jobs:
###########################
# Reporting to sonarcloud
###########################
reporting:
sonarcloud:
needs: tests
runs-on: ubuntu-latest
name: Sonarcloud
if: ${{ ! startsWith(github.ref, 'dependabot/') }}
if: ${{ ! startsWith(github.ref, 'dependabot/') && (success() || failure()) }}

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

Expand All @@ -165,8 +159,7 @@ jobs:

- name: Merge junit files
run: |
yarn global add junit-merge
$(yarn global bin)/junit-merge --recursive --dir results/${{ env.coverage-with }}/junit --out results/results.xml
yarn dlx junit-merge --recursive --dir results/${{ env.coverage-with }}/junit --out results/results.xml
- name: Set version parameter
id: version
Expand All @@ -183,7 +176,7 @@ jobs:
- name: SonarCloud Scan
if: env.SONAR_TOKEN != ''
uses: SonarSource/sonarcloud-github-action@v1.7
uses: SonarSource/sonarcloud-github-action@v2.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand All @@ -192,3 +185,24 @@ jobs:
-Dsonar.projectVersion=${{ steps.version.outputs.value }}
-Dsonar.php.tests.reportPath=./results/results.xml
-Dsonar.php.coverage.reportPaths=${{ steps.coverage.outputs.list }}
###########################
# JUnit Test Report
###########################
reporting:
needs: tests
runs-on: ubuntu-latest
name: Reporting
if: success() || failure()

steps:
- name: Download results
uses: actions/download-artifact@v3
with:
name: results
path: results

- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
with:
report_paths: results/${{ env.coverage-with }}/junit/*.xml
23 changes: 10 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ on:
workflow_dispatch:

env:
php-version: '8.1'
node-version: 16
php-version: '8.2'
node-version: 18

concurrency:
group: Deploy ${{ github.ref }}
Expand All @@ -35,7 +35,7 @@ jobs:

steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -77,20 +77,17 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- name: Get yarn cache directory path
id: yarn-cache
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache yarn files
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: .yarn/cache
key: ${{ runner.os }}-yarn-v2-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-yarn-
${{ runner.os }}-yarn-v2-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-yarn-v2-
- name: Install yarn dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
- name: Lint files
run: yarn run lint

Expand Down Expand Up @@ -150,7 +147,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -211,7 +208,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download assets
uses: actions/download-artifact@v3
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ on:
pull_request:
types: [opened, synchronize, reopened]

# workflow_run:
# workflows: ['Compress images']
# types: [completed]

env:
php-version: '8.1'
php-version: '8.2'

concurrency:
group: Static ${{ github.ref }}
Expand All @@ -21,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP ${{ env.php-version }}
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -54,7 +50,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP ${{ env.php-version }}
uses: shivammathur/setup-php@v2
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
/results
/storage/*.key
/vendor
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.env
.env.backup
.phpunit.result.cache
Expand Down
874 changes: 874 additions & 0 deletions .yarn/releases/yarn-3.6.3.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.6.3.cjs
2 changes: 1 addition & 1 deletion app/Console/Commands/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function handle(): void
$this->artisan('✓ Clear config cache', 'config:clear');
$this->artisan('✓ Resetting route cache', 'route:cache');
$this->artisan('✓ Resetting view cache', 'view:clear');
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreEnd
} else {
$this->artisan('✓ Clear config cache', 'config:clear');
$this->artisan('✓ Clear route cache', 'route:clear');
Expand Down
7 changes: 3 additions & 4 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ class Kernel extends HttpKernel
* @var array<int, class-string|string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
Expand All @@ -34,15 +33,15 @@ class Kernel extends HttpKernel
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\CodeZero\Localizer\Middleware\SetLocale::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\CheckLocale::class,
\App\Http\Middleware\HandleInertiaRequests::class,
],

'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
Expand Down
61 changes: 0 additions & 61 deletions app/Http/Middleware/CheckLocale.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/Http/Middleware/EncryptCookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class EncryptCookies extends Middleware
/**
* The names of the cookies that should not be encrypted.
*
* @var array<string>
* @var array<int,string>
*/
protected $except = [
//
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/PreventRequestsDuringMaintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PreventRequestsDuringMaintenance extends Middleware
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array<string>
* @var array<int,string>
*/
protected $except = [
//
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/TrimStrings.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TrimStrings extends Middleware
/**
* The names of the attributes that should not be trimmed.
*
* @var array<string>
* @var array<int,string>
*/
protected $except = [
'current_password',
Expand Down
Loading

0 comments on commit 1d85427

Please sign in to comment.