|
| 1 | +name: Backend build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - '[0-9]+.[0-9]+' |
| 8 | + pull_request: ~ |
| 9 | + |
| 10 | +jobs: |
| 11 | + cs-fix: |
| 12 | + name: Run code style check |
| 13 | + runs-on: "ubuntu-22.04" |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + php: |
| 17 | + - '8.1' |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Setup PHP Action |
| 22 | + uses: shivammathur/setup-php@v2 |
| 23 | + with: |
| 24 | + php-version: ${{ matrix.php }} |
| 25 | + coverage: none |
| 26 | + extensions: 'pdo_sqlite, gd' |
| 27 | + tools: cs2pr |
| 28 | + |
| 29 | + - name: Add composer keys for private packagist |
| 30 | + run: | |
| 31 | + composer config http-basic.updates.ibexa.co $IBEXA_KEY $IBEXA_TOKEN |
| 32 | + composer config github-oauth.github.com $GITHUB_TOKEN |
| 33 | + env: |
| 34 | + IBEXA_KEY: ${{ secrets.IBEXA_KEY }} |
| 35 | + IBEXA_TOKEN: ${{ secrets.IBEXA_TOKEN }} |
| 36 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + |
| 38 | + - uses: ramsey/composer-install@v2 |
| 39 | + with: |
| 40 | + dependency-versions: "highest" |
| 41 | + |
| 42 | + - name: Run code style check |
| 43 | + run: composer run-script check-cs -- --format=checkstyle | cs2pr |
| 44 | + |
| 45 | + deptrac: |
| 46 | + name: Deptrac |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + - name: Deptrac |
| 51 | + uses: smoench/deptrac-action@master |
| 52 | + |
| 53 | + tests: |
| 54 | + name: Tests |
| 55 | + runs-on: "ubuntu-22.04" |
| 56 | + timeout-minutes: 10 |
| 57 | + |
| 58 | + strategy: |
| 59 | + fail-fast: false |
| 60 | + matrix: |
| 61 | + php: |
| 62 | + - '8.2' |
| 63 | + - '8.3' |
| 64 | + |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v4 |
| 67 | + |
| 68 | + - name: Setup PHP Action |
| 69 | + uses: shivammathur/setup-php@v2 |
| 70 | + with: |
| 71 | + php-version: ${{ matrix.php }} |
| 72 | + coverage: none |
| 73 | + extensions: pdo_sqlite, gd |
| 74 | + tools: cs2pr |
| 75 | + |
| 76 | + - name: Add composer keys for private packagist |
| 77 | + run: | |
| 78 | + composer config http-basic.updates.ibexa.co $IBEXA_KEY $IBEXA_TOKEN |
| 79 | + composer config github-oauth.github.com $GITHUB_TOKEN |
| 80 | + env: |
| 81 | + IBEXA_KEY: ${{ secrets.IBEXA_KEY }} |
| 82 | + IBEXA_TOKEN: ${{ secrets.IBEXA_TOKEN }} |
| 83 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + |
| 85 | + - uses: ramsey/composer-install@v2 |
| 86 | + |
| 87 | + - name: Setup problem matchers for PHPUnit |
| 88 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 89 | + |
| 90 | + - name: Run PHPStan analysis |
| 91 | + run: composer run-script phpstan |
| 92 | + |
| 93 | + - name: Run test suite |
| 94 | + run: composer run-script --timeout=600 test |
| 95 | + |
| 96 | + integration-tests-postgres: |
| 97 | + name: PostgreSQL integration tests |
| 98 | + needs: tests |
| 99 | + services: |
| 100 | + postgres: |
| 101 | + image: postgres:14 |
| 102 | + ports: |
| 103 | + - 5432 |
| 104 | + env: |
| 105 | + POSTGRES_PASSWORD: postgres |
| 106 | + POSTGRES_DB: testdb |
| 107 | + options: >- |
| 108 | + --health-cmd pg_isready |
| 109 | + --health-interval 10s |
| 110 | + --health-timeout 5s |
| 111 | + --health-retries 5 |
| 112 | + --tmpfs /var/lib/postgres |
| 113 | + runs-on: "ubuntu-22.04" |
| 114 | + timeout-minutes: 10 |
| 115 | + |
| 116 | + strategy: |
| 117 | + fail-fast: false |
| 118 | + matrix: |
| 119 | + php: |
| 120 | + - '8.2' |
| 121 | + - '8.3' |
| 122 | + |
| 123 | + steps: |
| 124 | + - uses: actions/checkout@v4 |
| 125 | + |
| 126 | + - name: Setup PHP Action |
| 127 | + uses: shivammathur/setup-php@v2 |
| 128 | + with: |
| 129 | + php-version: ${{ matrix.php }} |
| 130 | + coverage: none |
| 131 | + extensions: pdo_pgsql, gd |
| 132 | + tools: cs2pr |
| 133 | + |
| 134 | + - name: Add composer keys for private packagist |
| 135 | + run: | |
| 136 | + composer config http-basic.updates.ibexa.co $IBEXA_KEY $IBEXA_TOKEN |
| 137 | + composer config github-oauth.github.com $GITHUB_TOKEN |
| 138 | + env: |
| 139 | + IBEXA_KEY: ${{ secrets.IBEXA_KEY }} |
| 140 | + IBEXA_TOKEN: ${{ secrets.IBEXA_TOKEN }} |
| 141 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 142 | + |
| 143 | + - uses: ramsey/composer-install@v2 |
| 144 | + with: |
| 145 | + dependency-versions: "highest" |
| 146 | + |
| 147 | + - name: Setup problem matchers for PHPUnit |
| 148 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 149 | + |
| 150 | + - name: Run integration test suite vs Postgresql |
| 151 | + run: composer run-script --timeout=600 test-integration |
| 152 | + env: |
| 153 | + DATABASE_URL: "pgsql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/testdb?server_version=10" |
| 154 | + |
| 155 | + integration-tests-mysql: |
| 156 | + name: MySQL integration tests |
| 157 | + needs: tests |
| 158 | + services: |
| 159 | + mysql: |
| 160 | + image: mysql:8 |
| 161 | + ports: |
| 162 | + - 3306/tcp |
| 163 | + env: |
| 164 | + MYSQL_RANDOM_ROOT_PASSWORD: true |
| 165 | + MYSQL_USER: mysql |
| 166 | + MYSQL_PASSWORD: mysql |
| 167 | + MYSQL_DATABASE: testdb |
| 168 | + options: >- |
| 169 | + --health-cmd="mysqladmin ping" |
| 170 | + --health-interval=10s |
| 171 | + --health-timeout=5s |
| 172 | + --health-retries=5 |
| 173 | + --tmpfs=/var/lib/mysql |
| 174 | + runs-on: "ubuntu-22.04" |
| 175 | + timeout-minutes: 10 |
| 176 | + |
| 177 | + strategy: |
| 178 | + fail-fast: false |
| 179 | + matrix: |
| 180 | + php: |
| 181 | + - '8.2' |
| 182 | + - '8.3' |
| 183 | + |
| 184 | + steps: |
| 185 | + - uses: actions/checkout@v4 |
| 186 | + |
| 187 | + - name: Setup PHP Action |
| 188 | + uses: shivammathur/setup-php@v2 |
| 189 | + with: |
| 190 | + php-version: ${{ matrix.php }} |
| 191 | + coverage: none |
| 192 | + extensions: pdo_mysql, gd, redis |
| 193 | + tools: cs2pr |
| 194 | + |
| 195 | + - name: Add composer keys for private packagist |
| 196 | + run: | |
| 197 | + composer config http-basic.updates.ibexa.co $IBEXA_KEY $IBEXA_TOKEN |
| 198 | + composer config github-oauth.github.com $GITHUB_TOKEN |
| 199 | + env: |
| 200 | + IBEXA_KEY: ${{ secrets.IBEXA_KEY }} |
| 201 | + IBEXA_TOKEN: ${{ secrets.IBEXA_TOKEN }} |
| 202 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 203 | + |
| 204 | + - uses: ramsey/composer-install@v2 |
| 205 | + with: |
| 206 | + dependency-versions: "highest" |
| 207 | + |
| 208 | + - name: Setup problem matchers for PHPUnit |
| 209 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 210 | + |
| 211 | + - name: Run integration test suite vs MySQL |
| 212 | + run: composer run-script --timeout=600 test-integration |
| 213 | + env: |
| 214 | + DATABASE_URL: "mysql://mysql:[email protected]:${{ job.services.mysql.ports[3306] }}/testdb" |
0 commit comments