Update build process

This commit is contained in:
jude committed 2026-10-11 14:26:15 +01:00
1 parent 644adc3f87
commit 7fcb2eb747
8 files changed
+76 -82

No files matched your search

@@ -1,6 +1,6 @@
{
"db_name": "MySQL",
"query": "\n SELECT id, channel, name, nudge, blacklisted, webhook_id, webhook_token, paused, paused_until\n FROM channels\n WHERE channel = ?\n ",
"query": "\n SELECT id, channel, nudge, webhook_id, webhook_token, paused,\n paused_until\n FROM channels\n WHERE channel = ?\n ",
"describe": {
"columns": [
{
@@ -23,15 +23,6 @@
},
{
"ordinal": 2,
"name": "name",
"type_info": {
"type": "VarString",
"flags": "",
"max_size": 400
}
},
{
"ordinal": 3,
"name": "nudge",
"type_info": {
"type": "Short",
@@ -40,16 +31,7 @@
}
},
{
"ordinal": 4,
"name": "blacklisted",
"type_info": {
"type": "Tiny",
"flags": "NOT_NULL",
"max_size": 1
}
},
{
"ordinal": 5,
"ordinal": 3,
"name": "webhook_id",
"type_info": {
"type": "LongLong",
@@ -58,7 +40,7 @@
}
},
{
"ordinal": 6,
"ordinal": 4,
"name": "webhook_token",
"type_info": {
"type": "Blob",
@@ -67,7 +49,7 @@
}
},
{
"ordinal": 7,
"ordinal": 5,
"name": "paused",
"type_info": {
"type": "Tiny",
@@ -76,7 +58,7 @@
}
},
{
"ordinal": 8,
"ordinal": 6,
"name": "paused_until",
"type_info": {
"type": "Timestamp",
@@ -91,8 +73,6 @@
"nullable": [
false,
false,
true,
false,
false,
true,
true,
@@ -100,5 +80,5 @@
true
]
},
"hash": "4d26e92088234552f9159b876c7fdd3bb557a7f918820e289bd39742de553883"
"hash": "017b3f73101926a3fe029ed75c412ec902aa74fee334c23fd75fe0cde1e324ca"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\n UPDATE channels\n SET\n name = ?,\n nudge = ?,\n blacklisted = ?,\n webhook_id = ?,\n webhook_token = ?,\n paused = ?,\n paused_until = ?\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 8
},
"nullable": []
},
"hash": "1bd6f70d57d5e913f97025cf6fc5be795a1302485ef1c07fe13eb246f184a1d1"
}
@@ -1,6 +1,6 @@
{
"db_name": "MySQL",
"query": "\n SELECT id, channel, name, nudge, blacklisted, webhook_id, webhook_token, paused,\n paused_until\n FROM channels\n WHERE channel = ?\n ",
"query": "\n SELECT id, channel, nudge, webhook_id, webhook_token, paused, paused_until\n FROM channels\n WHERE channel = ?\n ",
"describe": {
"columns": [
{
@@ -23,15 +23,6 @@
},
{
"ordinal": 2,
"name": "name",
"type_info": {
"type": "VarString",
"flags": "",
"max_size": 400
}
},
{
"ordinal": 3,
"name": "nudge",
"type_info": {
"type": "Short",
@@ -40,16 +31,7 @@
}
},
{
"ordinal": 4,
"name": "blacklisted",
"type_info": {
"type": "Tiny",
"flags": "NOT_NULL",
"max_size": 1
}
},
{
"ordinal": 5,
"ordinal": 3,
"name": "webhook_id",
"type_info": {
"type": "LongLong",
@@ -58,7 +40,7 @@
}
},
{
"ordinal": 6,
"ordinal": 4,
"name": "webhook_token",
"type_info": {
"type": "Blob",
@@ -67,7 +49,7 @@
}
},
{
"ordinal": 7,
"ordinal": 5,
"name": "paused",
"type_info": {
"type": "Tiny",
@@ -76,7 +58,7 @@
}
},
{
"ordinal": 8,
"ordinal": 6,
"name": "paused_until",
"type_info": {
"type": "Timestamp",
@@ -91,8 +73,6 @@
"nullable": [
false,
false,
true,
false,
false,
true,
true,
@@ -100,5 +80,5 @@
true
]
},
"hash": "d3e41b7c9df5823c418181f46aa78999159afbd458dcd05ffb9e032182ec493b"
"hash": "21b660ecbeffcac31ef283f59e420360a28b344759407024a11dc4a04da9341d"
}
@@ -0,0 +1,12 @@
{
"db_name": "MySQL",
"query": "INSERT IGNORE INTO channels (channel, guild_id) VALUES (?, (SELECT id FROM guilds WHERE guild = ?))",
"describe": {
"columns": [],
"parameters": {
"Right": 2
},
"nullable": []
},
"hash": "5d7a787e3a6f487c3fe00bd39d308c9350c82e58b0ad1aae0b92824375786f02"
}
@@ -0,0 +1,12 @@
{
"db_name": "MySQL",
"query": "\n UPDATE channels\n SET\n nudge = ?,\n webhook_id = ?,\n webhook_token = ?,\n paused = ?,\n paused_until = ?\n WHERE id = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 6
},
"nullable": []
},
"hash": "af08f3524c316f438feb62a24c67b96197e3655a87efe128914ed386be20d900"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "INSERT IGNORE INTO channels (channel, name, guild_id) VALUES (?, ?, (SELECT id FROM guilds WHERE guild = ?))",
"describe": {
"columns": [],
"parameters": {
"Right": 3
},
"nullable": []
},
"hash": "f8e99a39fb87d47bcdf70f38e00c4dbe4d6832b1b073efddfa79a8cd756d8dc6"
}
+22
View File
@@ -0,0 +1,22 @@
.DEFAULT_GOAL := build
CARGO ?= cargo
PODMAN ?= podman
IMAGE ?= reminder-rs
.PHONY: build prepare test image
# Keep the stages ordered even when make is run with -j.
build: image
$(PODMAN) run --rm -v "$(CURDIR):/mnt" -w /mnt \
-e SQLX_OFFLINE=true "$(IMAGE)" cargo deb
image: test
$(PODMAN) build -t "$(IMAGE)" .
test: prepare
SQLX_OFFLINE=true $(CARGO) test --locked
# Include test-only queries in the metadata used by offline compilation.
prepare:
SQLX_OFFLINE=false $(CARGO) sqlx prepare -- --all-targets --locked
+18 -6
View File
@@ -18,14 +18,26 @@ Recommended method.
By default, this builds targeting Ubuntu 20.04. Modify the Containerfile if you wish to target a
different platform. These instructions are written using `podman`, but `docker` should work too.
1. Install container software: `sudo apt install podman`.
1. Install container software and Make: `sudo apt install podman make`.
2. Install database server: `sudo apt install mysql-server-8.0`. Create a database called
`reminders`
3. Install SQLx CLI: `cargo install sqlx-cli`
4. From the source code directory, execute `sqlx migrate run`
5. Build container image: `podman build -t reminder-rs .`
6. Build with podman:
`podman run --rm --network=host -v "$PWD":/mnt -w /mnt -e "DATABASE_URL=mysql://user@localhost/reminders" reminder-rs cargo deb`
3. Install SQLx CLI matching the project's SQLx version: `cargo install sqlx-cli --version 0.8.2 --locked`.
4. Install the local build requirements (Rust, Node.js/npm, GCC, CMake, pkg-config, and OpenSSL
development headers), then install dashboard dependencies: `npm ci --prefix reminder-dashboard`.
5. Export the URL of your build/test database:
`export DATABASE_URL="mysql://user[:password]@localhost/reminders"`.
6. From the source code directory, execute `sqlx migrate run`.
7. Run `make` (or `make build`). This prepares SQLx query metadata in `.sqlx`, runs the Rust tests,
builds the `reminder-rs` container image, and runs `cargo deb` inside it. The resulting package is
written to `target/debian/`.
Preparation and database-dependent tests use the local database. The container packaging step uses
the prepared `.sqlx` metadata with `SQLX_OFFLINE=true`, so it does not need database access, including
when a `.env` file is present in the mounted source directory.
The stages can also be run separately: `make prepare`, `make test` (includes preparation), and
`make image` (includes preparation and tests). Override `IMAGE` to change the container image tag,
or `PODMAN` to use another container command, for example `make PODMAN=docker`.
### Compiling for other target