balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

build-and-test.yml (2305B)


      1 name: Build and test
      2 on: [push, pull_request]
      3 jobs:
      4  # TODO: create another job for integration testing that includes Cypress, booting up WPO, etc
      5  # Reference wp-cli: https://github.com/wp-cli/wp-cli/blob/master/.github/workflows/testing.yml
      6   unit: #-------------------------------------------
      7     name: PHP ${{ matrix.php }}
      8     runs-on: ubuntu-latest
      9     strategy:
     10       fail-fast: false
     11       matrix:
     12         php: ['7.4']
     13     steps:
     14       - name: Check out source code
     15         uses: actions/checkout@v2
     16 
     17       - name: Setup PHP
     18         uses: shivammathur/setup-php@v2
     19         with:
     20           php-version: '${{ matrix.php }}'
     21           extensions: mysql, zip
     22           coverage: none
     23           tools: composer:v1, wp-cli, cs2pr, phpcs
     24 
     25       - name: Get Composer cache directory
     26         id: composer-cache
     27         run: |
     28           echo "::set-output name=dir::$(composer config cache-files-dir)"
     29 
     30       - name: Use Composer cache
     31         uses: actions/cache@master
     32         with:
     33           path: ${{ steps['composer-cache'].outputs.dir }}
     34           key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
     35           restore-keys: |
     36             ${{ runner.os }}-composer-
     37 
     38       - name: Install dependencies
     39         run: composer install --prefer-dist --no-progress --no-suggest
     40 
     41       - name: Install PHPCS
     42         run: git clone -b master https://github.com/WordPress/WordPress-Coding-Standards.git ${{ github.workspace }}/wpcs
     43 
     44       - name: PHPCS check
     45         run: |
     46             phpcs --config-set installed_paths ${{ github.workspace }}/vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP,${{ github.workspace }}/vendor/phpcompatibility/php-compatibility/PHPCompatibility,${{ github.workspace }}/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieSodiumCompat,${{ github.workspace }}/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieRandomCompat,${{ github.workspace }}/wpcs
     47             phpcs -i
     48             phpcs -q --report=checkstyle . | cs2pr
     49 
     50       - name: Install NPM packages
     51         run: npm ci
     52         env:
     53           CYPRESS_INSTALL_BINARY: "0"
     54 
     55       - name: Build assets
     56         run: npm run build
     57 
     58       - name: Test JavaScript
     59         run: npm run test
     60 
     61       - name: Lint JavaScript
     62         run: npm run lint