diff --git a/.github/workflows/test_migration.yaml b/.github/workflows/test_migration.yml similarity index 93% rename from .github/workflows/test_migration.yaml rename to .github/workflows/test_migration.yml index 6a9572cbb..720cc5915 100644 --- a/.github/workflows/test_migration.yaml +++ b/.github/workflows/test_migration.yml @@ -28,6 +28,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: dtolnay/rust-toolchain@stable with: @@ -58,9 +60,10 @@ jobs: # if: ${{ steps.cache_sqlx.outputs.cache-hit }} run: cargo install sqlx-cli --version=${{ env.SQLX_VERSION }} --features=${{ env.SQLX_FEATURES }} --no-default-features --locked - - - name: Checkout previous commit - run: git checkout HEAD~1 + - name: Checkout main branch + uses: actions/checkout@v4 + with: + ref: main - name: Migrate database run: | diff --git a/scripts/test_migration.sh b/scripts/test_migration.sh index a0629451a..063416691 100755 --- a/scripts/test_migration.sh +++ b/scripts/test_migration.sh @@ -98,9 +98,11 @@ function auditor_main() { SKIP_DOCKER=true ./scripts/init_db.sh ./scripts/init_slurm_collector_sqlite.sh ./scripts/init_client_sqlite.sh + compile_auditor start_auditor_main fill_auditor kill $AUDITOR_SERVER_PID + wait $AUDITOR_SERVER_PID } function auditor_new_migration() { @@ -108,16 +110,20 @@ function auditor_new_migration() { start_auditor_main fill_auditor_new test_collector - kill $AUDITOR_SERVER_PID } -git checkout main +function cleanup_exit() { + if [ -n "$AUDITOR_SERVER_PID" ]; then + echo >&2 "Stopping Auditor due to script exit" + kill $AUDITOR_SERVER_PID + wait $AUDITOR_SERVER_PID + fi +} + +trap "cleanup_function" SIGINT SIGQUIT SIGTERM EXIT auditor_main -git checkout - - auditor_new_migration -trap "cleanup_exit" SIGINT SIGQUIT SIGTERM EXIT