Skip to content

Commit

Permalink
trying a different workflow for qodana
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Nov 30, 2023
1 parent dabafe1 commit 1ccda61
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 31 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
args: --baseline,qodana.sarif.json
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}

- name: Upload Code Coverage Report
uses: codecov/codecov-action@v3
with:
Expand All @@ -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
Expand Down
119 changes: 119 additions & 0 deletions .github/workflows/qodana.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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

0 comments on commit 1ccda61

Please sign in to comment.