Skip to content

Commit

Permalink
scripts replaced with makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
rdcm committed Apr 9, 2024
1 parent 1c5ace9 commit 5ee9b32
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 30 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ For deploing with helm `/etc/hosts` require `127.0.0.1 dev-wep-api.com` entry fo
## Up & Running

From src folder:
- `docker-compose up -d` - up dev environment
- `run.sh` - run api application for local debuging
- `build.sh` - build all workspaces
- `build_images.sh` - build `acl` and `api` dev images
- `docker-compose --profile dev-build up -d` - up `acl` and `api` dev images with compose
- `format.sh` - format code
- `analyze.sh` - static analysis
- `run_tests.sh` - build and run tests
- `make setup` - setup environment
- `make up flag=e` - up environment only
- `make up flag=a` - up all include applications
- `make down flag=e` - down environment only
- `make down flag=a` - down all include applications
- `make build flag=l` - build local binaries
- `make build flag=i` - build apps images
- `make lint` - run clippy for static analysis
- `make format` - run fmt for code formatting
- `make tests` - run tests
- `make run` - run local build

From root folder:
- `generate_cert.sh` - generate self signed cert and create kubernetes secret
Expand Down
44 changes: 44 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
setup:
rustup component add rustfmt
rustup component add clippy
rustup component add llvm-tools-preview
cargo install grcov

up:
ifeq ($(flag),e)
docker-compose up -d
else ifeq ($(flag),a)
docker-compose --profile dev-build up -d
else
$(warning "pass flag=e (environment only) or flag=a (all include applications)")
endif

down:
ifeq ($(flag),e)
docker-compose down
else ifeq ($(flag),a)
docker-compose --profile dev-build down
else
$(warning "pass flag=e (environment only) or flag=a (all include applications)")
endif

build:
ifeq ($(flag),l)
cargo build --workspace
else ifeq ($(flag),i)
docker-compose --profile dev-build build
else
$(warning "pass flag=l (for build local) or flag=i (for build images)")
endif

lint:
cargo clippy

format:
cargo fmt

run:
./target/debug/host

tests:
./run_tests.sh
4 changes: 0 additions & 4 deletions src/analyze.sh

This file was deleted.

2 changes: 1 addition & 1 deletion src/api/src/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ pub async fn track_activity(

match result {
Some(_) => HttpResponse::Ok().json(()),
None => HttpResponse::BadRequest().json(ErrorResponse { code: 103 })
None => HttpResponse::BadRequest().json(ErrorResponse { code: 103 }),
}
}
3 changes: 0 additions & 3 deletions src/build.sh

This file was deleted.

3 changes: 0 additions & 3 deletions src/build_images.sh

This file was deleted.

4 changes: 0 additions & 4 deletions src/format.sh

This file was deleted.

3 changes: 0 additions & 3 deletions src/run.sh

This file was deleted.

4 changes: 0 additions & 4 deletions src/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash

# install tools
cargo install grcov
rustup component add llvm-tools-preview

# set coverage directory path
timestamp="$(date '+%Y-%m-%d_%H-%M-%S')"
directory_path="target/coverage/${timestamp}"
Expand Down

0 comments on commit 5ee9b32

Please sign in to comment.