Skip to content

Commit

Permalink
feat: refactors (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Jan 29, 2024
1 parent f7aa030 commit a6cf9be
Show file tree
Hide file tree
Showing 27 changed files with 6,255 additions and 1,744 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP_NAME=Shelter
APP_NAME=TousLesPrenoms
APP_ENV=local
APP_KEY=
APP_DEBUG=true
Expand Down
15 changes: 11 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

*.scss linguist-vendored
*.js linguist-vendored
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
/.vscode export-ignore
/tests export-ignore
/scripts export-ignore
.gitattributes export-ignore
.gitignore export-ignore
125 changes: 99 additions & 26 deletions .github/workflows/dusk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,124 @@ on:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
release:
types: [created]

env:
php-version: 8.2
node-version: 20
connection: mysql
database_name: touslesprenoms
testsuite: ''

jobs:

dusk-php:
name: Dusk
name: Dusk tests
runs-on: ubuntu-latest
env:
APP_URL: "http://127.0.0.1:8000"
DB_USERNAME: root
DB_PASSWORD: root
MAIL_MAILER: log

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

- name: Setup PHP ${{ env.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: mbstring, dom, fileinfo, mysql
php-version: ${{ env.php-version }}
extensions: mbstring, dom, fileinfo, ${{ env.connection }}
coverage: none
- name: Prepare The Environment
run: cp .env.dusk.ci .env
- name: Create Database

- name: Check PHP Version
run: php -v
- name: Check Composer Version
run: composer -V
- name: Check PHP Extensions
run: php -m
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

# Composer
- name: Validate composer.json and composer.lock
run: composer validate

- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer files
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ env.php-version }}
${{ runner.os }}-composer-
- name: Install composer dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

# Yarn
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
cache: yarn
- name: Install yarn dependencies
run: yarn install --immutable
- name: Build assets
run: yarn run build


# Prepare
- name: Prepare environment
run: |
sudo systemctl start mysql
mysql --user="root" --password="root" -e "CREATE DATABASE \`shelter\` character set UTF8mb4 collate utf8mb4_bin;"
- name: Install Composer Dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Generate Application Key
cp tests/.env.ci.dusk .env
- name: Create mysql database
if: env.connection == 'mysql'
run: |
sudo systemctl start mysql.service
mysql --protocol=tcp -u root -proot -e "CREATE DATABASE IF NOT EXISTS ${{ env.database_name }} CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
- name: Generate key
run: php artisan key:generate

- name: Run migrations
run: php artisan migrate --no-interaction -vvv
- name: Install dependencies
run: yarn install
- name: Build assets
run: yarn build
- name: Cache route
run: php artisan route:cache

- name: Upgrade Chrome Driver
run: php artisan dusk:chrome-driver --detect
- name: Start Chrome Driver
run: ./vendor/laravel/dusk/bin/chromedriver-linux &
run: |
chmod -R 0755 vendor/laravel/dusk/bin/
./vendor/laravel/dusk/bin/chromedriver-linux &
- name: Run Laravel Server
run: php artisan serve --no-reload &

- name: Set results artifact name
id: artifact
run: echo "name=${{ env.connection }}_${{ env.php-version }}_${{ env.testsuite }}" | sed -e "s/*//g" >> $GITHUB_OUTPUT

# Test
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run Dusk Tests
run: php artisan dusk
run: php artisan dusk --log-junit results/junit/dusk.xml
env:
DB_CONNECTION: ${{ env.connection }}

- name: Fix results files
run: sed -i -e "s%$GITHUB_WORKSPACE/%%g" **/*.xml
working-directory: results
if: success() || failure()

- name: Store results
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: results_${{ steps.artifact.outputs.name }}
path: results

- name: Upload Screenshots
if: failure()
uses: actions/upload-artifact@v2
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/semantic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
pull_request:
types: [opened, edited, synchronize]


jobs:
main:
name: Validate PR title
Expand Down
79 changes: 0 additions & 79 deletions .github/workflows/static.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Static analysis

on:
pull_request:
types: [opened, synchronize, reopened]

env:
php-version: '8.2'

concurrency:
group: Static ${{ github.ref }}
cancel-in-progress: true

jobs:
statics:
name: Static analysis
uses: monicahq/workflows/.github/workflows/static.yml@v2
with:
php-version: 8.2
Loading

0 comments on commit a6cf9be

Please sign in to comment.