2024-06-06 13:21:00 -07:00
|
|
|
name: Tests in Postgres
|
|
|
|
|
2024-06-10 10:24:10 -07:00
|
|
|
on: workflow_dispatch
|
2024-06-06 13:21:00 -07:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
tests:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
services:
|
|
|
|
postgresql:
|
2024-06-06 13:27:39 -07:00
|
|
|
image: postgres
|
2024-06-06 13:21:00 -07:00
|
|
|
env:
|
|
|
|
POSTGRES_DB: snipeit
|
|
|
|
POSTGRES_USER: snipeit
|
|
|
|
POSTGRES_PASSWORD: password
|
|
|
|
ports:
|
|
|
|
- 5432:5432
|
|
|
|
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
php-version:
|
2024-07-08 06:58:26 -07:00
|
|
|
- "8.1"
|
2024-06-06 13:21:00 -07:00
|
|
|
- "8.2"
|
2024-07-08 06:58:26 -07:00
|
|
|
- "8.3"
|
2024-06-06 13:21:00 -07:00
|
|
|
|
|
|
|
name: PHP ${{ matrix.php-version }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: "${{ matrix.php-version }}"
|
|
|
|
coverage: none
|
|
|
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Get Composer Cache Directory
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-composer-
|
|
|
|
|
|
|
|
- name: Copy .env
|
|
|
|
run: |
|
|
|
|
cp -v .env.testing.example .env
|
|
|
|
cp -v .env.testing.example .env.testing
|
|
|
|
|
|
|
|
- name: Install Dependencies
|
|
|
|
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
|
|
|
|
|
|
|
- name: Setup Laravel
|
|
|
|
env:
|
|
|
|
DB_CONNECTION: pgsql
|
|
|
|
DB_DATABASE: snipeit
|
|
|
|
DB_PORT: ${{ job.services.postgresql.ports[5432] }}
|
|
|
|
DB_USERNAME: snipeit
|
|
|
|
DB_PASSWORD: password
|
|
|
|
run: |
|
|
|
|
php artisan key:generate
|
|
|
|
php artisan migrate --force
|
|
|
|
php artisan passport:install
|
|
|
|
chmod -R 777 storage bootstrap/cache
|
|
|
|
|
|
|
|
- name: Execute tests (Unit and Feature tests) via PHPUnit
|
|
|
|
env:
|
|
|
|
DB_CONNECTION: pgsql
|
|
|
|
DB_DATABASE: snipeit
|
|
|
|
DB_PORT: ${{ job.services.postgresql.ports[5432] }}
|
|
|
|
DB_USERNAME: snipeit
|
|
|
|
DB_PASSWORD: password
|
2024-10-17 18:01:48 -07:00
|
|
|
run: php artisan test
|