Update test action
All checks were successful
linter / quality (push) Successful in 4m4s
tests / ci (push) Successful in 9m1s

This commit is contained in:
Javier Feliz 2025-08-02 22:48:50 -04:00
parent bd5bb07c6a
commit 92164921a5
2 changed files with 19 additions and 56 deletions

View File

@ -50,5 +50,23 @@ jobs:
- name: Build Assets
run: npm run build
- name: Setup Test RSA Keys
run: |
echo "Setting up test RSA keys..."
mkdir -p storage/testing/oauth
php artisan app:generate-keys --path="storage/testing/oauth"
echo "✅ Test keys generated"
- name: Run Tests
run: ./vendor/bin/pest
run: ./vendor/bin/pest
- name: Cleanup Test Keys
if: always()
run: |
echo "Cleaning up test RSA keys..."
if [ -d "storage/testing" ]; then
rm -rf storage/testing
echo "✅ Test storage directory cleaned up"
else
echo " No test storage directory found to clean up"
fi

View File

@ -1,55 +0,0 @@
#!/bin/bash
# Script to set up test RSA keys for CI/CD environments
# This ensures tests run with proper keys without affecting production keys
set -e
# Define the test key directory
TEST_KEY_DIR="storage/testing/oauth"
# Function to generate test keys
generate_test_keys() {
echo "Setting up test RSA keys..."
# Create test directory if it doesn't exist
mkdir -p "$TEST_KEY_DIR"
# Generate test keys using artisan command
php artisan app:generate-keys --path="$TEST_KEY_DIR"
echo "✅ Test keys generated in $TEST_KEY_DIR"
}
# Function to clean up test keys
cleanup_test_keys() {
echo "Cleaning up test RSA keys..."
if [ -d "$TEST_KEY_DIR" ]; then
rm -rf "$TEST_KEY_DIR"
echo "✅ Test keys cleaned up"
else
echo " No test keys found to clean up"
fi
}
# Main script logic
case "${1:-setup}" in
"setup")
generate_test_keys
;;
"cleanup")
cleanup_test_keys
;;
"reset")
cleanup_test_keys
generate_test_keys
;;
*)
echo "Usage: $0 [setup|cleanup|reset]"
echo " setup - Generate test keys (default)"
echo " cleanup - Remove test keys"
echo " reset - Remove and regenerate test keys"
exit 1
;;
esac