enable CI build for the whole app

Squashed commit of the following:

commit 9f767769ffd1887964e3294d47a043672208810d
Author: Tomáš Mládek <tmladek@protonmail.ch>
Date:   Sat Feb 20 11:51:20 2021 +0100

    update Makefile dependencies

commit 535689b90ea2061854082dda0381f03358f66fc9
Author: Tomáš Mládek <tmladek@protonmail.ch>
Date:   Sat Feb 20 11:02:24 2021 +0100

    build stage produces artifacts

commit 6841e1983141d99b30854430d6a9a6f9353ab9ac
Author: Tomáš Mládek <t@mldk.cz>
Date:   Sat Feb 20 10:58:10 2021 +0100

    install clippy, disable frontend lint for now

commit 778dec8436da536a2c76d9e34624bbbc47eee710
Author: Tomáš Mládek <tmladek@protonmail.ch>
Date:   Sat Feb 20 10:27:44 2021 +0100

    fix makefile (?)

commit b43ab42098bac0af4499a2b0e830c32cdcdcae52
Author: Tomáš Mládek <tmladek@protonmail.ch>
Date:   Sat Feb 20 10:25:38 2021 +0100

    CI test, build whole package
feat/vaults
Tomáš Mládek 2021-02-20 12:26:51 +01:00
parent 001fad3145
commit 4c1034ee4b
2 changed files with 76 additions and 29 deletions

View File

@ -1,24 +1,63 @@
# This file is a template, and might need editing before it works on your project.
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/rust/tags/
image: "rust:latest"
variables:
RUST_IMAGE: "rust:latest"
NODE_IMAGE: "node:lts"
# Optional: Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
# services:
# - mysql:latest
# - redis:latest
# - postgres:latest
stages:
- lint
- build
- test
- release
# Optional: Install a C compiler, cmake and git into the container.
# You will often need this when you (or any of your dependencies) depends on C code.
# before_script:
# - apt-get update -yqq
# - apt-get install -yqq --no-install-recommends build-essential
# Use cargo to test the project
test:cargo:
lint:backend:
stage: lint
image: $RUST_IMAGE
script:
- rustc --version && cargo --version # Print version info for debugging
- cargo test --workspace --verbose
- rustup component add clippy
- make backend_lint
rules:
- allow_failure: true
#lint:frontend:
# stage: lint
# image: $NODE_IMAGE
# script:
# - make frontend_lint
# rules:
# - allow_failure: true
build:backend:
stage: build
image: $RUST_IMAGE
script:
- rustc --version && cargo --version
- make backend
artifacts:
paths:
- target
expire_in: 1 day
build:frontend:
stage: build
image: $NODE_IMAGE
script:
- node --version && npm --version
- make frontend
artifacts:
paths:
- ui/dist
expire_in: 1 day
test:backend:
stage: test
image: $RUST_IMAGE
script:
- make backend_test
package:
stage: release
image: $RUST_IMAGE
script:
- make
artifacts:
paths:
- dist

View File

@ -1,25 +1,33 @@
all: package
all: backend frontend
package: target/release/upend ui/dist/index.html
rm -fr dist
mkdir dist
cp target/release/upend dist/upend
cp -r ui/dist dist/webui
lint: backend_lint frontend_lint
backend: target/release/upend
backend:
target/release/upend:
cargo build --release
frontend: ui/node_modules ui/dist/index.html
ui/dist/index.html:
cd ui && npm run build
lint: backend_lint frontend_lint
backend_lint:
cargo clippy
frontend: npm_install
cd ui && npm run build
frontend_lint: npm_install
frontend_lint: ui/node_modules
cd ui && npm run lint
npm_install:
backend_test:
cargo test --workspace --verbose
ui/node_modules:
cd ui && npm install
clean: