chore: switch to mise for tooling & update crates for publishing (#494)

This commit is contained in:
Paul Makles
2026-01-21 23:41:58 +00:00
committed by GitHub
parent 50835f08c8
commit 2846f09c45
36 changed files with 213 additions and 97 deletions

View File

@@ -14,16 +14,10 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
package_json_file: ./docs/package.json
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm
cache-dependency-path: ./docs/pnpm-lock.yaml
- name: Install dependencies - name: Setup Mise
run: pnpm install uses: immich-app/devtools/actions/use-mise@cd24790a7f5f6439ac32cc94f5523cb2de8bfa8c # use-mise-action-v1.1.0
- name: Test build website with:
run: pnpm run build github-token: ${{ secrets.GITHUB_TOKEN }}
- run: mise docs:build

View File

@@ -16,19 +16,13 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
package_json_file: ./docs/package.json
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm
cache-dependency-path: ./docs/pnpm-lock.yaml
- name: Install dependencies - name: Setup Mise
run: pnpm install uses: immich-app/devtools/actions/use-mise@cd24790a7f5f6439ac32cc94f5523cb2de8bfa8c # use-mise-action-v1.1.0
- name: Build website with:
run: pnpm run build github-token: ${{ secrets.GITHUB_TOKEN }}
- run: mise docs:build
- name: Upload Build Artifact - name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v3

View File

@@ -15,7 +15,10 @@ jobs:
with: with:
persist-credentials: false persist-credentials: false
- name: Publish crates - name: Setup Mise
uses: katyo/publish-crates@02cc2f1ad653fb25c7d1ff9eb590a8a50d06186b # v2 uses: immich-app/devtools/actions/use-mise@cd24790a7f5f6439ac32cc94f5523cb2de8bfa8c # use-mise-action-v1.1.0
with: with:
registry-token: ${{ secrets.CRATES_IO_PUBLISH_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish
run: mise publish --workspace

View File

@@ -26,43 +26,33 @@ jobs:
# run: | # run: |
# sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc # sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc
- name: Install latest stable - name: Setup Mise
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1 uses: immich-app/devtools/actions/use-mise@cd24790a7f5f6439ac32cc94f5523cb2de8bfa8c # use-mise-action-v1.1.0
with: with:
toolchain: stable github-token: ${{ secrets.GITHUB_TOKEN }}
components: rustfmt, clippy
- name: Install cargo-nextest - run: mise build
uses: taiki-e/install-action@a58ae9526b2c3acee9ad8e1926b950b7863305d4 # 2.65.16 - run: mise docker:start
with:
tool: cargo-nextest@0.9.119
- name: Run cargo build - name: Reference Test
run: cargo build
- name: Run services in background
run: |
docker compose -f compose.yml up -d
- name: Run cargo test
env: env:
TEST_DB: REFERENCE TEST_DB: REFERENCE
run: | run: |
cargo nextest run mise test
- name: Run cargo test (with MongoDB) - name: MongoDB Test
env: env:
TEST_DB: MONGODB TEST_DB: MONGODB
MONGODB: mongodb://localhost MONGODB: mongodb://localhost
run: | run: |
cargo nextest run mise test
- name: Start API in background - name: Start API in background
if: github.event_name != 'pull_request' && github.ref_name == 'main' if: github.event_name != 'pull_request' && github.ref_name == 'main'
env: env:
TEST_DB: REFERENCE TEST_DB: REFERENCE
run: | run: |
cargo build --bin revolt-delta && (cargo run --bin revolt-delta &) mise build --bin revolt-delta && (mise service:api &)
- name: Wait for API to go up - name: Wait for API to go up
if: github.event_name != 'pull_request' && github.ref_name == 'main' if: github.event_name != 'pull_request' && github.ref_name == 'main'

17
.mise/config.toml Normal file
View File

@@ -0,0 +1,17 @@
[tools]
node = "25.4.0"
pnpm = "10.28.1"
gh = "2.25.0"
rust = "1.92.0"
"cargo:cargo-nextest" = "0.9.122"
[settings]
experimental = true
idiomatic_version_file_enable_tools = ["rust"]
[tasks.start]
description = "Run all services"
depends = ["docker:start", "build"]
run = [{ task = "service:*" }]

5
.mise/tasks/build Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Build project"
set -e
cargo build "$@"

5
.mise/tasks/check Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Check project with clippy"
set -e
cargo clippy

5
.mise/tasks/docker/start Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Start Docker containers"
set -e
docker compose up -d

5
.mise/tasks/docker/stop Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Stop Docker containers"
set -e
docker compose down

7
.mise/tasks/docs/_default Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
#MISE description="Start the Stoat Developers website"
#MISE depends=["docs:install"]
#MISE dir="{{config_root}}/docs"
set -e
pnpm build

7
.mise/tasks/docs/build Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
#MISE description="Build the Stoat Developers website"
#MISE depends=["docs:install"]
#MISE dir="{{config_root}}/docs"
set -e
pnpm build

6
.mise/tasks/docs/install Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
#MISE description="Install dependencies for docs site"
#MISE dir="{{config_root}}/docs"
set -e
pnpm i --frozen-lockfile

5
.mise/tasks/publish Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Publish project"
set -e
cargo publish "$@"

5
.mise/tasks/service/api Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run API server"
set -e
cargo run --bin revolt-delta

5
.mise/tasks/service/crond Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run cron daemon"
set -e
cargo run --bin revolt-crond

5
.mise/tasks/service/events Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run events server"
set -e
cargo run --bin revolt-bonfire

5
.mise/tasks/service/files Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run file server"
set -e
cargo run --bin revolt-autumn

5
.mise/tasks/service/gifbox Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run GIF proxy server"
set -e
cargo run --bin revolt-gifbox

5
.mise/tasks/service/proxy Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run proxy server"
set -e
cargo run --bin revolt-january

5
.mise/tasks/service/pushd Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run push daemon"
set -e
cargo run --bin revolt-pushd

5
.mise/tasks/test Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Test project"
set -e
cargo nextest run

View File

@@ -43,13 +43,13 @@ Before contributing, make yourself familiar with [our contribution guidelines](h
Before getting started, you'll want to install: Before getting started, you'll want to install:
- Rust toolchain (rustup recommended) - mise
- Docker - Docker
- Git - Git
- mold (optional, faster compilation) - mold (optional, faster compilation)
> A **default.nix** is available for Nix users! > A **default.nix** is available for Nix users!
> Just run `nix-shell` and continue. > Run `nix-shell` to activate mise.
As a heads-up, the development environment uses the following ports: As a heads-up, the development environment uses the following ports:
@@ -72,7 +72,7 @@ Now you can clone and build the project:
```bash ```bash
git clone https://github.com/revoltchat/backend revolt-backend git clone https://github.com/revoltchat/backend revolt-backend
cd revolt-backend cd revolt-backend
cargo build mise build
``` ```
A default configuration `Revolt.toml` is present in this project that is suited for development. A default configuration `Revolt.toml` is present in this project that is suited for development.

View File

@@ -12,6 +12,10 @@ services:
- "27017:27017" - "27017:27017"
volumes: volumes:
- ./.data/db:/data/db - ./.data/db:/data/db
ulimits:
nofile:
soft: 65536
hard: 65536
# MinIO # MinIO
minio: minio:

View File

@@ -5,6 +5,7 @@ edition = "2021"
license = "MIT" license = "MIT"
authors = ["Paul Makles <me@insrt.uk>", "Zomatree <me@zomatree.live>"] authors = ["Paul Makles <me@insrt.uk>", "Zomatree <me@zomatree.live>"]
description = "Revolt Backend: Coalescion service" description = "Revolt Backend: Coalescion service"
repository = "https://github.com/stoatchat/stoatchat"
[features] [features]
tokio = ["dep:tokio"] tokio = ["dep:tokio"]
@@ -19,4 +20,9 @@ indexmap = { version = "2.13.0", optional = true }
lru = { version = "0.16.3", optional = true } lru = { version = "0.16.3", optional = true }
[dev-dependencies] [dev-dependencies]
tokio = { version = "1.47.0", features = ["rt", "rt-multi-thread", "macros", "time"] } tokio = { version = "1.47.0", features = [
"rt",
"rt-multi-thread",
"macros",
"time",
] }

View File

@@ -5,6 +5,7 @@ edition = "2021"
license = "MIT" license = "MIT"
authors = ["Paul Makles <me@insrt.uk>"] authors = ["Paul Makles <me@insrt.uk>"]
description = "Revolt Backend: Configuration" description = "Revolt Backend: Configuration"
repository = "https://github.com/stoatchat/stoatchat"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -5,6 +5,7 @@ edition = "2021"
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
authors = ["Paul Makles <me@insrt.uk>"] authors = ["Paul Makles <me@insrt.uk>"]
description = "Revolt Backend: Database Implementation" description = "Revolt Backend: Database Implementation"
repository = "https://github.com/stoatchat/stoatchat"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -15,8 +16,14 @@ mongodb = ["dep:mongodb", "bson", "authifier/database-mongodb"]
# ... Other # ... Other
tasks = ["isahc", "linkify", "url-escape"] tasks = ["isahc", "linkify", "url-escape"]
async-std-runtime = ["async-std", "authifier/async-std-runtime"] async-std-runtime = ["async-std", "authifier/async-std-runtime"]
rocket-impl = ["rocket", "schemars", "revolt_okapi", "revolt_rocket_okapi", "authifier/rocket_impl"] rocket-impl = [
axum-impl = ["axum"] "rocket",
"schemars",
"revolt_okapi",
"revolt_rocket_okapi",
"authifier/rocket_impl",
]
axum-impl = ["axum", "revolt-result/axum"]
redis-is-patched = ["revolt-presence/redis-is-patched"] redis-is-patched = ["revolt-presence/redis-is-patched"]
voice = ["livekit-api", "livekit-protocol", "livekit-runtime"] voice = ["livekit-api", "livekit-protocol", "livekit-runtime"]
@@ -99,6 +106,6 @@ authifier = { version = "1.0.15" }
amqprs = { version = "1.7.0" } amqprs = { version = "1.7.0" }
# Voice # Voice
livekit-api = { version = "0.4.4", optional = true} livekit-api = { version = "0.4.4", optional = true }
livekit-protocol = { version = "0.4.0", optional = true } livekit-protocol = { version = "0.4.0", optional = true }
livekit-runtime = { version = "0.3.1", features = ["tokio"], optional = true } livekit-runtime = { version = "0.3.1", features = ["tokio"], optional = true }

View File

@@ -5,6 +5,7 @@ edition = "2021"
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
authors = ["Paul Makles <me@insrt.uk>"] authors = ["Paul Makles <me@insrt.uk>"]
description = "Revolt Backend: S3 and encryption subroutines" description = "Revolt Backend: S3 and encryption subroutines"
repository = "https://github.com/stoatchat/stoatchat"
[dependencies] [dependencies]
tracing = "0.1" tracing = "0.1"

View File

@@ -5,6 +5,7 @@ edition = "2021"
license = "MIT" license = "MIT"
authors = ["Paul Makles <me@insrt.uk>"] authors = ["Paul Makles <me@insrt.uk>"]
description = "Revolt Backend: API Models" description = "Revolt Backend: API Models"
repository = "https://github.com/stoatchat/stoatchat"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -5,6 +5,7 @@ edition = "2021"
license = "MIT" license = "MIT"
authors = ["Zomatree <me@zomatree.live>", "Paul Makles <me@insrt.uk>"] authors = ["Zomatree <me@zomatree.live>", "Paul Makles <me@insrt.uk>"]
description = "Revolt Backend: Message Parser" description = "Revolt Backend: Message Parser"
repository = "https://github.com/stoatchat/stoatchat"
[dependencies] [dependencies]
logos = { version = "0.15" } logos = { version = "0.15" }

View File

@@ -5,6 +5,7 @@ edition = "2021"
license = "MIT" license = "MIT"
authors = ["Paul Makles <me@insrt.uk>"] authors = ["Paul Makles <me@insrt.uk>"]
description = "Revolt Backend: Permission Logic" description = "Revolt Backend: Permission Logic"
repository = "https://github.com/stoatchat/stoatchat"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -5,6 +5,7 @@ edition = "2021"
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
authors = ["Paul Makles <me@insrt.uk>"] authors = ["Paul Makles <me@insrt.uk>"]
description = "Revolt Backend: User Presence" description = "Revolt Backend: User Presence"
repository = "https://github.com/stoatchat/stoatchat"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,15 +2,23 @@
name = "revolt-ratelimits" name = "revolt-ratelimits"
version = "0.9.4" version = "0.9.4"
edition = "2024" edition = "2024"
license = "MIT"
authors = ["Zomatree <me@zomatree.live>", "Paul Makles <me@insrt.uk>"]
description = "Revolt Backend: Ratelimit Handler"
repository = "https://github.com/stoatchat/stoatchat"
[features] [features]
rocket = ["dep:rocket", "dep:revolt_rocket_okapi", "revolt-database/rocket-impl"] rocket = [
"dep:rocket",
"dep:revolt_rocket_okapi",
"revolt-database/rocket-impl",
]
axum = ["dep:axum", "revolt-database/axum-impl"] axum = ["dep:axum", "revolt-database/axum-impl"]
default = ["rocket", "axum"] default = ["rocket", "axum"]
[dependencies] [dependencies]
revolt-database = { version = "0.9.4", path = "../database"} revolt-database = { version = "0.9.4", path = "../database" }
revolt-result = { version = "0.9.4", path = "../result" } revolt-result = { version = "0.9.4", path = "../result" }
revolt-config = { version = "0.9.4", path = "../config" } revolt-config = { version = "0.9.4", path = "../config" }

View File

@@ -5,6 +5,7 @@ edition = "2021"
license = "MIT" license = "MIT"
authors = ["Paul Makles <me@insrt.uk>"] authors = ["Paul Makles <me@insrt.uk>"]
description = "Revolt Backend: Result and Error types" description = "Revolt Backend: Result and Error types"
repository = "https://github.com/stoatchat/stoatchat"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -1,4 +1,7 @@
use revolt_database::{util::{permissions::DatabasePermissionQuery, reference::Reference}, Channel, Database, FieldsMessage, PartialMessage, SystemMessage, User, AMQP}; use revolt_database::{
util::{permissions::DatabasePermissionQuery, reference::Reference},
Channel, Database, FieldsMessage, PartialMessage, SystemMessage, User, AMQP,
};
use revolt_models::v0::MessageAuthor; use revolt_models::v0::MessageAuthor;
use revolt_permissions::{calculate_channel_permissions, ChannelPermission}; use revolt_permissions::{calculate_channel_permissions, ChannelPermission};
use revolt_result::{create_error, Result}; use revolt_result::{create_error, Result};

View File

@@ -1,28 +1,41 @@
{ { pkgs ? import (fetchTarball {
pkgs ? import <nixpkgs> { }, url = "https://github.com/NixOS/nixpkgs/archive/77ef7a29d276c6d8303aece3444d61118ef71ac2.tar.gz";
sha256 = "0pm4l48jq8plzrrrisimahxqlcpx7qqq9c99hylmf7p3zlc3phsy";
}) {},
}: }:
pkgs.mkShell rec { let
buildInputs = [ nix-ld-libs = pkgs.buildEnv {
# Tools name = "nix-ld-libs";
pkgs.git paths = with pkgs; [
pkgs.just stdenv.cc.cc.lib
zlib
openssl.out
];
pathsToLink = [ "/lib" ];
};
# Cargo in pkgs.mkShell {
pkgs.cargo packages = with pkgs; [
pkgs.cargo-nextest mise
pkgs.cargo-release cargo-binstall
(writeShellScriptBin "fish" ''
# Rust exec ${pkgs.fish}/bin/fish -C 'mise activate fish | source' "$@"
pkgs.rustc '')
pkgs.clippy
pkgs.rustfmt
pkgs.pkg-config
pkgs.openssl.dev
# mdbook
pkgs.mdbook
]; ];
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; buildInputs = with pkgs; [
pkg-config
openssl.dev
];
shellHook = ''
export TMPDIR=/tmp
export NIX_LD="${pkgs.stdenv.cc.libc}/lib/ld-linux-x86-64.so.2"
export NIX_LD_LIBRARY_PATH="${nix-ld-libs}/lib"
export LD_LIBRARY_PATH="${nix-ld-libs}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export MISE_NODE_COMPILE=false
eval "$(mise activate bash)"
'';
} }

View File

@@ -1,15 +0,0 @@
#!/usr/bin/env bash
set -e
cargo build \
--bin revolt-delta \
--bin revolt-bonfire \
--bin revolt-autumn \
--bin revolt-january \
--bin revolt-gifbox
trap 'pkill -f revolt-' SIGINT
cargo run --bin revolt-delta &
cargo run --bin revolt-bonfire &
cargo run --bin revolt-autumn &
cargo run --bin revolt-january &
cargo run --bin revolt-gifbox