diff --git a/.circleci/config.yml b/.circleci/config.yml index c3d14393..048df3c5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 autoconf g++ make + - 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" }} @@ -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: diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 3980790a..64775419 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -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 }} diff --git a/phpunit.xml b/phpunit.xml index 5c977b2d..05ac46f1 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,13 +1,20 @@ - + + + + + - ./src + src + tests/Feature + + tests/unit diff --git a/sonar-project.properties b/sonar-project.properties index 48a651e5..f6d6d464 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1 +1,4 @@ sonar.projectKey=ProcessMaker_nayra_AYq58Vs2xYvY_isvKv_4 +sonar.php.coverage.reportPaths=./coverage/clover.xml +sonar.sources=src +sonar.tests=tests