Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Remove duplicating defaults #52

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2e87c72
nix-shell set up | update the hcbuilds | import v0.0.28-alpha1 | init…
zo-el Sep 15, 2019
3cd3d57
updated zome: comments
zo-el Sep 15, 2019
c0a4f1c
updated zome: communities
zo-el Sep 15, 2019
eab6584
updated zome: messages
zo-el Sep 15, 2019
877eccb
updated zome: people
zo-el Sep 15, 2019
b2e500d
updated zome: posts
zo-el Sep 15, 2019
92211d4
updated zome: graphql
zo-el Sep 15, 2019
9db5520
updated the hcbuilds
zo-el Sep 15, 2019
a70bafe
set up diorama
zo-el Sep 16, 2019
bdadc70
fix threads tests
zo-el Sep 16, 2019
efac261
fix multi user test
zo-el Sep 16, 2019
5ee3f66
clean up
zo-el Sep 16, 2019
1023ee5
updated the CI
zo-el Sep 16, 2019
323e055
Update README.md
zo-el Sep 16, 2019
8fb4903
Merge pull request #1 from holochain/updated-dna-to-v0.0.28-alpha1
zo-el Sep 16, 2019
b5bc84d
cleanup conductor-configs
robbiecarlton Oct 18, 2019
dac3ad4
update the dna to hc v0.0.32-alpha2
zo-el Oct 24, 2019
bbe997d
Merge pull request #2 from holochain/updated-to-0.0.32-alpha2
zo-el Oct 25, 2019
03e6423
shrink WASM in .hcbuild
willemolding Nov 26, 2019
55d8956
strips old tests and fixes existing ones
willemolding Nov 26, 2019
4c977fd
change env var
willemolding Nov 26, 2019
63edb45
update nix stuff and make
willemolding Nov 26, 2019
26d11de
drop more stuff from nix devs
willemolding Nov 26, 2019
86a0626
flatten repo structure
willemolding Nov 26, 2019
cf094d7
Updat README with updated build instructions
Nov 28, 2019
fd0ed6a
Merge pull request #3 from holochain/tidy-and-update
willemolding Dec 3, 2019
39a8524
Upgrade to Holochain v0.0.40-alpha1
Dec 3, 2019
f2609f1
implements default communities in the DNA
willemolding Dec 5, 2019
ce6e85a
Merge pull request #5 from holochain/Holochain-0.0.40-alpha1
Dec 5, 2019
48fb865
Merge branch 'develop' into remove-duplicating-defaults
Dec 5, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2

jobs:
build:
docker:
- image: holochain/holonix:latest
steps:
- checkout
- run:
name: Starting test...
command: nix-shell --run 'make test'
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ target
dist
release

# ui builds
hylo-ui
graphiql-ui/build

# misc
.DS_Store
npm-debug.log
Expand All @@ -28,9 +24,8 @@ npm-debug.log

yarn-error.log
.idea
Cargo.lock
package-lock.json
dmg-mount
conductor-config.toml
keystores/myagent.keystore
.cargo
holochain-rust
6 changes: 6 additions & 0 deletions .hcignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test
dist
config.nix
default.nix
Makefile
README.md
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

77 changes: 77 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#
# Test and build hApp-store Project
#
SHELL = bash
DNANAME = .
DNA = dist/hylo-holo-dnas.dna.json

# External targets; Uses a nix-shell environment to obtain Holochain runtimes, run tests, etc.
.PHONY: all
all: nix-test

# nix-test, nix-install, ...
nix-%:
nix-shell --pure --run "make $*"

# Internal targets; require a Nix environment in order to be deterministic.
# - Uses the version of `hc`, `holochain` on the system PATH.
# - Normally called from within a Nix environment, eg. run `nix-shell` from within holofuel
.PHONY: rebuild install build test test-unit test-e2e
rebuild: clean build

install: build

build: $(DNANAME)/$(DNA)

# Build the DNA; Specifying a custom --output requires the path to exist
# However, if the name of the directory within which `hc` is run matches the
# DNA's name, then this name is used by default, and the output directory is
# created automatically.
$(DNANAME)/$(DNA):
cd $(DNANAME) \
&& hc package --strip-meta

test: test-unit test-e2e

