name: CI on: [push, pull_request] jobs: tests: name: Run tests runs-on: ubuntu-latest services: mysql: image: mysql:5.7 env: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: bagisto_testing MYSQL_USER: bagisto MYSQL_PASSWORD: secret ports: - 3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 steps: - name: Checkout uses: actions/checkout@v2 - name: Setup php uses: shivammathur/setup-php@v2 with: php-version: '7.3' extensions: curl, gd, intl, mbstring, openssl, pdo, pdo_mysql, tokenizer, zip - name: Set environment run: | set -e sed -i "s|^\(DB_HOST=\s*\).*$|\1127.0.0.1|" .env.testing sed -i "s|^\(DB_PORT=\s*\).*$|\1${{ job.services.mysql.ports['3306'] }}|" .env.testing printf "the complete .env.testing ...\n\n" cat .env.testing - name: Composer install run: | set -e composer install --no-cache - name: Migrate database run: set -e && php artisan migrate --env=testing - name: Execute unit tests run: set -e && vendor/bin/codecept run unit - name: Execute functional tests run: set -e && vendor/bin/codecept run functional - name: Execute trigger tests run: set -e && vendor/bin/codecept run trigger - name: Persist test artifacts uses: actions/upload-artifact@v1 if: always() with: name: test_artifacts path: tests/_output