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 5aefe84
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 12 deletions.
10 changes: 6 additions & 4 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.0-fpm
steps:
- checkout
- run: sudo composer self-update
- run: apt-get update && apt-get install -y git unzip
- run: pecl install xdebug && docker-php-ext-enable xdebug
- 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,8 +19,7 @@ jobs:
key: composer-v1-{{ checksum "composer.json" }}
paths:
- vendor
- run: sudo docker-php-ext-enable xdebug
- run: ./vendor/bin/phpunit -d memory_limit=-1 --coverage-html coverage
- run: ./check_coverage.php
- store_artifacts:
path: coverage
path: coverage
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
16 changes: 13 additions & 3 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
<?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">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
>
<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 5aefe84

Please sign in to comment.