Skip to content

Commit

Permalink
testing new db approach on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
arkanoider committed Dec 16, 2024
1 parent f63ff3c commit dc4b295
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 5 deletions.
43 changes: 39 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,56 @@ jobs:
tests:
runs-on: ubuntu-latest

permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write


steps:
- name: Install Protoc
uses: arduino/setup-protoc@v3

- name: Select branch PR
if: ${{ github.ref != 'refs/heads/main' }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Select branch main
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/checkout@v4
with:
ref: main

- uses: actions/checkout@v3
- name: Install sqlx
run: cargo install sqlx-cli --version 0.6.2
- name: Init DB
run: sqlx database create
run: |
sqlx database create || exit 1
# Verify database creation
test -f "./mostro.db" || { echo "Database file not created"; exit 1; }
- name: Run migrations
run: sqlx migrate run
run: |
sqlx migrate run || exit 1
# Verify migrations
sqlx migrate info || exit 1
- name: Prepare offline file
run: cargo sqlx prepare
- name: Check offline file
run: cargo prepare --check
run: cargo sqlx prepare --check

- name: Commit mostro.db and sqlx-data.json
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: 'chore(db): Update mostro.db and sqlx-data.json [skip ci]'
committer_name: GitHub Actions
committer_email: [email protected]
add: |
- mostro.db --force
- sqlx-data.json --force
- name: Run tests
run: cargo test --verbose
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/target
.env
mostro.db*
mostro.log
mostro.db
sqlx-data.json

# IDE's
Expand Down
Binary file added mostro.db
Binary file not shown.
73 changes: 73 additions & 0 deletions sqlx-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"db": "SQLite",
"0000b9b802fb5639a06762bf8c041dd0a942d54b503c801e2f1d1cb788789a44": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Right": 2
}
},
"query": "\n UPDATE orders\n SET\n master_seller_pubkey = ?1\n WHERE id = ?2\n "
},
"77ea98f6af16fa6e5a7d604965593700c563f88d88cb10b348bdc4200c87ad1d": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Right": 2
}
},
"query": "\n UPDATE orders\n SET\n buyer_pubkey = ?1\n WHERE id = ?2\n "
},
"97414183485e04346f420960beed77912ebe76089f58d30f0f526e232ce4be25": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Right": 8
}
},
"query": "\n UPDATE orders\n SET\n status = ?1,\n amount = ?2,\n fee = ?3,\n hash = ?4,\n preimage = ?5,\n taken_at = ?6,\n invoice_held_at = ?7\n WHERE id = ?8\n "
},
"b047209f67b1c1fad80c1d812c0ad0fa4116d16175fa2569962cd13c0ca05ac3": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Right": 2
}
},
"query": "\n UPDATE orders\n SET\n invoice_held_at = ?1\n WHERE id = ?2\n "
},
"bc86a8ab2ce2b27ca5d1dde6b5622c7f00ee761fe5b475bda0e9145093fc2810": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Right": 2
}
},
"query": "\n UPDATE orders\n SET\n taken_at = ?1\n WHERE id = ?2\n "
},
"c5bc1af1d462bfdbda706928ee4f8c6ea73fed4d84154f3f7975f96aa515ef3b": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Right": 2
}
},
"query": "\n UPDATE orders\n SET\n master_buyer_pubkey = ?1\n WHERE id = ?2\n "
},
"da72f298a426b1c65f7c67bf44436ba0b0878e52694cbd4cbca8585afcc665df": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Right": 2
}
},
"query": "\n UPDATE orders\n SET\n seller_pubkey = ?1\n WHERE id = ?2\n "
}
}

0 comments on commit dc4b295

Please sign in to comment.