diff --git a/.github/actions/app-testing/action.yml b/.github/actions/app-testing/action.yml new file mode 100644 index 0000000..91be340 --- /dev/null +++ b/.github/actions/app-testing/action.yml @@ -0,0 +1,42 @@ +name: Laravel Test Action + +description: Run tests with specified group +inputs: + test-group: + description: 'Group about app (Api, ApiAdmin, Console, etc)' + required: true + +runs: + using: 'composite' + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + extensions: mbstring, dom, fileinfo, mysql + coverage: xdebug + + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Copy .env + run: php -r "file_exists('.env') || copy('.env.pipeline', '.env');" + + - name: Install Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + + - name: Copy .env.pipeline + run: \cp -pf .env.pipeline .env + + - name: Generate key + run: php artisan key:generate + + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + + - name: Execute tests + run: vendor/bin/pest --testsuite=Feature --group=${{ inputs.test-group }} --coverage-clover=coverage.xml + env: + DB_PORT: ${{ job.services.mysql.ports['3306'] }} + REDIS_PORT: ${{ job.services.redis.ports['6379'] }} diff --git a/.github/workflows/default-api-admin-testing.yml b/.github/workflows/default-api-admin-testing.yml index a56d326..dfbc407 100644 --- a/.github/workflows/default-api-admin-testing.yml +++ b/.github/workflows/default-api-admin-testing.yml @@ -40,32 +40,9 @@ jobs: options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - extensions: mbstring, dom, fileinfo, mysql - coverage: xdebug + - uses: actions/checkout@v2 - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Copy .env - run: php -r "file_exists('.env') || copy('.env.pipeline', '.env');" - - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - - name: Copy .env.pipeline - run: \cp -pf .env.pipeline .env - - - name: Generate key - run: php artisan key:generate - - - name: Directory Permissions - run: chmod -R 777 storage bootstrap/cache - - - name: Execute tests - run: vendor/bin/pest --testsuite=Feature --group=ApiAdmin --coverage-clover=coverage.xml - env: - DB_PORT: ${{ job.services.mysql.ports['3306'] }} - REDIS_PORT: ${{ job.services.redis.ports['6379'] }} + - name: Execute tests + uses: actions/app-testing + with: + test-group: 'ApiAdmin' diff --git a/.github/workflows/default-api-analytics-testing.yml b/.github/workflows/default-api-analytics-testing.yml index ab31138..4243e13 100644 --- a/.github/workflows/default-api-analytics-testing.yml +++ b/.github/workflows/default-api-analytics-testing.yml @@ -40,32 +40,9 @@ jobs: options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - extensions: mbstring, dom, fileinfo, mysql - coverage: xdebug + - uses: actions/checkout@v2 - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Copy .env - run: php -r "file_exists('.env') || copy('.env.pipeline', '.env');" - - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - - name: Copy .env.pipeline - run: \cp -pf .env.pipeline .env - - - name: Generate key - run: php artisan key:generate - - - name: Directory Permissions - run: chmod -R 777 storage bootstrap/cache - - - name: Execute tests - run: vendor/bin/pest --testsuite=Feature --group=ApiAnalytics --coverage-clover=coverage.xml - env: - DB_PORT: ${{ job.services.mysql.ports['3306'] }} - REDIS_PORT: ${{ job.services.redis.ports['6379'] }} + - name: Execute tests + uses: actions/app-testing@v1 + with: + test-group: 'ApiAnalytics' diff --git a/.github/workflows/default-api-testing.yml b/.github/workflows/default-api-testing.yml index 9579a16..98a51ea 100644 --- a/.github/workflows/default-api-testing.yml +++ b/.github/workflows/default-api-testing.yml @@ -40,32 +40,9 @@ jobs: options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - extensions: mbstring, dom, fileinfo, mysql - coverage: xdebug + - uses: actions/checkout@2 - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Copy .env - run: php -r "file_exists('.env') || copy('.env.pipeline', '.env');" - - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - - name: Copy .env.pipeline - run: \cp -pf .env.pipeline .env - - - name: Generate key - run: php artisan key:generate - - - name: Directory Permissions - run: chmod -R 777 storage bootstrap/cache - - - name: Execute tests - run: vendor/bin/pest --testsuite=Feature --group=Api --coverage-clover=coverage.xml - env: - DB_PORT: ${{ job.services.mysql.ports['3306'] }} - REDIS_PORT: ${{ job.services.redis.ports['6379'] }} + - name: Execute tests + uses: actions/app-testing@v1 + with: + test-group: 'Api' diff --git a/.github/workflows/default-console-testing.yml b/.github/workflows/default-console-testing.yml index 9c0d43a..36b870c 100644 --- a/.github/workflows/default-console-testing.yml +++ b/.github/workflows/default-console-testing.yml @@ -40,32 +40,10 @@ jobs: options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - extensions: mbstring, dom, fileinfo, mysql - coverage: xdebug + - uses: actions/checkout@v2 - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Copy .env - run: php -r "file_exists('.env') || copy('.env.pipeline', '.env');" + - name: Execute tests + uses: /.github/actions/app-testing + with: + test-group: 'Console' - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - - name: Copy .env.pipeline - run: \cp -pf .env.pipeline .env - - - name: Generate key - run: php artisan key:generate - - - name: Directory Permissions - run: chmod -R 777 storage bootstrap/cache - - - name: Execute tests - run: vendor/bin/pest --testsuite=Feature --group=Console --coverage-clover=coverage.xml - env: - DB_PORT: ${{ job.services.mysql.ports['3306'] }} - REDIS_PORT: ${{ job.services.redis.ports['6379'] }} diff --git a/.github/workflows/default-external-api-testing.yml b/.github/workflows/default-external-api-testing.yml index ba6ecf8..aa32645 100644 --- a/.github/workflows/default-external-api-testing.yml +++ b/.github/workflows/default-external-api-testing.yml @@ -40,32 +40,9 @@ jobs: options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - extensions: mbstring, dom, fileinfo, mysql - coverage: xdebug + - uses: actions/checkout@v2 - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Copy .env - run: php -r "file_exists('.env') || copy('.env.pipeline', '.env');" - - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - - name: Copy .env.pipeline - run: \cp -pf .env.pipeline .env - - - name: Generate key - run: php artisan key:generate - - - name: Directory Permissions - run: chmod -R 777 storage bootstrap/cache - - - name: Execute tests - run: vendor/bin/pest --testsuite=Feature --group=ExternalApi --coverage-clover=coverage.xml - env: - DB_PORT: ${{ job.services.mysql.ports['3306'] }} - REDIS_PORT: ${{ job.services.redis.ports['6379'] }} + - name: Execute tests + uses: .github/actions/app-testing + with: + test-group: 'ExternalApi' diff --git a/.github/workflows/default-web-testing.yml b/.github/workflows/default-web-testing.yml index 089967d..60cd085 100644 --- a/.github/workflows/default-web-testing.yml +++ b/.github/workflows/default-web-testing.yml @@ -40,32 +40,12 @@ jobs: options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - extensions: mbstring, dom, fileinfo, mysql - coverage: xdebug + - uses: actions/checkout@v2 + with: + fetch-depth: 0 - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Copy .env - run: php -r "file_exists('.env') || copy('.env.pipeline', '.env');" + - name: Execute tests + uses: ./.github/actions/app-testing + with: + test-group: 'Web' - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - - name: Copy .env.pipeline - run: \cp -pf .env.pipeline .env - - - name: Generate key - run: php artisan key:generate - - - name: Directory Permissions - run: chmod -R 777 storage bootstrap/cache - - - name: Execute tests - run: vendor/bin/pest --testsuite=Feature --group=Web --coverage-clover=coverage.xml - env: - DB_PORT: ${{ job.services.mysql.ports['3306'] }} - REDIS_PORT: ${{ job.services.redis.ports['6379'] }}