Archived
3
0

Add continuous development pipeline

This commit is contained in:
2025-03-09 20:46:53 +01:00
parent 77c8deabc8
commit 8df50fe720
3 changed files with 46 additions and 6 deletions

25
.github/workflows/cd.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Continuous testing
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Test client
run: make client_test
- name: Build server
run: make build
- name: Test server
run: make test

View File

@@ -10,12 +10,23 @@ MAIN_RS_SRCS := $(shell find src -type f -regex '^.*\.rs$$') Cargo.toml \
SEARCH_REPLACE := lib/search_and_replace/target/release/search_and_replace SEARCH_REPLACE := lib/search_and_replace/target/release/search_and_replace
DEV_DB := $(shell jq -r .dev.db config.json)
DEV_BIND := $(shell jq -r .dev.bind_to config.json)
PROD_DB := $(shell jq -r .prod.db config.json)
PROD_SOCK_PATH := $(shell jq -r .prod.sock_path config.json)
.PHONY: run .PHONY: run
run: $(MAIN_RS_SRCS) run: $(MAIN_RS_SRCS)
DB_PATH="$$(jq -r .dev.db config.json)" \ DB_PATH="$(DEV_DB)" \
BIND_TO="$$(jq -r .dev.bind_to config.json)" \ BIND_TO="$(DEV_BIND)" \
cargo run --features dev cargo run --features dev
.PHONY: test
test: target/release/zmp24
DB_PATH="$(DEV_DB)" \
BIND_TO="$(DEV_BIND)" \
cargo test --release
.PHONY: clean .PHONY: clean
clean: client_clean clean: client_clean
cargo clean cargo clean
@@ -29,13 +40,13 @@ include client/client.mk
include image/image.mk include image/image.mk
target/release/zmp24: $(MAIN_RS_SRCS) target/release/zmp24: $(MAIN_RS_SRCS)
DB_PATH="$$(jq -r .prod.db config.json)" \ DB_PATH="$(PROD_DB)" \
BIND_TO="$$(jq -r .prod.sock_path config.json)" \ BIND_TO="$(PROD_BIND)" \
cargo build --release cargo build --release
target/$(ARCH)-unknown-linux-musl/release/zmp24: $(MAIN_RS_SRCS) target/$(ARCH)-unknown-linux-musl/release/zmp24: $(MAIN_RS_SRCS)
DB_PATH="$$(jq -r .prod.db config.json)" \ DB_PATH="$(PROD_DB)" \
BIND_TO="$$(jq -r .prod.sock_path config.json)" \ BIND_TO="$(PROD_BIND)" \
cargo build --target $(ARCH)-unknown-linux-musl --release cargo build --target $(ARCH)-unknown-linux-musl --release
$(SEARCH_REPLACE): lib/search_and_replace/src/main.rs lib/search_and_replace/Cargo.toml $(SEARCH_REPLACE): lib/search_and_replace/src/main.rs lib/search_and_replace/Cargo.toml

View File

@@ -27,6 +27,10 @@ client/dst/%.js: client/src/%.ts client/node_modules client/dst
client/dst/%.css: client/src/%.scss client/node_modules client/dst client/dst/%.css: client/src/%.scss client/node_modules client/dst
cat $< | bun run --cwd client sass --stdin --style compressed > $@ cat $< | bun run --cwd client sass --stdin --style compressed > $@
.PHONY: client_test
client_test: client/node_modules
bun test --pwd client
.PHONY: client_clean .PHONY: client_clean
client_clean: client_clean:
rm -rf client/dst rm -rf client/dst