Add continuous development pipeline
This commit is contained in:
25
.github/workflows/cd.yml
vendored
Normal file
25
.github/workflows/cd.yml
vendored
Normal 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
|
23
Makefile
23
Makefile
@@ -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
|
||||
|
||||
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
|
||||
run: $(MAIN_RS_SRCS)
|
||||
DB_PATH="$$(jq -r .dev.db config.json)" \
|
||||
BIND_TO="$$(jq -r .dev.bind_to config.json)" \
|
||||
DB_PATH="$(DEV_DB)" \
|
||||
BIND_TO="$(DEV_BIND)" \
|
||||
cargo run --features dev
|
||||
|
||||
.PHONY: test
|
||||
test: target/release/zmp24
|
||||
DB_PATH="$(DEV_DB)" \
|
||||
BIND_TO="$(DEV_BIND)" \
|
||||
cargo test --release
|
||||
|
||||
.PHONY: clean
|
||||
clean: client_clean
|
||||
cargo clean
|
||||
@@ -29,13 +40,13 @@ include client/client.mk
|
||||
include image/image.mk
|
||||
|
||||
target/release/zmp24: $(MAIN_RS_SRCS)
|
||||
DB_PATH="$$(jq -r .prod.db config.json)" \
|
||||
BIND_TO="$$(jq -r .prod.sock_path config.json)" \
|
||||
DB_PATH="$(PROD_DB)" \
|
||||
BIND_TO="$(PROD_BIND)" \
|
||||
cargo build --release
|
||||
|
||||
target/$(ARCH)-unknown-linux-musl/release/zmp24: $(MAIN_RS_SRCS)
|
||||
DB_PATH="$$(jq -r .prod.db config.json)" \
|
||||
BIND_TO="$$(jq -r .prod.sock_path config.json)" \
|
||||
DB_PATH="$(PROD_DB)" \
|
||||
BIND_TO="$(PROD_BIND)" \
|
||||
cargo build --target $(ARCH)-unknown-linux-musl --release
|
||||
|
||||
$(SEARCH_REPLACE): lib/search_and_replace/src/main.rs lib/search_and_replace/Cargo.toml
|
||||
|
@@ -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
|
||||
cat $< | bun run --cwd client sass --stdin --style compressed > $@
|
||||
|
||||
.PHONY: client_test
|
||||
client_test: client/node_modules
|
||||
bun test --pwd client
|
||||
|
||||
.PHONY: client_clean
|
||||
client_clean:
|
||||
rm -rf client/dst
|
||||
|
Reference in New Issue
Block a user