From 1ccda613838907593df155fef47d20efa81f3715 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Thu, 30 Nov 2023 08:16:50 -0600 Subject: [PATCH] trying a different workflow for qodana --- .github/workflows/main.yml | 31 --------- .github/workflows/qodana.yml | 119 +++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/qodana.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3d1574ee..a63732de5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -190,29 +190,6 @@ jobs: run: | make -j$(getconf _NPROCESSORS_ONLN) - qodana-analysis: - permissions: - contents: read - - name: "Qodana Analysis" - runs-on: "ubuntu-22.04" - needs: - - "build-and-test" - - steps: - - name: "Checkout" - uses: "actions/checkout@v3" - with: - ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit - fetch-depth: 0 # a full history is required for pull request analysis - - - name: 'Qodana Scan' - uses: JetBrains/qodana-action@v2023.2 - with: - args: --baseline,qodana.sarif.json - env: - QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} - - name: Upload Code Coverage Report uses: codecov/codecov-action@v3 with: @@ -221,14 +198,6 @@ jobs: flags: unittests,${{ runner.os }},php-${{ matrix.php }} name: codecov-umbrella - - name: "Upload to Qodana" - run: | - docker run \ - -v $(pwd):/data/project/ \ - -v ./tests/output/:/data/coverage \ - -e QODANA_TOKEN="${{ secrets.QODANA_TOKEN }}" \ - jetbrains/qodana-php - - name: Upload build artifacts after Failure if: failure() uses: actions/upload-artifact@v2 diff --git a/.github/workflows/qodana.yml b/.github/workflows/qodana.yml new file mode 100644 index 000000000..7e38b43df --- /dev/null +++ b/.github/workflows/qodana.yml @@ -0,0 +1,119 @@ +name: Zephir CI + +on: + schedule: + push: + paths-ignore: + - '**.md' + - '**.txt' + - '**/nightly.yml' + - '**/release.yml' + - '**/FUNDING.yml' + +env: + RE2C_VERSION: 2.2 + ZEPHIR_PARSER_VERSION: 1.6.0 + PSR_VERSION: 1.2.0 + CACHE_DIR: .cache + +jobs: + + qodana-analysis: + name: "Qodana analysis" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 5 + + - name: Install PHP ${{ matrix.php }} + uses: shivammathur/setup-php@develop + with: + php-version: '8.0' + extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr-${{ env.PSR_VERSION }}, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }} + tools: phpize, php-config + coverage: xdebug + # variables_order: https://github.com/zephir-lang/zephir/pull/1537 + # enable_dl: https://github.com/zephir-lang/zephir/pull/1654 + # allow_url_fopen: https://github.com/zephir-lang/zephir/issues/1713 + # error_reporting: https://github.com/zendframework/zend-code/issues/160 + ini-values: >- + variables_order=EGPCS, + enable_dl=On, + allow_url_fopen=On, + error_reporting=-1, + memory_limit=1G, + date.timezone=UTC, + xdebug.max_nesting_level=256 + env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +# - name: Get composer cache directory +# id: composer-cache +# run: echo "::set-output name=dir::$(composer config cache-files-dir)" + +# - name: Set Up Composer Cache +# uses: actions/cache@v3 +# with: +# path: ${{ steps.composer-cache.outputs.dir }} +# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} +# restore-keys: ${{ runner.os }}-composer- + + - name: Install Project Dependencies + run: | + echo "::group::Install composer dependencies" + composer install --prefer-dist --no-interaction --no-ansi --no-progress + echo "::endgroup::" + + - name: Fast Commands Test + run: php zephir --help + + - name: Build Test Extension (Linux) + uses: ./.github/workflows/build-linux-ext + with: + compiler: 'gcc' + cflags: '-O2 -Wall -fvisibility=hidden -flto -DZEPHIR_RELEASE=1' + ldflags: '--coverage' + + - name: Stub Extension Info + shell: pwsh + run: | + php --ini + php --ri stub + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Unit Tests (Stub Extension) + shell: pwsh + run: | + php vendor/bin/phpunit -c phpunit.ext.xml --coverage-php ./tests/output/ext-clover.xml + + - name: Unit Tests (Zephir) + if: always() + run: php vendor/bin/phpunit --testsuite Zephir --coverage-php ./tests/output/clover.xml + env: + XDEBUG_MODE: coverage + + - name: Black-box Testing + if: always() && runner.os != 'Windows' + shell: bash + working-directory: tests/sharness + run: | + make -j$(getconf _NPROCESSORS_ONLN) + + + - name: 'Qodana Scan' + uses: JetBrains/qodana-action@v2023.2 + with: + args: --baseline,qodana.sarif.json + env: + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} + + - name: "Upload to Qodana" + run: | + docker run \ + -v $(pwd):/data/project/ \ + -v ./tests/output/:/data/coverage \ + -e QODANA_TOKEN="${{ secrets.QODANA_TOKEN }}" \ + jetbrains/qodana-php