|
1 | 1 | name: run-tests |
2 | 2 |
|
3 | | -on: [push, pull_request] |
| 3 | +on: |
| 4 | + - push |
| 5 | + - pull_request |
4 | 6 |
|
5 | 7 | jobs: |
6 | | - test: |
7 | | - runs-on: ubuntu-latest |
8 | | - strategy: |
9 | | - fail-fast: true |
10 | | - matrix: |
11 | | - php: [8.3, 8.2, 8.1] |
12 | | - laravel: [10.*] |
13 | | - db: [mysql, postgres, sqlite] |
14 | | - dependency-version: [prefer-lowest, prefer-stable] |
15 | | - include: |
16 | | - - laravel: 10.* |
17 | | - testbench: 8.* |
| 8 | + test: |
| 9 | + runs-on: ubuntu-latest |
18 | 10 |
|
19 | | - name: P${{ matrix.php }} - L${{ matrix.laravel }} - DB ${{ matrix.db }} - ${{ matrix.dependency-version }} |
| 11 | + strategy: |
| 12 | + fail-fast: true |
| 13 | + matrix: |
| 14 | + php: [8.3, 8.2, 8.1] |
| 15 | + laravel: ["10.*", "11.*"] |
| 16 | + db: [mysql, postgres, sqlite] |
| 17 | + dependency-version: [prefer-lowest, prefer-stable] |
| 18 | + include: |
| 19 | + - laravel: 10.* |
| 20 | + testbench: 8.* |
| 21 | + - laravel: 11.* |
| 22 | + testbench: 9.* |
| 23 | + exclude: |
| 24 | + - laravel: 11.* |
| 25 | + php: 8.1 |
20 | 26 |
|
21 | | - services: |
22 | | - mysql: |
23 | | - image: mysql:8.0 |
24 | | - env: |
25 | | - MYSQL_ALLOW_EMPTY_PASSWORD: no |
26 | | - MYSQL_USER: protone_media_db_test |
27 | | - MYSQL_DATABASE: protone_media_db_test_mysql |
28 | | - MYSQL_PASSWORD: secret |
29 | | - MYSQL_ROOT_PASSWORD: secret |
30 | | - ports: |
31 | | - - 3306 |
32 | | - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
33 | | - postgres: |
34 | | - image: postgres:10.8 |
35 | | - env: |
36 | | - POSTGRES_USER: protone_media_db_test |
37 | | - POSTGRES_PASSWORD: secret |
38 | | - POSTGRES_DB: protone_media_db_test_postgres |
39 | | - ports: |
40 | | - - 5432:5432 |
41 | | - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 27 | + name: P${{ matrix.php }} - L${{ matrix.laravel }} - DB ${{ matrix.db }} - ${{ matrix.dependency-version }} |
42 | 28 |
|
43 | | - steps: |
44 | | - - name: Checkout code |
45 | | - uses: actions/checkout@v2 |
| 29 | + services: |
| 30 | + mysql: |
| 31 | + image: mysql:8.0 |
| 32 | + env: |
| 33 | + MYSQL_ALLOW_EMPTY_PASSWORD: no |
| 34 | + MYSQL_USER: protone_media_db_test |
| 35 | + MYSQL_DATABASE: protone_media_db_test_mysql |
| 36 | + MYSQL_PASSWORD: secret |
| 37 | + MYSQL_ROOT_PASSWORD: secret |
| 38 | + ports: |
| 39 | + - 3306 |
| 40 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 41 | + postgres: |
| 42 | + image: postgres:10.8 |
| 43 | + env: |
| 44 | + POSTGRES_USER: protone_media_db_test |
| 45 | + POSTGRES_PASSWORD: secret |
| 46 | + POSTGRES_DB: protone_media_db_test_postgres |
| 47 | + ports: |
| 48 | + - 5432:5432 |
| 49 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
46 | 50 |
|
47 | | - - name: Cache dependencies |
48 | | - uses: actions/cache@v2 |
49 | | - with: |
50 | | - path: ~/.composer/cache/files |
51 | | - key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} |
| 51 | + steps: |
| 52 | + - name: Checkout code |
| 53 | + uses: actions/checkout@v2 |
52 | 54 |
|
53 | | - - name: Setup PHP |
54 | | - uses: shivammathur/setup-php@v2 |
55 | | - with: |
56 | | - php-version: ${{ matrix.php }} |
57 | | - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, mysql, mysqli, pdo_mysql |
58 | | - coverage: none |
| 55 | + - name: Cache dependencies |
| 56 | + uses: actions/cache@v2 |
| 57 | + with: |
| 58 | + path: ~/.composer/cache/files |
| 59 | + key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} |
59 | 60 |
|
60 | | - - name: Install dependencies |
61 | | - run: | |
62 | | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update |
63 | | - composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest |
| 61 | + - name: Setup PHP |
| 62 | + uses: shivammathur/setup-php@v2 |
| 63 | + with: |
| 64 | + php-version: ${{ matrix.php }} |
| 65 | + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, mysql, mysqli, pdo_mysql |
| 66 | + coverage: none |
64 | 67 |
|
65 | | - - name: Execute tests (MySQL) |
66 | | - run: vendor/bin/phpunit |
67 | | - if: ${{ matrix.db == 'mysql' }} |
68 | | - env: |
69 | | - DB_DATABASE: protone_media_db_test_mysql |
70 | | - DB_USERNAME: protone_media_db_test |
71 | | - DB_PASSWORD: secret |
72 | | - DB_PORT: ${{ job.services.mysql.ports[3306] }} |
| 68 | + - name: Install dependencies |
| 69 | + run: | |
| 70 | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update |
| 71 | + composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest |
73 | 72 |
|
74 | | - - name: Execute tests (PostgreSQL) |
75 | | - run: vendor/bin/phpunit |
76 | | - if: ${{ matrix.db == 'postgres' }} |
77 | | - env: |
78 | | - DB_CONNECTION: pgsql |
79 | | - DB_DATABASE: protone_media_db_test_postgres |
80 | | - DB_USERNAME: protone_media_db_test |
81 | | - DB_PASSWORD: secret |
82 | | - DB_PORT: ${{ job.services.postgres.ports[5432] }} |
| 73 | + - name: Execute tests (MySQL) |
| 74 | + run: vendor/bin/phpunit |
| 75 | + if: "${{ matrix.db == 'mysql' }}" |
| 76 | + env: |
| 77 | + DB_DATABASE: protone_media_db_test_mysql |
| 78 | + DB_USERNAME: protone_media_db_test |
| 79 | + DB_PASSWORD: secret |
| 80 | + DB_PORT: ${{ job.services.mysql.ports[3306] }} |
83 | 81 |
|
84 | | - - name: Execute tests (SQLite) |
85 | | - run: vendor/bin/phpunit |
86 | | - if: ${{ matrix.db == 'sqlite' }} |
87 | | - env: |
88 | | - DB_CONNECTION: sqlite |
89 | | - DB_DATABASE: ":memory:" |
| 82 | + - name: Execute tests (PostgreSQL) |
| 83 | + run: vendor/bin/phpunit |
| 84 | + if: "${{ matrix.db == 'postgres' }}" |
| 85 | + env: |
| 86 | + DB_CONNECTION: pgsql |
| 87 | + DB_DATABASE: protone_media_db_test_postgres |
| 88 | + DB_USERNAME: protone_media_db_test |
| 89 | + DB_PASSWORD: secret |
| 90 | + DB_PORT: ${{ job.services.postgres.ports[5432] }} |
| 91 | + |
| 92 | + - name: Execute tests (SQLite) |
| 93 | + run: vendor/bin/phpunit |
| 94 | + if: "${{ matrix.db == 'sqlite' }}" |
| 95 | + env: |
| 96 | + DB_CONNECTION: sqlite |
| 97 | + DB_DATABASE: ":memory:" |
0 commit comments