Skip to content

Commit

Permalink
Add solver logic (#152)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
arkanoider authored Nov 27, 2023
1 parent 16bc14e commit d3229cd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
Expand Down
24 changes: 23 additions & 1 deletion init_db.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

10 changes: 10 additions & 0 deletions sqlx-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down

0 comments on commit d3229cd

Please sign in to comment.