Skip to:
Content

BuddyPress.org

Ticket #8421: 8421.patch

File 8421.patch, 3.7 KB (added by imath, 3 years ago)
  • new file .github/workflows/phpunit-tests.yml

    diff --git .github/workflows/phpunit-tests.yml .github/workflows/phpunit-tests.yml
    new file mode 100644
    index 000000000..69f40e374
    - +  
     1# PHP Unit workflow
     2name: PHP Unit Tests
     3
     4on:
     5  push:
     6    branches: [ master ]
     7
     8jobs:
     9  unit-php:
     10    name: ${{ matrix.php }} on ${{ matrix.os }} against WordPress Trunk
     11    runs-on: ${{ matrix.os }}
     12    strategy:
     13      fail-fast: false
     14      matrix:
     15        php: [ '7.4', '8.0' ]
     16        os: [ ubuntu-latest ]
     17
     18    env:
     19      WP_ENV_PHP_VERSION: ${{ matrix.php }}
     20
     21    steps:
     22      - name: Checkout repository
     23        uses: actions/checkout@v2
     24
     25      - name: Log information
     26        run: |
     27          echo "$GITHUB_REF"
     28          echo "$GITHUB_EVENT_NAME"
     29          npm --version
     30          node --version
     31          git --version
     32          php --version
     33          composer --version
     34
     35      - name: Install Composer dependencies
     36        uses: ramsey/composer-install@v1
     37        with:
     38          composer-options: "--ignore-platform-reqs"
     39
     40      - name: Cache node modules
     41        uses: actions/cache@v2
     42        env:
     43          cache-name: cache-node-modules
     44        with:
     45          # npm cache files are stored in `~/.npm` on Linux/macOS
     46          path: ~/.npm
     47          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
     48          restore-keys: |
     49            ${{ runner.os }}-build-${{ env.cache-name }}-
     50            ${{ runner.os }}-build-
     51            ${{ runner.os }}-
     52
     53      - name: Use Node.js 14.x
     54        uses: actions/setup-node@v1
     55        with:
     56          node-version: 14.x
     57
     58      - name: Install node modules
     59        run: npm ci
     60
     61      - name: Install WordPress
     62        run: |
     63          chmod -R 767 ./
     64          npm run wp-env start
     65
     66      - name: Running single site unit tests
     67        run: npm run ga-test-php
     68        if: ${{ success() || failure() }}
     69
     70      - name: Running multisite unit tests
     71        run: npm run ga-test-php-multisite
     72        if: ${{ success() || failure() }}
  • package.json

    diff --git package.json package.json
    index 13a9f6cc5..f6564e0e2 100644
     
    5050                "test-php": "npm run wp-env run phpunit 'php /var/www/html/wp-content/plugins/buddypress/vendor/phpunit/phpunit/phpunit -c /var/www/html/wp-content/plugins/buddypress/tests/phpunit/env.xml'",
    5151                "test-php:group": "npm run wp-env run phpunit 'php /var/www/html/wp-content/plugins/buddypress/vendor/phpunit/phpunit/phpunit -c /var/www/html/wp-content/plugins/buddypress/tests/phpunit/env.xml --group $npm_confi_g'",
    5252                "test-php-multisite": "npm run wp-env run phpunit 'php /var/www/html/wp-content/plugins/buddypress/vendor/phpunit/phpunit/phpunit -c /var/www/html/wp-content/plugins/buddypress/tests/phpunit/env.multisite.xml'",
    53                 "test-php-multisite:group": "npm run wp-env run phpunit 'php /var/www/html/wp-content/plugins/buddypress/vendor/phpunit/phpunit/phpunit -c /var/www/html/wp-content/plugins/buddypress/tests/phpunit/env.multisite.xml --group $npm_confi_g'"
     53                "test-php-multisite:group": "npm run wp-env run phpunit 'php /var/www/html/wp-content/plugins/buddypress/vendor/phpunit/phpunit/phpunit -c /var/www/html/wp-content/plugins/buddypress/tests/phpunit/env.multisite.xml --group $npm_confi_g'",
     54                "ga-test-php": "npm run wp-env run phpunit 'php /var/www/html/wp-content/plugins/BuddyPress/vendor/phpunit/phpunit/phpunit -c /var/www/html/wp-content/plugins/BuddyPress/tests/phpunit/env.xml'",
     55                "ga-test-php-multisite": "npm run wp-env run phpunit 'php /var/www/html/wp-content/plugins/BuddyPress/vendor/phpunit/phpunit/phpunit -c /var/www/html/wp-content/plugins/BuddyPress/tests/phpunit/env.multisite.xml'"
    5456        },
    5557        "keywords": [
    5658                "activity",