Skip to content

Commit

Permalink
Add tests to github action
Browse files Browse the repository at this point in the history
  • Loading branch information
caleeli committed Jun 26, 2024
1 parent d68dc7c commit 9383b12
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 10 deletions.
9 changes: 6 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ version: 2
jobs:
build:
docker:
- image: circleci/php:7.1-node-browsers
- image: php:8.2.20-cli-alpine
steps:
- checkout
- run: sudo composer self-update
- run: apk add --no-cache bash git
- run: apk add --no-cache $PHPIZE_DEPS && docker-php-ext-install pdo_mysql
- run: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- run: composer self-update
- restore_cache:
keys:
- composer-v1-{{ checksum "composer.json" }}
Expand All @@ -16,7 +19,7 @@ jobs:
key: composer-v1-{{ checksum "composer.json" }}
paths:
- vendor
- run: sudo docker-php-ext-enable xdebug
- run: pecl install xdebug && docker-php-ext-enable xdebug
- run: ./vendor/bin/phpunit -d memory_limit=-1 --coverage-html coverage
- run: ./check_coverage.php
- store_artifacts:
Expand Down
42 changes: 37 additions & 5 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,49 @@ on:
push:
branches:
- develop
- next
pull_request:
types: [opened, synchronize, reopened]
types: [opened, synchronize, reopened, edited]

jobs:
build:
name: Scan
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Update Composer
run: sudo composer self-update

- name: Cache Composer dependencies
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: composer-v1-${{ hashFiles('composer.json') }}
restore-keys: |
composer-v1-
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
php-version: "8.2"
extensions: xdebug
coverage: xdebug
ini-values: xdebug.mode=coverage

- name: Install Composer dependencies
run: composer install -n --prefer-dist

- name: Run PHPUnit tests
run: ./vendor/bin/phpunit -d memory_limit=-1

- name: List coverage files
run: ls -l coverage

- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
11 changes: 9 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true" processUncoveredFiles="false">
<coverage>
<report>
<html outputDirectory="coverage" />
<clover outputFile="coverage/clover.xml"/>
</report>
<include>
<directory suffix=".php">./src</directory>
<directory suffix=".php">src</directory>
</include>
</coverage>

<testsuites>
<testsuite name="Features">
<directory>tests/Feature</directory>
</testsuite>
<testsuite name="Unit">
<directory>tests/unit</directory>
</testsuite>
</testsuites>
Expand Down
3 changes: 3 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
sonar.projectKey=ProcessMaker_nayra_AYq58Vs2xYvY_isvKv_4
sonar.php.coverage.reportPaths=./coverage/clover.xml
sonar.sources=src
sonar.tests=tests

0 comments on commit 9383b12

Please sign in to comment.