|
| 1 | +name: 🎭 Tests |
| 2 | +on: |
| 3 | + push: |
| 4 | + paths-ignore: |
| 5 | + - .chglog/** |
| 6 | + - .github/** |
| 7 | + - '!.github/workflows/tests.yml' |
| 8 | + - .editorconfig |
| 9 | + - .gitattributes |
| 10 | + - .gitignore |
| 11 | + - .htaccess |
| 12 | + - '**.md' |
| 13 | + branches: |
| 14 | + - master |
| 15 | + pull_request: |
| 16 | + paths-ignore: |
| 17 | + - .chglog/** |
| 18 | + - .github/** |
| 19 | + - '!.github/workflows/tests.yml' |
| 20 | + - .editorconfig |
| 21 | + - .gitattributes |
| 22 | + - .gitignore |
| 23 | + - .htaccess |
| 24 | + - '**.md' |
| 25 | + branches: |
| 26 | + - master |
| 27 | +env: |
| 28 | + DB: MYSQL |
| 29 | + PDO: 1 |
| 30 | + SS_ENVIRONMENT_TYPE: "dev" |
| 31 | +jobs: |
| 32 | + phpunit: |
| 33 | + name: 🧩 PHPUnit |
| 34 | + runs-on: ubuntu-latest |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + php: |
| 39 | + - '7.4' |
| 40 | + - '8.0' |
| 41 | + recipe: |
| 42 | + - 4.3.* |
| 43 | + - 4.x-dev |
| 44 | + exclude: |
| 45 | + - php: '8.0' |
| 46 | + recipe: 4.3.* |
| 47 | + container: brettt89/silverstripe-web:${{ matrix.php }}-apache |
| 48 | + services: |
| 49 | + database: |
| 50 | + image: mysql:5.7 |
| 51 | + ports: |
| 52 | + - 3306:3306 |
| 53 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 54 | + env: |
| 55 | + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' |
| 56 | + env: |
| 57 | + SS_DEFAULT_ADMIN_USERNAME: admin |
| 58 | + SS_DEFAULT_ADMIN_PASSWORD: admin |
| 59 | + SS_DATABASE_SERVER: database |
| 60 | + SS_DATABASE_NAME: ss_default_${{ matrix.php }} |
| 61 | + SS_DATABASE_USERNAME: root |
| 62 | + SS_DATABASE_PASSWORD: '' |
| 63 | + SS_ENVIRONMENT_TYPE: dev |
| 64 | + RECIPE_CMS_VERSION: ${{ matrix.recipe }} |
| 65 | + steps: |
| 66 | + - name: Install Composer |
| 67 | + run: | |
| 68 | + curl \ |
| 69 | + -sS https://getcomposer.org/installer \ |
| 70 | + | php && \ |
| 71 | + mv -f composer.phar /usr/local/bin/composer |
| 72 | + - name: Install git |
| 73 | + run: | |
| 74 | + apt update && apt-get install git -yqq |
| 75 | + - name: Checkout code |
| 76 | + uses: actions/checkout@v2 |
| 77 | + - name: install dependencies |
| 78 | + run: | |
| 79 | + composer require --no-update silverstripe/recipe-cms:$RECIPE_CMS_VERSION &&\ |
| 80 | + composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile |
| 81 | + - name: run phpunit |
| 82 | + run: vendor/bin/phpunit -d memory_limit=500M -c "tests/phpunit.xml" tests/ |
| 83 | + # - name: generate coverage |
| 84 | + # run: phpdbg -qrr vendor/bin/phpunit -dmemory_limit=512M --coverage-clover=coverage.xml tests/ |
| 85 | + # if: ${{ matrix.php == '7.4' }} |
| 86 | + # - name: submit coverage |
| 87 | + # uses: codecov/codecov-action@v2 |
| 88 | + # with: |
| 89 | + # token: ${{ secrets.CODECOV_TOKEN }} |
| 90 | + # files: ./coverage.xml |
| 91 | + # if: ${{ matrix.php == '7.4' }} |
| 92 | + phpstan: |
| 93 | + name: 🔍 PHPStan |
| 94 | + runs-on: ubuntu-latest |
| 95 | + strategy: |
| 96 | + fail-fast: false |
| 97 | + matrix: |
| 98 | + php: |
| 99 | + - '7.4' |
| 100 | + - '8.0' |
| 101 | + recipe: |
| 102 | + - 4.3.* |
| 103 | + - 4.x-dev |
| 104 | + exclude: |
| 105 | + - php: '8.0' |
| 106 | + recipe: 4.3.* |
| 107 | + container: brettt89/silverstripe-web:7.4-apache |
| 108 | + env: |
| 109 | + RECIPE_CMS_VERSION: ${{ matrix.recipe }} |
| 110 | + steps: |
| 111 | + - name: Install Composer |
| 112 | + run: | |
| 113 | + curl \ |
| 114 | + -sS https://getcomposer.org/installer \ |
| 115 | + | php && \ |
| 116 | + mv -f composer.phar /usr/local/bin/composer |
| 117 | + - name: Install git |
| 118 | + run: | |
| 119 | + apt update && apt-get install git -yqq |
| 120 | + - name: Checkout code |
| 121 | + uses: actions/checkout@v2 |
| 122 | + - name: install dependencies |
| 123 | + run: | |
| 124 | + composer require --no-update silverstripe/recipe-cms:$RECIPE_CMS_VERSION &&\ |
| 125 | + composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile |
| 126 | + - name: run phpstan |
| 127 | + run: vendor/bin/phpstan analyse src/ tests/ -c "tests/phpstan.neon" -a "tests/bootstrap-phpstan.php" --level 4 --memory-limit 1G |
| 128 | + phpcs: |
| 129 | + name: 🔮 PHPcs |
| 130 | + runs-on: ubuntu-latest |
| 131 | + steps: |
| 132 | + - name: Checkout code |
| 133 | + uses: actions/checkout@v2 |
| 134 | + - name: lint source |
| 135 | + uses: chindit/actions-phpcs@master |
| 136 | + with: |
| 137 | + dir: src/ |
| 138 | + - name: lint tests |
| 139 | + uses: chindit/actions-phpcs@master |
| 140 | + with: |
| 141 | + dir: tests/ |
0 commit comments