Skip to content

Commit

Permalink
test: add test.yml
Browse files Browse the repository at this point in the history
test: add test.yml
  • Loading branch information
fahlisaputra authored Mar 1, 2024
2 parents 0c103f5 + b15e639 commit d5ef9a9
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Tests

on:
push:
branches:
- main

jobs:
linux_tests:
runs-on: ubuntu-latest

services:
memcached:
image: memcached:1.6-alpine
ports:
- 11211:11211
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: phenomine
ports:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: true
matrix:
php: [8.1]

name: PHP ${{ matrix.php }}

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, redis-phpredis/[email protected], igbinary, msgpack, lzf, zstd, lz4, memcached, gmp
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: none
env:
REDIS_CONFIGURE_OPTS: --enable-redis --enable-redis-igbinary --enable-redis-msgpack --enable-redis-lzf --with-liblzf --enable-redis-zstd --with-libzstd --enable-redis-lz4 --with-liblz4
REDIS_LIBS: liblz4-dev, liblzf-dev, libzstd-dev

- name: Install Phenomine
run: composer create-project phenomine/phenomine phenomine

- name: Change directory
run: cd phenomine

- name: Copy environment file
run: php -r "file_exists('.env') || copy('.env.example', '.env');"

- name: Install dependencies
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --prefer-dist --no-interaction --no-progress

- name: Change directory permissions
run: chmod -R 777 storage

- name: Running migration
run: php phenomine migrate
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_USERNAME: root

- name: Running seeder
run: php phenomine db:seed
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_USERNAME: root

0 comments on commit d5ef9a9

Please sign in to comment.