build tooling (#69)

* script/macos:add

* script/linux:add libx11-dev

* Cargo.toml:pin nostr nostr-sdk nostr nostr-connect

---------

Co-authored-by: reya <123083837+reyamir@users.noreply.github.com>
This commit is contained in:
@RandyMcMillan
2025-06-28 03:14:54 -04:00
committed by GitHub
parent 14076054c0
commit 2dfb48b538
5 changed files with 90 additions and 10 deletions

30
.github/workflows/rust.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: Rust
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "m**" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rustup: [stable, nightly]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: script/linux
run: chmod +x ./script/linux && ./script/linux
if: matrix.os == 'ubuntu-latest'
#- name: cargo update
# run: cargo update
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

8
Cargo.lock generated
View File

@@ -3601,6 +3601,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
name = "nostr"
version = "0.42.1"
source = "git+https://github.com/rust-nostr/nostr#ecf711ee9f3bca83c2a31a1de0f2977cd2845af5"
dependencies = [
"aes",
"base64",
@@ -3612,6 +3613,7 @@ dependencies = [
"chacha20poly1305",
"getrandom 0.2.16",
"instant",
"regex",
"reqwest 0.12.20",
"scrypt",
"secp256k1",
@@ -3625,6 +3627,7 @@ dependencies = [
name = "nostr-connect"
version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#ecf711ee9f3bca83c2a31a1de0f2977cd2845af5"
dependencies = [
"async-utility",
"nostr",
@@ -3637,6 +3640,7 @@ dependencies = [
name = "nostr-database"
version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#ecf711ee9f3bca83c2a31a1de0f2977cd2845af5"
dependencies = [
"flatbuffers",
"lru",
@@ -3648,6 +3652,7 @@ dependencies = [
name = "nostr-lmdb"
version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#ecf711ee9f3bca83c2a31a1de0f2977cd2845af5"
dependencies = [
"async-utility",
"heed",
@@ -3661,6 +3666,7 @@ dependencies = [
name = "nostr-relay-pool"
version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#ecf711ee9f3bca83c2a31a1de0f2977cd2845af5"
dependencies = [
"async-utility",
"async-wsocket",
@@ -3677,6 +3683,7 @@ dependencies = [
name = "nostr-sdk"
version = "0.42.0"
source = "git+https://github.com/rust-nostr/nostr#ecf711ee9f3bca83c2a31a1de0f2977cd2845af5"
dependencies = [
"async-utility",
"nostr",
@@ -3684,6 +3691,7 @@ dependencies = [
"nostr-lmdb",
"nostr-relay-pool",
"tokio",
"tracing",
]
[[package]]

View File

@@ -1,10 +0,0 @@
[toolchain]
channel = "1.87"
profile = "minimal"
components = ["rustfmt", "clippy"]
targets = [
"x86_64-apple-darwin",
"aarch64-apple-darwin",
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",
]

View File

@@ -34,6 +34,7 @@ if [[ -n $apt ]]; then
libzstd-dev
libvulkan1
libgit2-dev
libx11-dev
make
cmake
clang

51
script/macos Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -xeuo pipefail
export HOMEBREW_NO_INSTALL_CLEANUP=1
# if root or if sudo/unavailable, define an empty variable
if [ "$(id -u)" -eq 0 ]
then maysudo=''
else maysudo="$(command -v sudo || command -v doas || true)"
fi
function finalize {
# after packages install (curl, etc), get the rust toolchain
which rustup > /dev/null 2>&1 || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# verify the mold situation
if ! command -v mold >/dev/null 2>&1; then
echo "Warning: Mold binaries are unavailable on your system." >&2
echo " Builds will be slower without mold. Try: script/install-mold" >&2
fi
echo "Finished installing MacOS dependencies with script/macos"
}
# MacOS
brew=$(command -v brew || true)
if [[ -n $brew ]]; then
deps=(
gcc
libx11
libxkbcommon
openssl
zstd
vulkan-headers
libgit2
libx11
make
cmake
jq
git
curl
gettext
)
$brew update
for dep in "${deps[@]}";do
$brew search "$dep";
done
$brew install "${deps[@]}"
finalize
exit 0
fi