ci, wip!: replace Makefile with Taskfile

feat/type-attributes
Tomáš Mládek 2023-04-20 19:25:40 +02:00
parent 7e0151fa64
commit 5bbb6b421b
4 changed files with 116 additions and 65 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
upend.sqlite3
.upend
.task

View File

@ -1,64 +0,0 @@
all: target/release/upend webui/dist
package: all
rm -fr dist
linuxdeploy-x86_64.AppImage --appdir dist
cp target/release/upend dist/usr/bin/upend
cp -r webui/dist dist/usr/bin/webui
cp media/upend.png dist/usr/share/icons/upend.png
VERSION="$$(grep '^version' Cargo.toml|grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')" \
linuxdeploy-x86_64.AppImage --appdir dist -d upend.desktop --output appimage
backend:
cd server && cargo build --release
frontend: tools/upend_js/index.js
cd webui && yarn add ../tools/upend_js && yarn install --immutable && yarn build
jslib:
cd tools/upend_js && yarn install --immutable && yarn build
target/release/upend:
make backend
webui/dist:
make frontend
tools/upend_js/index.js:
make jslib
lint: backend_lint frontend_lint
backend_lint:
cargo clippy
backend_lint_no_default:
cargo clippy --no-default-features
frontend_lint:
cd webui && yarn add ../tools/upend_js && yarn install --immutable && yarn check && yarn lint
frontend_lib_lint:
cd tools/upend_js && yarn install --immutable && yarn lint
backend_test:
cargo test --workspace --verbose
backend_test_no_default:
cargo test --no-default-features --workspace --verbose
clean: clean_tools clean_frontend clean_backend
clean_tools:
rm -vrf tools/upend_js/*.js
clean_frontend:
rm -vrf webui/dist webui/public/vendor
clean_backend:
cargo clean
update_schema:
rm -f upend.sqlite3
diesel migration run --migration-dir migrations/upend/
diesel print-schema > src/database/inner/schema.rs

114
Taskfile.yml Normal file
View File

@ -0,0 +1,114 @@
# https://taskfile.dev
version: "3"
vars:
GREETING: Hello, World!
tasks:
default:
cmds:
- task: lint
- task: test
- task: build
package:
cmds:
- task:clean
- task:default
- rm -fr dist
- linuxdeploy-x86_64.AppImage --appdir dist
- cp target/release/upend dist/usr/bin/upend
- cp -r webui/dist dist/usr/bin/webui
- cp assets/upend.png dist/usr/share/icons/upend.png
- linuxdeploy-x86_64.AppImage --appdir dist -d upend.desktop --output appimage
vars:
VERSION:
sh: grep '^version' Cargo.toml|grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
lint:
deps: [lint:frontend, lint:backend]
lint:frontend:
dir: webui
deps: [setup:frontend]
cmds:
- yarn check
- yarn lint
lint:backend:
cmds:
- cargo clippy --workspace
test:
deps: [test:backend]
test:backend:
cmds:
- cargo nextest run --workspace
build:
deps: [build:frontend, build:backend]
build:backend:
dir: server
sources:
- ./**/Cargo.toml
- ./**/*.rs
cmds:
- cargo build --release
build:frontend:
dir: webui
deps: [setup:frontend, build:jslib]
cmds:
- yarn build
build:jslib:
dir: tools/upend_js
cmds:
- yarn install --immutable
- yarn build
setup:frontend:
dir: webui
sources:
- ../tools/upend_js/*.js
- webui/package.json
cmds:
- yarn add ../tools/upend_js
- yarn install --immutable
dev:
deps: [dev:backend, dev:frontend]
dev:backend:
dir: server
cmds:
- cargo run --release -- ../example_vault --clean
dev:frontend:
dir: webui
cmds:
- yarn dev
clean:
deps: [clean:backend, clean:frontend, clean:tools]
clean:backend:
cmds:
- cargo clean
clean:frontend:
cmds:
- rm -vrf webui/dist webui/public/vendor
clean:tools:
cmds:
- rm -vrf tools/upend_js/*.js
update-schema:
cmds:
- rm -f upend.sqlite3
- diesel migration run --migration-dir migrations/upend/
- diesel print-schema > src/database/inner/schema.rs

View File

@ -4,7 +4,7 @@
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"dev": "vite --clearScreen=false",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json",