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 dfd96bb
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
build:
docker:
- image: circleci/php:7.1-node-browsers
- image: circleci/php:8.2-node-browsers
steps:
- checkout
- run: sudo composer self-update
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 dfd96bb

Please sign in to comment.