Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Commit 4a256c0

Browse files
Replace cargo-make with regular Makefile
1 parent cc40cbb commit 4a256c0

File tree

5 files changed

+103
-254
lines changed

5 files changed

+103
-254
lines changed

.circleci/config.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
- install_node_devlibs
4343
- print_current_versions
4444
- run:
45-
name: Debug build and test using cargo make
46-
command: cargo make ci
45+
name: Debug build and test
46+
command: make ci
4747
- store_artifacts:
4848
path: api_tests/log
4949
- save_caches
@@ -61,11 +61,10 @@ jobs:
6161
- install_node_devlibs
6262
- print_current_versions
6363
- run:
64-
name: Release build and test using cargo make
64+
name: Release build and test
6565
command: |
66-
export CARGO_MAKE_CARGO_BUILD_TEST_FLAGS="--all --release"
6766
export CND_BIN=~/comit/target/release/cnd
68-
cargo make ci
67+
make ci BUILD_ARGS='--release'
6968
- store_artifacts:
7069
path: api_tests/log
7170
- run:
@@ -137,8 +136,6 @@ commands:
137136
# Define variables that need interpolation
138137
# As CircleCI starts a new shell for each `run` declaration, we need to export cargo home to $BASH_ENV
139138
echo 'export PATH=$HOME/.cargo/bin:$HOME/.local/bin:$PATH' >> $BASH_ENV
140-
export CARGO_MAKE_VERSION="0.22.1"
141-
which cargo-make && test "$(cargo make --version)" = "cargo-make ${CARGO_MAKE_VERSION}" || cargo install cargo-make --force --version ${CARGO_MAKE_VERSION}
142139
print_current_versions:
143140
steps:
144141
- run:

.githooks/pre-commit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ dry=0 # Set to 1 to enable dry run.
66

77
function check_rs() {
88
if (( dry == 0 )); then
9-
cargo make check-rs-format
9+
make check_rust_format
1010
else
1111
echo "check_rs ran"
1212
fi
1313
}
1414

1515
function check_ts() {
1616
if (( dry == 0 )); then
17-
cargo make check-ts
17+
make check_ts_format
1818
else
1919
echo "check_ts ran"
2020
fi
2121
}
2222

2323
function check_cargo_toml() {
2424
if (( dry == 0 )); then
25-
cargo make check-cargo-toml-format
25+
make check_toml_format
2626
else
2727
echo "check_cargo_toml ran"
2828
fi

Makefile

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
RUSTUP = rustup
2+
3+
TOOLCHAIN = $(shell cat rust-toolchain)
4+
CARGO = $(RUSTUP) run --install $(TOOLCHAIN) cargo --color always
5+
6+
NIGHTLY_TOOLCHAIN = "nightly-2019-07-31"
7+
CARGO_NIGHTLY = $(RUSTUP) run --install $(NIGHTLY_TOOLCHAIN) cargo --color always
8+
9+
GIT_HOOKS_PATH = ".githooks"
10+
GIT_HOOKS = $(wildcard $(GIT_HOOKS_PATH)/*)
11+
12+
default: init_git_hooks build format
13+
14+
init_git_hooks: $(GIT_HOOKS)
15+
git config core.hooksPath $(GIT_HOOKS_PATH)
16+
17+
install_rust:
18+
$(RUSTUP) install $(TOOLCHAIN)
19+
20+
install_rust_nightly:
21+
$(RUSTUP) install $(NIGHTLY_TOOLCHAIN)
22+
23+
## Dev environment
24+
25+
install_clippy: install_rust
26+
$(RUSTUP) component list --installed --toolchain $(TOOLCHAIN) | grep -q clippy || $(RUSTUP) component add clippy --toolchain $(TOOLCHAIN)
27+
28+
install_rustfmt: install_rust_nightly
29+
$(RUSTUP) component list --installed --toolchain $(NIGHTLY_TOOLCHAIN) | grep -q rustfmt || $(RUSTUP) component add rustfmt --toolchain $(NIGHTLY_TOOLCHAIN)
30+
31+
install_tomlfmt: install_rust
32+
$(CARGO) --list | grep -q tomlfmt || $(CARGO) install cargo-tomlfmt
33+
34+
yarn_install:
35+
(cd ./api_tests; yarn install)
36+
37+
## User install
38+
39+
install:
40+
$(CARGO) install --force --path .
41+
42+
clean:
43+
$(CARGO) clean
44+
45+
## Development tasks
46+
47+
all: format build clippy test doc e2e_scripts
48+
49+
format: install_rustfmt install_tomlfmt yarn_install
50+
$(CARGO_NIGHTLY) fmt
51+
$(CARGO) tomlfmt -p Cargo.toml
52+
(cd ./api_tests; yarn run fix)
53+
54+
ci: check_format doc clippy test build e2e
55+
56+
build:
57+
$(CARGO) build --all --all-targets $(BUILD_ARGS)
58+
59+
clippy: install_clippy
60+
$(CARGO) clippy \
61+
--all-targets \
62+
-- \
63+
-W clippy::cast_possible_truncation \
64+
-W clippy::cast_sign_loss \
65+
-W clippy::fallible_impl_from \
66+
-W clippy::cast_precision_loss \
67+
-W clippy::cast_possible_wrap \
68+
-W clippy::print_stdout \
69+
-W clippy::dbg_macro \
70+
-D warnings
71+
72+
test:
73+
$(CARGO) test --all
74+
75+
doc:
76+
$(CARGO) doc
77+
78+
check_format: check_rust_format check_toml_format check_ts_format
79+
80+
check_rust_format: install_rustfmt
81+
$(CARGO_NIGHTLY) fmt -- --check
82+
83+
check_toml_format: install_tomlfmt
84+
$(CARGO) tomlfmt -d -p Cargo.toml
85+
86+
check_ts_format: yarn_install
87+
(cd ./api_tests; yarn run check)
88+
89+
e2e: build yarn_install
90+
(cd ./api_tests; yarn test)

Makefile.toml

Lines changed: 0 additions & 229 deletions
This file was deleted.

0 commit comments

Comments
 (0)