diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 06ce1eb2..43afbc8b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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: actions@github.com + add: | + - mostro.db --force + - sqlx-data.json --force - name: Run tests run: cargo test --verbose diff --git a/.gitignore b/.gitignore index 16e9fb80..1e1b9fc9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /target .env -mostro.db* mostro.log +mostro.db sqlx-data.json # IDE's diff --git a/mostro.db b/mostro.db new file mode 100644 index 00000000..debbc4b0 Binary files /dev/null and b/mostro.db differ diff --git a/sqlx-data.json b/sqlx-data.json new file mode 100644 index 00000000..ab16f536 --- /dev/null +++ b/sqlx-data.json @@ -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 " + } +} \ No newline at end of file