9 Commits

Author SHA1 Message Date
e7eb9b8b16 update .gitignore
All checks were successful
Backend Actions / check (push) Successful in 14s
Backend Actions / build (push) Successful in 26s
Backend Actions / test (push) Successful in 35s
2025-07-25 16:28:40 +01:00
726d9c5a09 add scripts for manually packaging and releasing
All checks were successful
Backend Actions / check (push) Successful in 34s
Backend Actions / build (push) Successful in 34s
Backend Actions / test (push) Successful in 42s
2025-07-25 16:25:51 +01:00
7826018d61 Experiment with automatic packaging and releasing
All checks were successful
Backend Actions / check (push) Successful in 12s
Backend Actions / build (push) Successful in 21s
Backend Actions / package (push) Successful in 15s
Backend Actions / test (push) Successful in 29s
use rust-webapp image for release

use npm rather than pnpm

use node 24

use rust latest image

add cache to release

check for tag before releasing

check for tag before releasing

release 0.0.3
2025-07-25 15:35:08 +01:00
16d72f40ce add packaging script
All checks were successful
Backend Actions / check (push) Successful in 15s
Backend Actions / build (push) Successful in 26s
Backend Actions / test (push) Successful in 37s
2025-07-25 00:40:04 +01:00
50cee580de make shutdown endpoint default 2025-07-25 00:39:51 +01:00
fb4bb63335 use nextest image
All checks were successful
Backend Actions / check (push) Successful in 2m17s
Backend Actions / build (push) Successful in 2m28s
Backend Actions / test (push) Successful in 2m54s
2025-07-24 23:49:26 +01:00
f07e688bf1 install specific version
All checks were successful
Backend Actions / check (push) Successful in 22s
Backend Actions / build (push) Successful in 30s
Backend Actions / test (push) Successful in 2m42s
2025-07-24 23:00:04 +01:00
7d1c7a6c75 install nextest
All checks were successful
Backend Actions / check (push) Successful in 14s
Backend Actions / build (push) Successful in 20s
Backend Actions / test (push) Successful in 3m27s
2025-07-24 22:56:06 +01:00
e90ffabf8b check for nextest before running tests
Some checks failed
Backend Actions / test (push) Failing after 1m43s
Backend Actions / build (push) Successful in 2m2s
Backend Actions / check (push) Successful in 39s
2025-07-24 17:42:31 +01:00
12 changed files with 14477 additions and 9985 deletions

View File

@ -4,7 +4,7 @@ on: [push]
jobs: jobs:
check: check:
runs-on: rust-latest runs-on: rust-nextest
defaults: defaults:
run: run:
working-directory: ./backend working-directory: ./backend
@ -23,7 +23,7 @@ jobs:
build: build:
runs-on: rust-latest runs-on: rust-nextest
defaults: defaults:
run: run:
working-directory: ./backend working-directory: ./backend
@ -41,7 +41,7 @@ jobs:
run: cargo build --release --locked run: cargo build --release --locked
test: test:
runs-on: rust-latest runs-on: rust-nextest
defaults: defaults:
run: run:
working-directory: ./backend working-directory: ./backend
@ -55,8 +55,8 @@ jobs:
~/.cargo/git ~/.cargo/git
backend/target backend/target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('backend/Cargo.lock') }} key: ${{ runner.os }}-cargo-test-${{ hashFiles('backend/Cargo.lock') }}
- name: Build Binary with Shutdown - name: Build Binary
run: cargo build --features shutdown --bin nuchat run: cargo build --locked --bin nuchat
- name: Run Tests - name: Run Tests
run: ./scripts/test.sh run: ./scripts/test.sh
- name: Upload Test Logs - name: Upload Test Logs

2
.gitignore vendored
View File

@ -1 +1,3 @@
.env .env
package/
*.tar.zst

View File

@ -28,5 +28,6 @@ path = "src/main.rs"
name ="nuchat" name ="nuchat"
[features] [features]
default = [] default = [ "shutdown" ]
all = ["shutdown"]
shutdown = [] shutdown = []

View File

@ -1,11 +1,11 @@
build: build:
cargo build --features shutdown cargo build
run: run:
cargo run --features shutdown cargo run
start: start:
cargo run --features shutdown 2>&1 > logs/nuchat.log cargo run 2>&1 > logs/nuchat.log
test: test:
./scripts/test.sh ./scripts/test.sh

View File

