-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: PSR12 standardization changes added with PHPStan
- Loading branch information
Showing
31 changed files
with
209 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,127 +1,93 @@ | ||
name: Lion-Test (CI Workflow) | ||
name: Lion-Bundle (CI Workflow) | ||
|
||
on: | ||
push: | ||
branches: | ||
- actions-sleon | ||
- actions-saco | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: "15 0 * * *" | ||
|
||
jobs: | ||
composer-validation: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: Composer Validation | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache Composer dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer | ||
- name: Set up PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.4' | ||
extensions: mbstring, gd, zip | ||
|
||
- name: Composer Validate | ||
run: composer validate --strict | ||
|
||
- name: Composer Check for vulnerabilities | ||
run: composer audit --locked | ||
|
||
- name: Composer Install | ||
run: composer install | ||
|
||
- name: Composer Dump-Autoload | ||
run: composer dump-autoload --optimize --strict-psr | ||
|
||
docker-validation: | ||
runs-on: ubuntu-latest | ||
name: Docker Validation | ||
services: | ||
mysql: | ||
image: mysql | ||
options: >- | ||
--health-cmd="mysqladmin ping" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=3 | ||
ports: | ||
- 3306:3306 | ||
env: | ||
MYSQL_DATABASE: lion_database | ||
MYSQL_ROOT_PASSWORD: lion | ||
MYSQL_PASSWORD: lion | ||
|
||
redis: | ||
image: redis | ||
ports: | ||
- 6379:6379 | ||
|
||
postgres: | ||
image: postgres | ||
ports: | ||
- 5432:5432 | ||
env: | ||
POSTGRES_DB: lion_database | ||
POSTGRES_USER: root | ||
POSTGRES_PASSWORD: lion | ||
|
||
steps: | ||
- name: Check out the repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Validate Docker Compose configuration | ||
run: docker compose config | ||
|
||
code-analyze: | ||
runs-on: ubuntu-latest | ||
name: PHP Code Analyze | ||
needs: | ||
- composer-validation | ||
- docker-validation | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
- name: Install system dependencies | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install -y sudo nano zsh curl wget unzip | ||
sudo apt-get install -y libpq-dev libpng-dev libzip-dev zlib1g-dev libonig-dev libevent-dev libssl-dev | ||
sudo apt-get clean | ||
- name: Set up PHP | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.4' | ||
extensions: mbstring, gd, zip | ||
|
||
- name: Composer Install | ||
run: composer install | ||
|
||
- name: PHP CodeSnifer (Src) | ||
run: php -d memory_limit=-1 vendor/bin/phpcs --standard=PSR12 src/ | ||
|
||
# - name: PHPStan (Src) | ||
# run: php -d memory_limit=-1 vendor/bin/phpstan analyse --level max src | ||
|
||
tests: | ||
runs-on: ubuntu-latest | ||
name: PHP Tests | ||
needs: code-analyze | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Tear down containers | ||
run: docker compose down --volumes --remove-orphans | ||
|
||
- name: Stop running Docker containers (if any) | ||
php-version: 8.4 | ||
extensions: mbstring, gd, zip, pdo, pdo_mysql, pdo_pgsql, redis, xdebug | ||
coverage: xdebug | ||
ini-values: | | ||
xdebug.mode=develop,coverage,debug | ||
xdebug.start_with_request=yes | ||
xdebug.log_level=0 | ||
tools: composer | ||
|
||
- name: Setup NPM | ||
run: | | ||
docker ps -q | xargs -r docker stop | ||
docker ps -aq | xargs -r docker rm | ||
- name: Build the Docker image | ||
run: docker build -t bundle-app . | ||
|
||
- name: Start services using Docker Compose | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | ||
source /home/runner/.bashrc | ||
nvm install 20 | ||
npm install -g npm@11 | ||
echo 'export NVM_DIR="$HOME/.nvm"' >> /home/runner/.bashrc | ||
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> /home/runner/.bashrc | ||
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> /home/runner/.bashrc | ||
source /home/runner/.bashrc | ||
- name: Copy .env.example to .env | ||
run: | | ||
docker compose -f docker-compose.yml up -d | ||
env: | ||
COMPOSE_PROJECT_NAME: test | ||
|
||
- name: Install Composer dependencies | ||
run: docker exec bundle-app composer install | ||
if [ -f .env.example ]; then | ||
cp .env.example .env | ||
else | ||
echo ".env.example not found! Please make sure the file exists." | ||
exit 1 | ||
fi | ||
- name: Install php dependencies | ||
run: composer install | ||
|
||
- name: Run PHP Tests | ||
run: docker exec bundle-app php vendor/bin/phpunit | ||
- name: Run tests | ||
run: php lion test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.