Added workflow code for db
Some checks failed
Rust Build / Check (pull_request) Successful in 44s
Rust Build / Test Suite (pull_request) Failing after 50s
Rust Build / Rustfmt (pull_request) Successful in 27s
Rust Build / Clippy (pull_request) Successful in 52s
Rust Build / build (pull_request) Successful in 1m14s

This commit is contained in:
KD
2025-04-03 11:51:13 -04:00
parent 7174962d0b
commit 6d2c77f572

View File

@@ -67,7 +67,33 @@ jobs:
echo "Docker environment check complete."
# NOTE: Do NOT use continue-on-error here.
# If Docker isn't working as expected, the job SHOULD fail here.
# --- Optional but Recommended: Database Migrations Step ---
- name: Run Database Migrations
env:
# Define DATABASE_URL using service details and secrets
DATABASE_URL: postgresql://${{ secrets.DB_TEST_USER || 'testuser' }}:${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}@postgres:5432/${{ secrets.DB_TEST_NAME || 'testdb' }}
# Make SSH agent available if migrations fetch private dependencies
SSH_AUTH_SOCK: ${{ env.SSH_AUTH_SOCK }}
run: |
echo "Running database migrations..."
# ===> IMPORTANT: Replace placeholder below with your actual migration command <===
# Example: Install and run sqlx-cli
# cargo install sqlx-cli --no-default-features --features native-tls,postgres
# sqlx database setup --database-url $DATABASE_URL
# Example: Install and run diesel_cli
# cargo install diesel_cli --no-default-features --features postgres
# diesel migration run --database-url $DATABASE_URL
# echo "[Placeholder] Your migration command goes here."
# ===> End of Placeholder <===
- name: Run tests
env:
# Define DATABASE_URL for tests to use
DATABASE_URL: postgresql://${{ secrets.DB_TEST_USER || 'testuser' }}:${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}@postgres:5432/${{ secrets.DB_TEST_NAME || 'testdb' }}
RUST_LOG: info # Optional: configure test log level
# Make SSH agent available if tests fetch private dependencies
SSH_AUTH_SOCK: ${{ env.SSH_AUTH_SOCK }}
run: |
mkdir -p ~/.ssh
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/gitlab_deploy_key