From a71ccb522b4b712413774b60b6652010142c2933 Mon Sep 17 00:00:00 2001 From: Florian Bosdorff Date: Tue, 21 Jan 2020 20:01:07 +0100 Subject: [PATCH] add automated test pipeline --- .env.testing | 6 ++-- .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.env.testing b/.env.testing index 38b5b4884..e88f73461 100644 --- a/.env.testing +++ b/.env.testing @@ -8,11 +8,11 @@ APP_URL=http://192.168.15.195/laravel/bagisto/public LOG_CHANNEL=stack DB_CONNECTION=mysql -DB_HOST=localhost +DB_HOST=mysql DB_PORT=3306 DB_DATABASE=bagisto_testing -DB_USERNAME=root -DB_PASSWORD=webkul +DB_USERNAME=bagisto +DB_PASSWORD=secret BROADCAST_DRIVER=log CACHE_DRIVER=file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..1a0a1b5dd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + +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@v1 + with: + php-version: '7.3' + extensions: intl, curl, mbstring, openssl, pdo, pdo_mysql, tokenizer + + - 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 global require hirak/prestissimo + composer install --no-interaction --ansi --no-progress --no-suggest --optimize-autoloader + + - 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