diff --git a/.github/workflows/php81.yaml b/.github/workflows/php81.yaml new file mode 100644 index 0000000..fead114 --- /dev/null +++ b/.github/workflows/php81.yaml @@ -0,0 +1,26 @@ +name: Build PHP 8.1 + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + test: + name: Run Tests + uses: WebFiori/workflows/.github/workflows/test-php.yaml@main + with: + php-version: '8.1' + + code-coverage: + name: Coverage + needs: test + uses: WebFiori/workflows/.github/workflows/coverage-codecov.yaml@main + with: + php-version: '8.1' + coverage-file: 'php-8.1-coverage.xml' + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + + diff --git a/.github/workflows/php81.yml b/.github/workflows/php81.yml deleted file mode 100644 index a5bcffc..0000000 --- a/.github/workflows/php81.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Build PHP 8.1 - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] -env: - OPERATING_SYS: ubuntu-latest - PHP_VERSION: 8.1 -jobs: - test: - runs-on: "ubuntu-latest" - - name: "PHP 8.1 - Ubuntu-Latest" - - steps: - - name: Clone Repo - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ env.PHP_VERSION }} - extensions: mysqli, mbstring, sqlsrv - tools: phpunit:9.5.20, composer - - - name: Install Dependencies - run: composer install --prefer-source --no-interaction - - - name: Execute Tests - run: phpunit --configuration=tests/phpunit.xml - - - name: CodeCov - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/php82.yml b/.github/workflows/php82.yml index 3757e10..145a921 100644 --- a/.github/workflows/php82.yml +++ b/.github/workflows/php82.yml @@ -5,33 +5,22 @@ on: branches: [ main, dev ] pull_request: branches: [ main ] -env: - OPERATING_SYS: ubuntu-latest - PHP_VERSION: 8.2 jobs: test: - runs-on: "ubuntu-latest" - - name: "PHP 8.2 - Ubuntu-Latest" + name: Run Tests + uses: WebFiori/workflows/.github/workflows/test-php.yaml@main + with: + php-version: '8.2' + + code-coverage: + name: Coverage + needs: test + uses: WebFiori/workflows/.github/workflows/coverage-codecov.yaml@main + with: + php-version: '8.2' + coverage-file: 'php-8.2-coverage.xml' + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - steps: - - name: Clone Repo - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ env.PHP_VERSION }} - extensions: mysqli, mbstring, sqlsrv - tools: phpunit:9.5.20, composer - - - name: Install Dependencies - run: composer install --prefer-source --no-interaction - - - name: Execute Tests - run: phpunit --configuration=tests/phpunit.xml - - name: CodeCov - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + diff --git a/.github/workflows/php83.yml b/.github/workflows/php83.yml index cad6155..8ecb808 100644 --- a/.github/workflows/php83.yml +++ b/.github/workflows/php83.yml @@ -9,49 +9,37 @@ env: OPERATING_SYS: ubuntu-latest PHP_VERSION: 8.3 jobs: + test: - runs-on: "ubuntu-latest" + name: Run Tests + uses: WebFiori/workflows/.github/workflows/test-php.yaml@main + with: + php-version: '8.3' + phpunit-config: 'tests/phpunit10.xml' - name: "PHP 8.3 - Ubuntu-Latest" - - steps: - - name: Clone Repo - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ env.PHP_VERSION }} - extensions: mysqli, mbstring, sqlsrv - tools: phpunit:9.5.20, composer - - - name: Install Dependencies - run: composer install --prefer-source --no-interaction - - - name: Execute Tests - run: phpunit --configuration=tests/phpunit.xml - - - name: CodeCov - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - - name: SonarCloud Code Scan - uses: sonarsource/sonarqube-scan-action@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + code-coverage: + name: Coverage + needs: test + uses: WebFiori/workflows/.github/workflows/coverage-codecov.yaml@main + with: + php-version: '8.3' + coverage-file: 'php-8.3-coverage.xml' + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + code-quality: + name: Code Quality + needs: test + uses: WebFiori/workflows/.github/workflows/quality-sonarcloud.yaml@main + with: + coverage-file: 'php-8.3-coverage.xml' + secrets: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - release_prod: + release-prod: name: Prepare Production Release Branch / Publish Release - needs: - - "test" - runs-on: "ubuntu-latest" - if: github.ref == 'refs/heads/main' - steps: - - uses: actions/checkout@v4 - - uses: google-github-actions/release-please-action@v3 - with: - release-type: php - config-file: release-please-config.json - token: ${{ secrets.GITHUB_TOKEN }} + needs: [code-coverage, code-quality] + uses: WebFiori/workflows/.github/workflows/release-php.yaml@main + with: + branch: 'main' diff --git a/.github/workflows/php84.yml b/.github/workflows/php84.yml index b9fc78e..282505e 100644 --- a/.github/workflows/php84.yml +++ b/.github/workflows/php84.yml @@ -5,36 +5,22 @@ on: branches: [ main, dev ] pull_request: branches: [ main ] -env: - OPERATING_SYS: ubuntu-latest - PHP_VERSION: 8.4 jobs: test: - runs-on: "ubuntu-latest" - - name: "PHP 8.4 - Ubuntu-Latest" + name: Run Tests + uses: WebFiori/workflows/.github/workflows/test-php.yaml@main + with: + php-version: '8.4' + + code-coverage: + name: Coverage + needs: test + uses: WebFiori/workflows/.github/workflows/coverage-codecov.yaml@main + with: + php-version: '8.4' + coverage-file: 'php-8.4-coverage.xml' + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - steps: - - name: Clone Repo - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ env.PHP_VERSION }} - extensions: mysqli, mbstring, sqlsrv - tools: phpunit:9.5.20, composer - - - name: Shutdown Ubuntu MySQL - run: sudo service mysql stop - - - name: Install Dependencies - run: composer install --prefer-source --no-interaction - - - name: Execute Tests - run: phpunit --configuration=tests/phpunit.xml - - name: CodeCov - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + diff --git a/composer.json b/composer.json index d7950bf..b790d08 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,8 @@ } }, "scripts":{ - "test": "phpunit --configuration tests/phpunit.xml" + "test": "phpunit --configuration tests/phpunit.xml", + "test-10": "phpunit --configuration tests/phpunit10.xml" }, "require-dev": { "phpunit/phpunit": "^10.0" diff --git a/tests/phpunit10.xml b/tests/phpunit10.xml new file mode 100644 index 0000000..e6d09b3 --- /dev/null +++ b/tests/phpunit10.xml @@ -0,0 +1,28 @@ + + + + + + + + + ./WebFiori/Tests/Json + + + + + + ../WebFiori/Json + + + + + + + + + +