Skip to content

Merge pull request #10 from niden-code/T9-docker-compose #16

Merge pull request #10 from niden-code/T9-docker-compose

Merge pull request #10 from niden-code/T9-docker-compose #16

Workflow file for this run

# This file is part of Phalcon.
#
# (c) Phalcon Team <[email protected]>
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.
name: REST API v6 CI
on:
push:
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
workflow_dispatch:
env:
fail-fast: true
# PHP extensions required by Composer
EXTENSIONS: json, mbstring, pdo, pdo_mysql
permissions: { }
jobs:
# PHP CodeSniffer inspection
phpcs:
name: "Quality gate"
if: "!contains(github.event.head_commit.message, 'ci skip')"
permissions:
contents: read
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
php:
- '8.2'
- '8.3'
- '8.4'
steps:
- uses: actions/checkout@v4
- name: "Setup PHP"
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.EXTENSIONS }}
tools: pecl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Install development dependencies with Composer"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--prefer-dist"
- name: "PHPCS"
run: |
composer cs
# - name: "PHPStan"
# run: |
# composer analyze
unit-tests:
needs: phpcs
permissions:
contents: read # to fetch code (actions/checkout)
name: Unit tests / PHP-${{ matrix.php }}
runs-on: ubuntu-22.04
strategy:
matrix:
php:
- '8.2'
- '8.3'
- '8.4'
services:
mariadb:
image: mariadb:10.6
ports:
- "3306:3306"
env:
MYSQL_ROOT_PASSWORD: secret
MYSQL_USER: phalcon
MYSQL_DATABASE: phalcon
MYSQL_PASSWORD: secret
steps:
- uses: actions/checkout@v4
- name: "Setup PHP"
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.EXTENSIONS }}
tools: pecl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Install development dependencies with Composer"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--prefer-dist"
- name: "Setup Tests"
shell: bash
run: |
cp config/.env.ci .env
- name: "Run Unit Tests"
if: always()
run: |
composer test-unit
- name: "Run Migrations"
if: always()
run: |
composer migrate
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: ./
args: >
-Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }}
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }}
-Dsonar.sources=src/
-Dsonar.exclusions=vendor/**,cv/**,tests/**
-Dsonar.sourceEncoding=UTF-8
-Dsonar.language=php
-Dsonar.tests=tests/