diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71932840..4e63c45e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,8 +6,13 @@ on: - master push: branches: + - develop - master +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + jobs: build: name: Build @@ -18,11 +23,18 @@ jobs: ports: - 6379:6379 strategy: + fail-fast: false matrix: - version: ['7.3', '8.0', '8.1'] + version: + - '7.3' + - '8.0' + - '8.1' + - '8.2' steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -30,57 +42,44 @@ jobs: php-version: ${{ matrix.version }} extensions: mbstring, intl ini-values: post_max_size=256M, max_execution_time=180 - coverage: xdebug + coverage: pcov - name: Install dependencies run: | composer install --prefer-dist composer update - composer dumpautoload - name: Build run: | vendor/bin/phpcs --ignore=functions.php --standard=PSR2 src/ - vendor/bin/phpunit -c phpunit.xml.dist -v --testsuite integration + vendor/bin/phpunit -c phpunit.xml.dist -v --testsuite integration --coverage-clover coverage.xml - sonarqube: - name: Sonarqube - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 + - name: Set VERSION env + run: echo "VERSION=$(cat src/SplitIO/Version.php | grep 'const CURRENT' | cut -d "'" -f 2 | sed "s/'//g")" >> $GITHUB_ENV - name: SonarQube Scan (Push) - if: github.event_name == 'push' - uses: SonarSource/sonarcloud-github-action@v1.5 + if: matrix.version == '8.2' && github.event_name == 'push' + uses: SonarSource/sonarcloud-github-action@v1.9 env: SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: projectBaseDir: . args: > -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} - -Dsonar.projectName=${{ github.event.repository.name }} - -Dsonar.projectKey=splitsoftware_split-sdk-php - -Dsonar.exclusions="**/tests/**/*.*" - -Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions" - -Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}" + -Dsonar.projectVersion=${{ env.VERSION }} - name: SonarQube Scan (Pull Request) - if: github.event_name == 'pull_request' - uses: SonarSource/sonarcloud-github-action@v1.5 + if: matrix.version == '8.2' && github.event_name == 'pull_request' + uses: SonarSource/sonarcloud-github-action@v1.9 env: SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: projectBaseDir: . args: > -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} - -Dsonar.projectName=${{ github.event.repository.name }} - -Dsonar.projectKey=splitsoftware_split-sdk-php - -Dsonar.exclusions="**/tests/**/*.*" - -Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions" - -Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}" + -Dsonar.projectVersion=${{ env.VERSION }} -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} diff --git a/.github/workflows/update-license-year.yml b/.github/workflows/update-license-year.yml index 0403624e..9e582543 100644 --- a/.github/workflows/update-license-year.yml +++ b/.github/workflows/update-license-year.yml @@ -16,10 +16,10 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - + - name: Set Current year run: "echo CURRENT=$(date +%Y) >> $GITHUB_ENV" - + - name: Set Previous Year run: "echo PREVIOUS=$(($CURRENT-1)) >> $GITHUB_ENV" diff --git a/.gitignore b/.gitignore index 4ce6b701..2d768ef7 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,7 @@ test.php # Sonarqube .scannerwork + +# Tests +.phpunit.result.cache +coverage.xml diff --git a/README.md b/README.md index 0d6333f0..4674304d 100644 --- a/README.md +++ b/README.md @@ -39,13 +39,13 @@ Please see [Contributors Guide](CONTRIBUTORS-GUIDE.md) to find all you need to s Licensed under the Apache License, Version 2.0. See: [Apache License](http://www.apache.org/licenses/). ## About Split - + Split is the leading Feature Delivery Platform for engineering teams that want to confidently deploy features as fast as they can develop them. Split’s fine-grained management, real-time monitoring, and data-driven experimentation ensure that new features will improve the customer experience without breaking or degrading performance. Companies like Twilio, Salesforce, GoDaddy and WePay trust Split to power their feature delivery. - + To learn more about Split, contact hello@split.io, or get started with feature flags for free at https://www.split.io/signup. - + Split has built and maintains SDKs for: - + * Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK) * Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK) * Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK) @@ -56,9 +56,9 @@ Split has built and maintains SDKs for: * GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK) * Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK) * iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK) - + For a comprehensive list of open source projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20). - + **Learn more about Split:** - + Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](http://help.split.io) for more detailed information. diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4f4db500..43432876 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,6 +8,12 @@ + + + src + + + tests/ @@ -46,8 +52,6 @@ tests/Suite/Sdk/ - - tests/Suite/Adapter/ tests/Suite/Attributes/ diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..dcfd977f --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,7 @@ +sonar.projectName=php-client +sonar.projectKey=splitsoftware_split-sdk-php +sonar.sources=src +sonar.tests=tests +sonar.php.coverage.reportPaths=coverage.xml +sonar.links.ci=https://github.com/splitio/php-client +sonar.links.scm=https://github.com/splitio/php-client/actions