|
| 1 | +name: Run Tests |
| 2 | +on: |
| 3 | + # Triggers the workflow on pull request events but only for the main branch |
| 4 | + pull_request: |
| 5 | + branches: [ master ] |
| 6 | + types: [ opened, synchronize, reopened ] |
| 7 | + workflow_dispatch: |
| 8 | +jobs: |
| 9 | + run: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + php-versions: ['5.6', '7.2', '7.4'] |
| 14 | + steps: |
| 15 | + - name: Check out repository |
| 16 | + uses: actions/checkout@v2 |
| 17 | + |
| 18 | + - name: Set up Node |
| 19 | + uses: actions/setup-node@v2 |
| 20 | + with: |
| 21 | + node-version: '14' |
| 22 | + |
| 23 | + - name: Setup PHP |
| 24 | + uses: shivammathur/setup-php@v2 |
| 25 | + with: |
| 26 | + php-version: ${{ matrix.php-versions }} |
| 27 | + tools: php-cs-fixer |
| 28 | + |
| 29 | + - name: Get composer cache directory |
| 30 | + id: composer-cache |
| 31 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 32 | + |
| 33 | + - name: Cache dependencies |
| 34 | + uses: actions/cache@v2 |
| 35 | + with: |
| 36 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 37 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 38 | + restore-keys: ${{ runner.os }}-composer- |
| 39 | + |
| 40 | + - name: Install dependencies |
| 41 | + run: composer install --prefer-dist |
| 42 | + |
| 43 | + - name: Install Node packages |
| 44 | + run: npm install -g eslint |
| 45 | + |
| 46 | + - name: Run JS linter (eslint) |
| 47 | + run: eslint web/js |
| 48 | + |
| 49 | + - name: Run PHP linter (php-cs-fixer) |
| 50 | + run: vendor/bin/php-cs-fixer --diff --dry-run -v fix |
| 51 | + |
| 52 | + - name: Run tests |
| 53 | + run: | |
| 54 | + cp app/config/config.ini-ghactions app/config/config.ini |
| 55 | + vendor/atoum/atoum/bin/atoum -d tests/units/ --use-light-report |
| 56 | + php tests/functional/api.php |
| 57 | + php tests/functional/pages.php |
0 commit comments