-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
53 lines (41 loc) · 1.79 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
SOURCE_FILES := $(shell test -e src/ && find src -type f)
VERSION := $(shell sed --posix -n 's,^version = \"\(.*\)\",\1,p' Cargo.toml)
policy.wasm: $(SOURCE_FILES) Cargo.*
cargo build --target=wasm32-wasip1 --release
cp target/wasm32-wasip1/release/*.wasm policy.wasm
artifacthub-pkg.yml: metadata.yml Cargo.toml
kwctl scaffold artifacthub --metadata-path metadata.yml --version $(VERSION) \
--questions-path questions-ui.yml --output artifacthub-pkg.yml
annotated-policy.wasm: policy.wasm metadata.yml
kwctl annotate -m metadata.yml -u README.md -o annotated-policy.wasm policy.wasm
.PHONY: fmt
fmt:
cargo fmt --all -- --check
.PHONY: lint
lint:
cargo clippy --workspace -- -D warnings
.PHONY: e2e-tests
e2e-tests: annotated-policy.wasm
bats e2e.bats
.PHONY: test
test: check-policy-metadata check-policy-version fmt lint
cargo test --workspace
.PHONY: expected-policy-version
expected-policy-version:
cargo run --quiet --manifest-path crates/policy-version-helper/Cargo.toml -- --manifest-path Cargo.toml build
.PHONY: check-policy-version
check-policy-version:
cargo run --quiet --manifest-path crates/policy-version-helper/Cargo.toml -- --manifest-path Cargo.toml check
.PHONY: expected-policy-metadata
expected-policy-metadata:
cargo run --quiet --manifest-path crates/policy-metadata-helper/Cargo.toml -- --metadata-path metadata.yml build
.PHONY: check-policy-metadata
check-policy-metadata:
cargo run --quiet --manifest-path crates/policy-metadata-helper/Cargo.toml -- --metadata-path metadata.yml check
.PHONY: clean
clean:
cargo clean
cargo clean --manifest-path crates/policy-version-helper/Cargo.toml
cargo clean --manifest-path crates/policy-metadata-helper/Cargo.toml
cargo clean --manifest-path crates/versions/Cargo.toml
rm -f policy.wasm annotated-policy.wasm artifacthub-pkg.yml