Skip to content

Commit

Permalink
Introduce bounty canister
Browse files Browse the repository at this point in the history
  • Loading branch information
ffakenz committed Apr 29, 2024
1 parent 5398e47 commit 24b126c
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = [
"backend",
"bounty",
]
resolver = "2"
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,31 @@ node_modules:
.SILENT: build
build: node_modules
dfx canister create backend
dfx canister create bounty
dfx build

.PHONY: install
.SILENT: install
install: build
dfx canister install backend --mode reinstall --yes
dfx canister install bounty --mode reinstall --yes

.PHONY: upgrade
.SILENT: upgrade
upgrade: build
dfx canister install backend --mode=upgrade
dfx canister install bounty --mode=upgrade

.PHONY: test
.SILENT: test
test-a: install
# Call the bounty canister to get the GitHub issue and capture the output
@echo "Calling healthcheck on bounty canister..."
@TMP_FILE=$$(mktemp); \
dfx canister call bounty healthcheck > $$TMP_FILE; \
echo "healthcheck response:"; \
cat $$TMP_FILE; \
rm -f $$TMP_FILE

.PHONY: test
.SILENT: test
Expand Down
18 changes: 18 additions & 0 deletions bounty/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "bounty"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib"]

[dependencies]
candid = "0.8.2"
ic-cdk = "0.6.0"
ic-cdk-macros = "0.6.0"
serde = "1.0.152"
serde_json = "1.0.93"
serde_bytes = "0.11.9"
regex = "1.5.4"
4 changes: 4 additions & 0 deletions bounty/bounty.did
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
service : {
"healthcheck": () -> (text);
}

5 changes: 5 additions & 0 deletions bounty/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

#[ic_cdk::update]
async fn healthcheck() -> String {
return "OK".to_string();
}
5 changes: 5 additions & 0 deletions dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"candid": "backend/backend.did",
"package": "backend",
"type": "rust"
},
"bounty": {
"candid": "bounty/bounty.did",
"package": "bounty",
"type": "rust"
}
},
"defaults": {
Expand Down

0 comments on commit 24b126c

Please sign in to comment.