generated from thegrind/laravel-dockerized
Update test action
This commit is contained in:
parent
bd5bb07c6a
commit
92164921a5
20
.github/workflows/tests.yml
vendored
20
.github/workflows/tests.yml
vendored
@ -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
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user