@ -1,9 +1,10 @@
# Backend # Backend
Generate random secret using. This secret will be used to authenticate users on all `/admin` routes Generate random secret using openssl. This secret will be used to authenticate users on all `/admin` routes.
If no secret is given then no authentication will be required
```bash ```bash
ADMIN_SECRET=$(openssl rand --base64 32) nuchat --admin-secret $(openssl rand --base64 32)
``` ```
## Features ## Features
@ -11,5 +12,5 @@ ADMIN_SECRET=$(openssl rand --base64 32)
### shutdown ### shutdown
this feature enables an endpoint that allows you to shutdown the server. this feature enables an endpoint that allows you to shutdown the server.
**WARNING**: If the `ADMIN_SECRET` env var is not set then this endpoint is completely exposed and allows anyone to shutdown the server. **WARNING**: If the `admin-secret` flag is not set then this endpoint is completely exposed and allows anyone to shutdown the server.

View File

@ -1,5 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if ! command -v cargo-nextest > /dev/null 2>&1; then
echo "Command not found cargo-nextest"
echo "Try installing with cargo install cargo-nextest"
exit 1
fi
if [ ! -d logs ]; then if [ ! -d logs ]; then
mkdir logs mkdir logs
fi fi
@ -8,7 +14,7 @@ fi
curl -s -X POST localhost:7001/admin/shutdown 2>&1 > /dev/null curl -s -X POST localhost:7001/admin/shutdown 2>&1 > /dev/null
# start server # start server
cargo run --features shutdown -- --port 7001 2>&1 > logs/nuchat.log & cargo run -- --port 7001 2>&1 > logs/nuchat.log &
# run tests # run tests
cargo nextest run 2>&1 | tee logs/test-output.log cargo nextest run --color=always 2>&1 | tee logs/test-output.log

36
scripts/environ.sh Normal file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env bash
function check_tags() {
TAGS="$(git tag --points-at HEAD)"
if [ -n "$TAGS" ]; then
TAG=$(echo "$TAGS" | grep -E '^v[0-9]+.[0-9]+.[0-9]+$' | sort -V | tail -1)
else
echo "No release tag found"
return 1
fi
}
function package() {
PACKAGE_DIR="${PACKAGE_DIR:-package}"
mkdir "$PACKAGE_DIR" > /dev/null 2>&1
pushd backend
cargo build --release
cp -v target/release/nuchat ../package/
popd
pushd ui
npm ci
npm run build
cp -rv .output ../package/ui
popd
OUT_FILE="${OUT_FILE:-package.tar.zst}"
if [ -f "$OUT_FILE" ]; then
rm "$OUT_FILE" > /dev/null 2>&1
fi
tar -cf - package/ | zstd -19 -T0 -o "${OUT_DIR}${OUT_FILE}"
}

25
scripts/release.sh Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
. ./scripts/environ.sh
check_tags
if [ -n "$TAG" ]; then
echo "Found tag $TAG"
RELEASE_VERSION=$(echo "$TAG" | sed 's/v//')
echo "Releasing $RELEASE_VERSION"
echo ""
else
exit 1
fi
package
if [ ! -f package.tar.zst ]; then
echo "failed to generate package"
exit 1
fi
curl -s -X PUT \
-H "Authorization: token $GITEA_TOKEN" \
--upload-file "$OUT_DIR$OUT_FILE" \
"https://git.molloy.xyz/api/packages/fergus-molloy/generic/nuchat/$RELEASE_VERSION/nuchat.tar.zst"

View File

@ -2,11 +2,5 @@
export default defineNuxtConfig({ export default defineNuxtConfig({
compatibilityDate: '2025-07-15', compatibilityDate: '2025-07-15',
devtools: { enabled: true }, devtools: { enabled: true },
modules: ['@nuxt/eslint', '@nuxt/icon', '@nuxt/test-utils']
modules: [ })
'@nuxt/eslint',
'@nuxt/icon',
'@nuxt/image',
'@nuxt/test-utils'
]
})

14387
ui/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -11,11 +11,9 @@
}, },
"dependencies": { "dependencies": {
"@nuxt/eslint": "1.6.0", "@nuxt/eslint": "1.6.0",
"@nuxt/icon": "1.15.0", "@nuxt/icon": "^1.15.0",
"@nuxt/image": "1.10.0", "@nuxt/test-utils": "^3.19.2",
"@nuxt/test-utils": "3.19.2", "nuxt": "^4.0.1",
"eslint": "^9.31.0",
"nuxt": "^4.0.0",
"vue": "^3.5.17", "vue": "^3.5.17",
"vue-router": "^4.5.1" "vue-router": "^4.5.1"
} }

9958
ui/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff