Skip to content

chore: Add lint, test & related workflow #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
APP_NAME=Laravel
APP_NAME=Trakli
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_URL=http://localhost:8000

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
DB_DATABASE=trakli
DB_USERNAME=trakli
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
Expand All @@ -34,7 +34,7 @@ MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_ADDRESS="hello@trakli.io"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Checks

on:
push:
branches:
- main
- 'feature/*'
pull_request:
branches:
- main

jobs:
lint:
name: Lint with Pint
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction

- name: Run Pint
run: vendor/bin/pint

test:
name: Run Tests
runs-on: ubuntu-latest

services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: trakli
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=3

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction

- name: Copy .env file
run: cp .env.example .env
- name: Update .env file
run: |
sed -i 's/DB_HOST=mysql/DB_HOST=127.0.0.1/' .env
sed -i 's/DB_PORT=3306/DB_PORT=3306/' .env
sed -i 's/DB_DATABASE=trakli/DB_DATABASE=trakli/' .env
sed -i 's/DB_USERNAME=trakli/DB_USERNAME=root/' .env

- name: Generate application key
run: php artisan key:generate

- name: Configure database
run: |
php artisan config:clear
php artisan config:cache

- name: Run migrations
run: php artisan migrate --seed

- name: Run tests
run: php artisan test
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/pint": "^1.16",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ services:
command: bash -c "
apt update -y
&& apt install git -y
&& tail -f /dev/null
"
&& tail -f /dev/null"
tty: true
environment:
DISABLE_AUTORUN_COMPOSER_INSTALL: 1
MAINTAINER: 'folks@whilesmart.com'
APP_USER: 'folks'
MAINTAINER: 'trakli@whilesmart.com'
APP_USER: 'trakli'
volumes:
- '.:/var/www/html'
- '~/.ssh:/root/.ssh:ro'
networks:
- sail
depends_on:
- mysql

mysql:
image: 'mysql:8.0'
ports:
Expand Down
Loading