From 6d2c77f5720708f4085b69bbf1d6020ef4f330a1 Mon Sep 17 00:00:00 2001 From: KD Date: Thu, 3 Apr 2025 11:51:13 -0400 Subject: [PATCH] Added workflow code for db --- .gitea/workflows/workflow.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index 5992b93..a79714f 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -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