|
| 1 | +name: Commit Pipeline |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +permissions: # added using https://github.com/step-security/secure-repo |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + phpunit: |
| 14 | + runs-on: ubuntu-24.04 |
| 15 | + |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + php-versions: [ '8.4' ] |
| 19 | + |
| 20 | + services: |
| 21 | + postgres: |
| 22 | + image: postgres:latest |
| 23 | + env: |
| 24 | + POSTGRES_USER: postgres |
| 25 | + POSTGRES_PASSWORD: postgres |
| 26 | + POSTGRES_DB: aspirecloud_testing |
| 27 | + ports: |
| 28 | + - 5432/tcp |
| 29 | + options: --health-cmd pg_isready --health-interval 2s --health-timeout 2s --health-retries 10 |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Harden the runner (Audit all outbound calls) |
| 33 | + uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 |
| 34 | + with: |
| 35 | + egress-policy: audit |
| 36 | + |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 39 | + |
| 40 | + - name: Setup PHP |
| 41 | + uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e # v2 |
| 42 | + with: |
| 43 | + php-version: ${{ matrix.php-versions }} |
| 44 | + extensions: mbstring, pgsql |
| 45 | + # not doing coverage in CI yet |
| 46 | + # coverage: xdebug |
| 47 | + |
| 48 | + - name: Get composer cache directory |
| 49 | + id: composer-cache |
| 50 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 51 | + |
| 52 | + - name: Cache composer dependencies |
| 53 | + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 |
| 54 | + with: |
| 55 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 56 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 57 | + restore-keys: ${{ runner.os }}-composer- |
| 58 | + |
| 59 | + - name: Install dependencies |
| 60 | + run: composer install |
| 61 | + |
| 62 | + - name: Prepare tests |
| 63 | + run: | |
| 64 | + cp .env.example .env |
| 65 | + php artisan key:generate |
| 66 | + php artisan migrate |
| 67 | + env: |
| 68 | + CACHE_STORE: array |
| 69 | + DB_HOST: localhost |
| 70 | + DB_PORT: ${{ job.services.postgres.ports[5432] }} |
| 71 | + DB_USERNAME: postgres |
| 72 | + DB_PASSWORD: postgres |
| 73 | + DB_DATABASE: aspirecloud_testing |
| 74 | + |
| 75 | + - name: Run Pest |
| 76 | + run: vendor/bin/pest --ci |
| 77 | + env: |
| 78 | + CACHE_STORE: array |
| 79 | + DB_HOST: localhost |
| 80 | + DB_PORT: ${{ job.services.postgres.ports[5432] }} |
| 81 | + DB_USERNAME: postgres |
| 82 | + DB_PASSWORD: postgres |
| 83 | + DB_DATABASE: aspirecloud_testing |
| 84 | + |
0 commit comments