mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-05-06 08:36:53 -04:00
chore: switch to mise for tooling & update crates for publishing (#494)
This commit is contained in:
@@ -14,16 +14,10 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
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
|
||||
run: pnpm install
|
||||
- name: Test build website
|
||||
run: pnpm run build
|
||||
- name: Setup Mise
|
||||
uses: immich-app/devtools/actions/use-mise@cd24790a7f5f6439ac32cc94f5523cb2de8bfa8c # use-mise-action-v1.1.0
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- run: mise docs:build
|
||||
|
||||
@@ -16,19 +16,13 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
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
|
||||
run: pnpm install
|
||||
- name: Build website
|
||||
run: pnpm run build
|
||||
- name: Setup Mise
|
||||
uses: immich-app/devtools/actions/use-mise@cd24790a7f5f6439ac32cc94f5523cb2de8bfa8c # use-mise-action-v1.1.0
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- run: mise docs:build
|
||||
|
||||
- name: Upload Build Artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
|
||||
@@ -15,7 +15,10 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Publish crates
|
||||
uses: katyo/publish-crates@02cc2f1ad653fb25c7d1ff9eb590a8a50d06186b # v2
|
||||
- name: Setup Mise
|
||||
uses: immich-app/devtools/actions/use-mise@cd24790a7f5f6439ac32cc94f5523cb2de8bfa8c # use-mise-action-v1.1.0
|
||||
with:
|
||||
registry-token: ${{ secrets.CRATES_IO_PUBLISH_TOKEN }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Publish
|
||||
run: mise publish --workspace
|
||||
|
||||
+11
-21
@@ -26,43 +26,33 @@ jobs:
|
||||
# run: |
|
||||
# sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc
|
||||
|
||||
- name: Install latest stable
|
||||
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
|
||||
- name: Setup Mise
|
||||
uses: immich-app/devtools/actions/use-mise@cd24790a7f5f6439ac32cc94f5523cb2de8bfa8c # use-mise-action-v1.1.0
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Install cargo-nextest
|
||||
uses: taiki-e/install-action@a58ae9526b2c3acee9ad8e1926b950b7863305d4 # 2.65.16
|
||||
with:
|
||||
tool: cargo-nextest@0.9.119
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Run cargo build
|
||||
run: cargo build
|
||||
|
||||
- name: Run services in background
|
||||
run: |
|
||||
docker compose -f compose.yml up -d
|
||||
|
||||
- name: Run cargo test
|
||||
- run: mise build
|
||||
- run: mise docker:start
|
||||
|
||||
- name: Reference Test
|
||||
env:
|
||||
TEST_DB: REFERENCE
|
||||
run: |
|
||||
cargo nextest run
|
||||
mise test
|
||||
|
||||
- name: Run cargo test (with MongoDB)
|
||||
- name: MongoDB Test
|
||||
env:
|
||||
TEST_DB: MONGODB
|
||||
MONGODB: mongodb://localhost
|
||||
run: |
|
||||
cargo nextest run
|
||||
mise test
|
||||
|
||||
- name: Start API in background
|
||||
if: github.event_name != 'pull_request' && github.ref_name == 'main'
|
||||
env:
|
||||
TEST_DB: REFERENCE
|
||||
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
|
||||
if: github.event_name != 'pull_request' && github.ref_name == 'main'
|
||||
|
||||
@@ -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:*" }]
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Build project"
|
||||
set -e
|
||||
|
||||
cargo build "$@"
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Check project with clippy"
|
||||
set -e
|
||||
|
||||
cargo clippy
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Start Docker containers"
|
||||
set -e
|
||||
|
||||
docker compose up -d
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Stop Docker containers"
|
||||
set -e
|
||||
|
||||
docker compose down
|
||||
Executable
+7
@@ -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
|
||||
Executable
+7
@@ -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
|
||||
Executable
+6
@@ -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
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Publish project"
|
||||
set -e
|
||||
|
||||
cargo publish "$@"
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run API server"
|
||||
set -e
|
||||
|
||||
cargo run --bin revolt-delta
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run cron daemon"
|
||||
set -e
|
||||
|
||||
cargo run --bin revolt-crond
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run events server"
|
||||
set -e
|
||||
|
||||
cargo run --bin revolt-bonfire
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run file server"
|
||||
set -e
|
||||
|
||||
cargo run --bin revolt-autumn
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run GIF proxy server"
|
||||
set -e
|
||||
|
||||
cargo run --bin revolt-gifbox
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run proxy server"
|
||||
set -e
|
||||
|
||||
cargo run --bin revolt-january
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Run push daemon"
|
||||
set -e
|
||||
|
||||
cargo run --bin revolt-pushd
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#MISE description="Test project"
|
||||
set -e
|
||||
|
||||
cargo nextest run
|
||||
@@ -43,13 +43,13 @@ Before contributing, make yourself familiar with [our contribution guidelines](h
|
||||
|
||||
Before getting started, you'll want to install:
|
||||
|
||||
- Rust toolchain (rustup recommended)
|
||||
- mise
|
||||
- Docker
|
||||
- Git
|
||||
- mold (optional, faster compilation)
|
||||
|
||||
> 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:
|
||||
|
||||
@@ -72,7 +72,7 @@ Now you can clone and build the project:
|
||||
```bash
|
||||
git clone https://github.com/revoltchat/backend revolt-backend
|
||||
cd revolt-backend
|
||||
cargo build
|
||||
mise build
|
||||
```
|
||||
|
||||
A default configuration `Revolt.toml` is present in this project that is suited for development.
|
||||
|
||||
@@ -12,6 +12,10 @@ services:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- ./.data/db:/data/db
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 65536
|
||||
hard: 65536
|
||||
|
||||
# MinIO
|
||||
minio:
|
||||
|
||||
@@ -5,6 +5,7 @@ edition = "2021"
|
||||
license = "MIT"
|
||||
authors = ["Paul Makles <me@insrt.uk>", "Zomatree <me@zomatree.live>"]
|
||||
description = "Revolt Backend: Coalescion service"
|
||||
repository = "https://github.com/stoatchat/stoatchat"
|
||||
|
||||
[features]
|
||||
tokio = ["dep:tokio"]
|
||||
@@ -19,4 +20,9 @@ indexmap = { version = "2.13.0", optional = true }
|
||||
lru = { version = "0.16.3", optional = true }
|
||||
|
||||
[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",
|
||||
] }
|
||||
|
||||
@@ -5,6 +5,7 @@ edition = "2021"
|
||||
license = "MIT"
|
||||
authors = ["Paul Makles <me@insrt.uk>"]
|
||||
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
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ edition = "2021"
|
||||
license = "AGPL-3.0-or-later"
|
||||
authors = ["Paul Makles <me@insrt.uk>"]
|
||||
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
|
||||
|
||||
@@ -15,8 +16,14 @@ mongodb = ["dep:mongodb", "bson", "authifier/database-mongodb"]
|
||||
# ... Other
|
||||
tasks = ["isahc", "linkify", "url-escape"]
|
||||
async-std-runtime = ["async-std", "authifier/async-std-runtime"]
|
||||
rocket-impl = ["rocket", "schemars", "revolt_okapi", "revolt_rocket_okapi", "authifier/rocket_impl"]
|
||||
axum-impl = ["axum"]
|
||||
rocket-impl = [
|
||||
"rocket",
|
||||
"schemars",
|
||||
"revolt_okapi",
|
||||
"revolt_rocket_okapi",
|
||||
"authifier/rocket_impl",
|
||||
]
|
||||
axum-impl = ["axum", "revolt-result/axum"]
|
||||
redis-is-patched = ["revolt-presence/redis-is-patched"]
|
||||
voice = ["livekit-api", "livekit-protocol", "livekit-runtime"]
|
||||
|
||||
@@ -99,6 +106,6 @@ authifier = { version = "1.0.15" }
|
||||
amqprs = { version = "1.7.0" }
|
||||
|
||||
# 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-runtime = { version = "0.3.1", features = ["tokio"], optional = true }
|
||||
|
||||
@@ -5,6 +5,7 @@ edition = "2021"
|
||||
license = "AGPL-3.0-or-later"
|
||||
authors = ["Paul Makles <me@insrt.uk>"]
|
||||
description = "Revolt Backend: S3 and encryption subroutines"
|
||||
repository = "https://github.com/stoatchat/stoatchat"
|
||||
|
||||
[dependencies]
|
||||
tracing = "0.1"
|
||||
|
||||
@@ -5,6 +5,7 @@ edition = "2021"
|
||||
license = "MIT"
|
||||
authors = ["Paul Makles <me@insrt.uk>"]
|
||||
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
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ edition = "2021"
|
||||
license = "MIT"
|
||||
authors = ["Zomatree <me@zomatree.live>", "Paul Makles <me@insrt.uk>"]
|
||||
description = "Revolt Backend: Message Parser"
|
||||
repository = "https://github.com/stoatchat/stoatchat"
|
||||
|
||||
[dependencies]
|
||||
logos = { version = "0.15" }
|
||||
|
||||
@@ -5,6 +5,7 @@ edition = "2021"
|
||||
license = "MIT"
|
||||
authors = ["Paul Makles <me@insrt.uk>"]
|
||||
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
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ edition = "2021"
|
||||
license = "AGPL-3.0-or-later"
|
||||
authors = ["Paul Makles <me@insrt.uk>"]
|
||||
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
|
||||
|
||||
|
||||
@@ -2,15 +2,23 @@
|
||||
name = "revolt-ratelimits"
|
||||
version = "0.9.4"
|
||||
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]
|
||||
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"]
|
||||
|
||||
default = ["rocket", "axum"]
|
||||
|
||||
[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-config = { version = "0.9.4", path = "../config" }
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ edition = "2021"
|
||||
license = "MIT"
|
||||
authors = ["Paul Makles <me@insrt.uk>"]
|
||||
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
|
||||
|
||||
@@ -38,4 +39,4 @@ log = "0.4"
|
||||
# Axum
|
||||
axum = { version = "0.7.5", optional = true }
|
||||
|
||||
sentry = { version = "0.31.5", optional = true }
|
||||
sentry = { version = "0.31.5", optional = true }
|
||||
|
||||
@@ -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_permissions::{calculate_channel_permissions, ChannelPermission};
|
||||
use revolt_result::{create_error, Result};
|
||||
|
||||
+36
-23
@@ -1,28 +1,41 @@
|
||||
{
|
||||
pkgs ? import <nixpkgs> { },
|
||||
{ pkgs ? import (fetchTarball {
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/77ef7a29d276c6d8303aece3444d61118ef71ac2.tar.gz";
|
||||
sha256 = "0pm4l48jq8plzrrrisimahxqlcpx7qqq9c99hylmf7p3zlc3phsy";
|
||||
}) {},
|
||||
}:
|
||||
|
||||
pkgs.mkShell rec {
|
||||
buildInputs = [
|
||||
# Tools
|
||||
pkgs.git
|
||||
pkgs.just
|
||||
let
|
||||
nix-ld-libs = pkgs.buildEnv {
|
||||
name = "nix-ld-libs";
|
||||
paths = with pkgs; [
|
||||
stdenv.cc.cc.lib
|
||||
zlib
|
||||
openssl.out
|
||||
];
|
||||
pathsToLink = [ "/lib" ];
|
||||
};
|
||||
|
||||
# Cargo
|
||||
pkgs.cargo
|
||||
pkgs.cargo-nextest
|
||||
pkgs.cargo-release
|
||||
|
||||
# Rust
|
||||
pkgs.rustc
|
||||
pkgs.clippy
|
||||
pkgs.rustfmt
|
||||
pkgs.pkg-config
|
||||
pkgs.openssl.dev
|
||||
|
||||
# mdbook
|
||||
pkgs.mdbook
|
||||
in pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
mise
|
||||
cargo-binstall
|
||||
(writeShellScriptBin "fish" ''
|
||||
exec ${pkgs.fish}/bin/fish -C 'mise activate fish | source' "$@"
|
||||
'')
|
||||
];
|
||||
|
||||
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)"
|
||||
'';
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user