diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ca8cdec --- /dev/null +++ b/.github/workflows/test.yml @@ -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/phpredis@5.3.7, 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