Skip to content
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

Add a publishable tests CI workflow #12

Merged
merged 1 commit into from
May 19, 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
60 changes: 60 additions & 0 deletions resources/workflows/auth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: DevDojo Auth Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, xml, ctype, iconv, mysql

- name: Cache Composer Packages
uses: actions/cache@v2
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-git

- name: Install Dependencies
run: composer install --no-progress --prefer-dist

- name: Remove current tests and symlink to DevDojo Auth
run: |
rm -rf tests
ln -s vendor/devdojo/auth/tests tests

- name: Create sqlite file
run: touch database/database.sqlite

- name: List out .env
run: cat .env

- name: Updating values in the .env
run: |
sed -i 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/' .env
sed -i 's/^DB_DATABASE=laravel/#DB_DATABASE=laravel/' .env

- name: Run the migrations
run: php artisan migrate

- name: Run the Auth Migrations
run: php artisan migrate --path=vendor/devdojo/auth/database/migrations

- name: Install PestPHP
run: composer require pestphp/pest --dev --with-all-dependencies

- name: Run Tests
run: ./vendor/bin/pest

5 changes: 5 additions & 0 deletions src/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public function boot()
__DIR__.'/../public' => public_path('auth'),
], 'auth:assets');

// Publishing CI workflows.
$this->publishes([
__DIR__.'/../resources/workflows' => base_path('.github/workflows'),
], 'auth:ci');

// Publishing the translation files.
/*$this->publishes([
__DIR__.'/../resources/lang' => resource_path('lang/vendor/auth'),
Expand Down
Loading