3.9.2 #84
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| name: PHP ${{ matrix.php }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: [ '8.2', '8.3' ] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up PHP ${{ matrix.php }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: mbstring, xml, json, sodium | |
| tools: composer:v2 | |
| coverage: none | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.composer/cache | |
| key: composer-${{ matrix.php }}-${{ hashFiles('composer.lock') }} | |
| restore-keys: composer-${{ matrix.php }}- | |
| - name: Install Composer dependencies | |
| run: composer install --no-interaction --prefer-dist | |
| - name: Audit Composer dependencies | |
| run: composer audit --no-dev | |
| - name: Run PHPCS | |
| run: php vendor/bin/phpcs | |
| - name: Run PHPUnit | |
| run: php vendor/bin/phpunit | |
| - name: Run PHPStan | |
| run: php vendor/bin/phpstan analyse --memory-limit=1G | |
| integration: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: test | |
| defaults: | |
| run: | |
| working-directory: wp4odoo | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| path: wp4odoo | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: mbstring, xml, json, sodium | |
| tools: composer:v2 | |
| coverage: none | |
| - name: Install Composer dependencies | |
| run: composer install --no-interaction --prefer-dist | |
| - name: Install npm dependencies | |
| run: npm ci --no-audit --no-fund | |
| - name: Start wp-env | |
| run: | | |
| for i in 1 2 3; do | |
| npx wp-env start && break | |
| echo "Attempt $i failed (likely rate-limited), retrying in $((i * 15))s…" | |
| sleep $((i * 15)) | |
| done | |
| - name: Run integration tests | |
| run: npm run test:integration | |
| - name: Stop wp-env | |
| if: always() | |
| run: npx wp-env stop | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up PHP with PCOV | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: mbstring, xml, json, sodium | |
| tools: composer:v2 | |
| coverage: pcov | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.composer/cache | |
| key: composer-8.3-${{ hashFiles('composer.lock') }} | |
| restore-keys: composer-8.3- | |
| - name: Install Composer dependencies | |
| run: composer install --no-interaction --prefer-dist | |
| - name: Run PHPUnit with coverage | |
| run: php vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml | |
| - name: Upload coverage to Codecov | |
| if: success() | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: coverage.xml | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |