Compare commits

..

2 Commits

Author SHA1 Message Date
576c832ccc build dist for tests
Some checks failed
Cargo / check (push) Successful in 33s
Cargo / build (push) Successful in 36s
Cargo / test (push) Failing after 50s
2025-07-18 15:40:56 +01:00
9557bb694c move to Makefile 2025-07-18 15:39:09 +01:00
7 changed files with 40 additions and 39 deletions

View File

@ -23,7 +23,7 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-cargo-build-target
- name: Build project
- name: Build release project
uses: actions-rs/cargo@v1
with:
command: build
@ -68,6 +68,8 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-test-target-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-cargo-test-target
- name: Build
run: make build
- name: Run tests
uses: actions-rs/cargo@v1
with:

View File

@ -1,30 +0,0 @@
run *ARGS: build
./target/debug/nuchat {{ARGS}}
start: build
./target/debug/nuchat 2>&1 > target/debug/logs/nuchat.log &
build: build-cargo build-ui
build-cargo:
@mkdir -p target/debug/logs
@mkdir -p dist
cargo build
[working-directory: "ui"]
build-ui:
npm install
npm run build
test: integration unit
integration:
if [ ! $(curl -sf "localhost:7000/api/healthcheck" ) ]; then just run; fi
cargo test --test '*'
unit:
cargo test --lib --bins
docker *ARGS:
docker compose build
docker compose up {{ARGS}}

25
Makefile Normal file
View File

@ -0,0 +1,25 @@
dist: ui
cd ui && make dist
target/debug/nuchat: src dist
cargo build
target/release/nuchat: src dist
cargo build --release
.PHONY: build release test docker run start
build: target/debug/nuchat
release: target/release/nuchat
test: build
cargo test
docker:
docker compose build
run: docker
docker compose up
start:
docker compose up -d

6
package-lock.json generated Normal file
View File

@ -0,0 +1,6 @@
{
"name": "nuchat",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}

View File

@ -20,9 +20,7 @@ struct Args {
async fn main() -> Result<(), std::io::Error> {
let args = Args::parse();
let str_address = format!("{}:{}", args.host, args.port);
let address: SocketAddr = str_address
.parse()
.unwrap_or_else(|_| panic!("could not parse address: {str_address}"));
let address: SocketAddr = str_address.parse().unwrap(); // _or_else(|_| panic!("could not parse address: {str_address}"));
let listener = tokio::net::TcpListener::bind(address).await?;
let result = run(listener)?.await;
event!(Level::INFO, "Server stopped");

View File

@ -1,5 +0,0 @@
install:
npm install
build: install
npm run build

5
ui/Makefile Normal file
View File

@ -0,0 +1,5 @@
dist: node_modules
npm run build
node_modules: package.json package-lock.json
npm ci