This repository has been archived by the owner on Dec 3, 2023. It is now read-only.
Add Stripe environment variables #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests Pipeline | |
on: [push, pull_request] | |
env: | |
PHPUNIT_FLAGS: "--filter=Api --stop-on-failure" | |
jobs: | |
laravel: | |
name: Tests Pipeline (PHP ${{ matrix.php-versions }}) | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: 'secret' | |
MYSQL_DATABASE: 'payments_app' | |
MYSQL_USER: 'user' | |
MYSQL_PASSWORD: 'secret' | |
ports: | |
- 3306/tcp | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: ['8.2'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, dom, fileinfo, mysql | |
coverage: none | |
- name: Start mysql service | |
run: sudo /etc/init.d/mysql start | |
- name: Get composer cache directory | |
id: composercache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
# Use composer.json for key, if composer.lock is not committed. | |
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install Composer dependencies | |
run: composer install -q --no-progress --prefer-dist --optimize-autoloader | |
- name: Prepare Environment | |
run: | | |
cp .env.staging .env | |
sed -i "s/3306/${{ job.services.mysql.ports['3306'] }}/g" .env | |
sed -i "s/DB_PASSWORD=/DB_PASSWORD=secret/g" .env | |
- name: Clear config cache | |
run: php artisan config:clear | |
- name: Generate key | |
run: php artisan key:generate -q -n | |
- name: Migrate & Seed Database | |
run: php artisan migrate --seed --force | |
- name: Change Directory Permissions | |
run: chmod -R 777 storage bootstrap/cache | |
- name: Install javascript packages | |
run: npm install --quiet --no-progress | |
- name: Build javascript packages | |
run: npm run build | |
- name: Run Laravel Server | |
run: php artisan serve --port=3000 --no-reload & | |
- name: curl to localhost | |
run: curl localhost:3000 & | |
- name: Run Feature Tests | |
run: php artisan test ${{ env.PHPUNIT_FLAGS }} |