# test-unit -- Run Rust unit tests via Cargo
test-unit:
cd $(DNANAME) \
&& RUST_BACKTRACE=1 cargo test \
--manifest-path zomes/comments/code/Cargo.toml \
-- --nocapture \
&& RUST_BACKTRACE=1 cargo test \
--manifest-path zomes/messages/code/Cargo.toml \
-- --nocapture \
&& RUST_BACKTRACE=1 cargo test \
--manifest-path zomes/people/code/Cargo.toml \
-- --nocapture \
&& RUST_BACKTRACE=1 cargo test \
--manifest-path zomes/posts/code/Cargo.toml \
-- --nocapture \
&& RUST_BACKTRACE=1 cargo test \
--manifest-path zomes/communities/code/Cargo.toml \
-- --nocapture


test-e2e: $(DNANAME)/$(DNA)
@echo "Setting up Scenario test Javascript..."; \
( cd test && npm install );
@echo "Starting sim2h server..."; \
sim2h_server &
@echo "Starting Communities Scenario tests..."; \
RUST_BACKTRACE=1 NETWORK_TYPE=sim2h hc test \


# Generic targets; does not require a Nix environment
.PHONY: clean
clean:
rm -rf \
dist \
test/node_modules \
.cargo \
target \
zomes/comments/code/target \
zomes/messages/code/target \
zomes/people/code/target \
zomes/posts/code/target \
zomes/communities/code/target
130 changes: 3 additions & 127 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,133 +9,9 @@ DNAs required for running Hylo on Holochain.
Instructions for installing Rust and building the holochain container can be found at [developer.holochain](https://developer.holochain.org/start.html).

After this is installed the DNA can be build using
`npm run build`
`hc package`
and started using
`npm run start`
`holochain -c ./conductor-configs/conductor-config.toml`

If you plan to develop the DNA code further the automated tests can be run using
`npm run test`

At the current time the container config does not include configuration of the network. This is because at the time of writing you must hard code the IPs in the local network. Defauls about this can be found at [developer.holochain](https://developer.holochain.org/start.html) and will likely be updated soon.

## Making changes to the schema

The `schema.graphql` documents the specification of the schema that this DNA must implement. This is enforced via the automated tests.

Any changes to the `schema.graphql` file must be approved by the frond-end dev team to ensure no unplanned breaking changes.

## Example queries
Handy to have these here for reference. These are the 4 queries that are redirected to holochain.

Test the holochain container calls with
`curl -X POST -H "Content-Type: application/json" -d @create-thread-query.json http://localhost:3400`

Retrieving all threads
```javascript
graphql: {
query: `query ($first: Int, $offset: Int) {
me {
id
messageThreads(sortBy: "updatedAt", order: "desc", first: $first, offset: $offset) {
total
hasMore
items {
id
unreadCount
lastReadAt
createdAt
updatedAt
participants {
id
name
avatarUrl
}
messages(first: 1, order: "desc") {
items {
id
createdAt
text
creator {
id
name
}
}
}
}
}
}
}`,
variables: {
first,
offset
}
}
```

Fetching all the messages from a thread
```javascript
graphql: {
query: `
query ($id: ID, $cursor: ID) {
messageThread (id: $id) {
id
messages(first: 80, cursor: $cursor, order: "desc") {
items {
id
createdAt
text
creator {
id
name
avatarUrl
}
}
total
hasMore
}
}
}
`,
variables: opts.cursor ? {id, cursor: opts.cursor} : {id}
}
```

Creating a message in a thread
```javascript
graphql: {
query: `mutation ($messageThreadId: String, $text: String) {
createMessage(data: {messageThreadId: $messageThreadId, text: $text}) {
id
text
createdAt
creator {
id
}
messageThread {
id
}
}
}`,
variables: {
messageThreadId,
text
}
}
```

Find or create a thread
```javascript
const findOrCreateThreadQuery =
`mutation ($participantIds: [String]) {
findOrCreateThread(data: {participantIds: $participantIds}) {
id
createdAt
updatedAt
participants {
id
name
avatarUrl
}
}
}`
```
`nix-shell --run 'npm run test'`
82 changes: 0 additions & 82 deletions conductor-configs/conductor-config-agent1.toml

This file was deleted.

Loading