From d3229cd203f3eba726554aea4414f07d1416fa52 Mon Sep 17 00:00:00 2001 From: arkanoider <113362043+arkanoider@users.noreply.github.com> Date: Mon, 27 Nov 2023 13:56:56 +0100 Subject: [PATCH] Add solver logic (#152) * Test for workaround of offline sqlx json file for github tests * Test for workaround of offline sqlx json file for github tests part 2 * small cosmetic improvement to script --- .github/workflows/rust.yml | 1 + init_db.sh | 24 +++++++++++++++++++++++- sqlx-data.json | 10 ++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a75e5d5c..74b26d58 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -5,6 +5,7 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + workflow_dispatch: env: CARGO_TERM_COLOR: always diff --git a/init_db.sh b/init_db.sh index bb2d2dcc..6c5a2f6c 100755 --- a/init_db.sh +++ b/init_db.sh @@ -1,4 +1,15 @@ #!/bin/sh +echo "Clean project" +if ls Cargo.lock 1> /dev/null 2>&1; then + echo "Deleting Cargo.lock" + rm -rf ./Cargo.lock +fi +if ls sqlx-data.json 1> /dev/null 2>&1; then + echo "Deleting old sqlx-data.json" + rm -rf ./sqlx-data.json +fi + +cargo clean echo "Reading database URL from settings.toml..." DATABASE_URL=$(awk -F'"' '/url *= */ {print $2}' settings.tpl.toml) export DATABASE_URL @@ -13,4 +24,15 @@ echo "Creating new database..." sqlx database create echo "Running migrations..." sqlx migrate run -echo "Done!" +echo "Preparing offline file for CI on github!" +cargo sqlx prepare +echo "Check json db file is ok!" +if cargo sqlx prepare --check +then + echo "Success: sqlx-json is correct" + exit 0 +else + echo "Failure: sqlx-json has issues" >&2 + exit 1 +fi + diff --git a/sqlx-data.json b/sqlx-data.json index 6e7fd083..1bc1b0f6 100644 --- a/sqlx-data.json +++ b/sqlx-data.json @@ -10,6 +10,16 @@ }, "query": "\n UPDATE orders\n SET\n master_seller_pubkey = ?1\n WHERE id = ?2\n " }, + "17bd2b3471aa2ecf65bc3d23f768093d30ca1f8f51101f6443f36b3da45e225a": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Right": 2 + } + }, + "query": "\n UPDATE disputes\n SET\n status = ?1\n WHERE id = ?2\n " + }, "301fbda63c61bf75d60bc330d5b1aacae80248c253a2fe9e97f5a74a7acafe75": { "describe": { "columns": [],