-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
126 lines (97 loc) · 3.3 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Makefile provides an API for CI related tasks
# Using the makefile is not required however CI
# uses the specific targets within the file.
# Therefore may be useful in ensuring a change
# is ready to pass CI checks.
RUSTFLAGS = -D warnings --cfg tokio_unstable
CARGO = RUSTFLAGS='${RUSTFLAGS}' cargo
RELEASE_LEVEL ?= minor
# ECS environment to deploy image to
DEPLOY_ENV ?= dev
# Deploy target to use for CD manager job
DEPLOY_TARGET ?= latest
# Docker image tag to deploy
DEPLOY_TAG ?= latest
# Whether or not this is a manual deployment
MANUAL_DEPLOY ?= false
# Test selector
TEST_SELECTOR ?= .
.PHONY: all
all: check-deps check-fmt check-clippy build test
.PHONY: check
check: check-deps check-fmt
.PHONY: build
build:
# Build with default features
$(CARGO) build --locked --release
# Build with all features
$(CARGO) build --locked --release --all-features
# Generates api-server crate from ceramic.yaml OpenAPI spec
.PHONY: gen-api-server
gen-api-server: api/ceramic.yaml
./ci-scripts/gen_api_server.sh
# Checks api-server crate is up-to-date
.PHONY: check-api-server
check-api-server:
./ci-scripts/check_generated_server.sh api-server ./ci-scripts/gen_api_server.sh
# Generates kubo-rpc-server crate from ceramic.yaml OpenAPI spec
.PHONY: gen-kubo-rpc-server
gen-kubo-rpc-server:
./ci-scripts/gen_kubo_rpc_server.sh
# Checks kubo-rpc-server crate is up-to-date
.PHONY: check-kubo-rpc-server
check-kubo-rpc-server:
./ci-scripts/check_generated_server.sh kubo-rpc-server ./ci-scripts/gen_kubo_rpc_server.sh
.PHONY: check-migrations
check-migrations:
MIGRATE_DB=1 ./ci-scripts/check_migrations.sh
# Applies migrations to a sqlite without prompting and deletes the file afterward
.PHONY: check-migrations-ci
check-migrations-ci:
MIGRATE_DB=1 CI_RUN=1 MIGRATION_CLEANUP=1 ./ci-scripts/check_migrations.sh
.PHONY: release
release:
$(CARGO) build -p ceramic-one --locked --release
.PHONY: release-debug
release-debug:
$(CARGO) build -p ceramic-one --locked --profile release-debug --features tokio-console
.PHONY: debug
debug:
$(CARGO) build -p ceramic-one --locked --features tokio-console
# Prepare a release PR.
.PHONY: release-pr
release-pr:
./ci-scripts/release_pr.sh ${RELEASE_LEVEL}
.PHONY: test
test:
# Test with default features
$(CARGO) test --locked --release
# Test with all features
$(CARGO) test --locked --release --all-features
.PHONY: check-fmt
check-fmt:
$(CARGO) fmt --all -- --check
.PHONY: check-clippy
check-clippy:
# Check with default features
$(CARGO) clippy --workspace --locked --release -- -D warnings --no-deps
# Check with all features
$(CARGO) clippy --workspace --locked --release --all-features -- -D warnings --no-deps
.PHONY: check-deps
check-deps:
$(CARGO) machete
.PHONY: run
run:
RUST_LOG=ERROR,ceramic_kubo_rpc=DEBUG,ceramic_one=DEBUG $(CARGO) run --all-features --locked --release --bin ceramic-one -- daemon -b 127.0.0.1:5101
.PHONY: publish-docker
publish-docker:
./ci-scripts/publish.sh
.PHONY: schedule-ecs-deployment
schedule-ecs-deployment:
./ci-scripts/schedule_ecs_deploy.sh "${DEPLOY_ENV}" "${DEPLOY_TARGET}" "${DEPLOY_TAG}" "${MANUAL_DEPLOY}"
.PHONY: schedule-k8s-deployment
schedule-k8s-deployment:
./ci-scripts/schedule_k8s_deploy.sh "${DEPLOY_ENV}" "${DEPLOY_TAG}"
.PHONY: schedule-tests
schedule-tests:
./ci-scripts/schedule_tests.sh "${DEPLOY_ENV}" "${TEST_SELECTOR}"