-
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.
Merge pull request #11 from lion-packages/support
Github Actions Integration
- Loading branch information
Showing
8 changed files
with
331 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
name: Lion-Command (CI Workflow) | ||
|
||
on: | ||
push: | ||
branches: | ||
- actions-sleon | ||
- actions-saco | ||
pull_request: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: "15 0 * * *" | ||
|
||
jobs: | ||
composer-validation: | ||
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 | ||
|
||
steps: | ||
- name: Check out the 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: Set up 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 vendor/bin/phpcs --standard=PSR12 src/ | ||
|
||
- name: PHPStan (Src) | ||
run: php -d memory_limit=-1 vendor/bin/phpstan analyse src | ||
|
||
- name: PHP CodeSnifer (Tests) | ||
run: php vendor/bin/phpcs --standard=PSR12 tests/ | ||
|
||
- name: PHPStan (Tests) | ||
run: php -d memory_limit=-1 vendor/bin/phpstan analyse tests | ||
|
||
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) | ||
run: | | ||
docker ps -q | xargs -r docker stop | ||
docker ps -aq | xargs -r docker rm | ||
- name: Build the Docker image | ||
run: docker build -t command-app . | ||
|
||
- name: Start services using Docker Compose | ||
run: | | ||
docker compose -f docker-compose.yml up -d | ||
env: | ||
COMPOSE_PROJECT_NAME: test | ||
|
||
- name: Install Composer dependencies | ||
run: docker exec command-app composer install | ||
|
||
- name: Run PHP Tests | ||
run: docker exec command-app php vendor/bin/phpunit |
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.