Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Migrate messaging tutorial into tutorials #29

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 20 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,33 @@ commands:
apt-get -qq update
apt-get -qq install python curl git gcc
curl --proto '=https' --tlsv1.2 -sSL https://get.oasis.dev | python
build_and_test_service:
description: "Builds and tests a tutorial Rust service"
parameters:
tutorial:
type: string
steps:
- run:
name: Build << parameters.tutorial >>
working_directory: << parameters.tutorial >>/service
command: oasis build
- run:
name: Test << parameters.tutorial >>
working_directory: << parameters.tutorial >>/service
command: oasis test

jobs:
build_test:
executor: rust
steps:
- checkout
- install_oasis
- run:
name: Build Hello World
working_directory: hello-world/service
command: oasis build
- run:
name: Test Hello World
working_directory: hello-world/service
command: oasis test
- run:
name: Build Secret Ballot
working_directory: ballot/service
command: oasis build
- run:
name: Test Secret Ballot
working_directory: ballot/service
command: oasis test
- build_and_test_service:
tutorial: hello-world
- build_and_test_service:
tutorial: ballot
- build_and_test_service:
tutorial: message-board
build_ballot:
executor: rust
steps:
Expand Down
2 changes: 1 addition & 1 deletion ballot/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"@oasislabs/client": "^1.0.0-rc.13",
"@oasislabs/client": "^1.0.0-rc.15",
"apexcharts": "^3.8.2",
"core-js": "^3.2.1",
"oasis-style": "^1.0.0-rc1",
Expand Down
1 change: 1 addition & 0 deletions hello-world/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# hello-world

Check out our [Hello World Tutorial](https://docs.oasis.dev/quickstart.html)!
2 changes: 1 addition & 1 deletion hello-world/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"typescript": "^3.5.3"
},
"dependencies": {
"@oasislabs/client": "^1.0.0-rc.13"
"@oasislabs/client": "^1.0.0-rc.15"
},
"jest": {
"preset": "ts-jest",
Expand Down
3 changes: 3 additions & 0 deletions message-board/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# message-board

Check out our [Messaging Tutorial](https://docs.oasis.dev/tutorials/messaging.html)!
39 changes: 39 additions & 0 deletions message-board/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "message_board",
"version": "1.0.0",
"main": "dist/index.js",
"module": "dist/index.js",
"typings": "dist/index.d.ts",
"directories": {
"test": "test",
"bin": "scripts"
},
"scripts": {
"build": "tsc",
"test": "jest",
"deploy": "node scripts/deploy_service.js",
"clean": "rimraf dist",
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
"lint:fix": "npm run-script lint -- --fix"
},
"devDependencies": {
"@types/jest": "^24.0.15",
"chalk": "^2.4.2",
"jest": "^24.8.0",
"prettier": "^1.18.2",
"rimraf": "^2.6.3",
"ts-jest": "^24.0.2",
"ts-node": "^8.3.0",
"tslint": "^5.18.0",
"tslint-config-prettier": "^1.18.0",
"tslint-config-standard": "^8.0.1",
"typescript": "^3.5.3"
},
"dependencies": {
"@oasislabs/client": "^1.0.0-rc.15"
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node"
}
}
18 changes: 18 additions & 0 deletions message-board/app/scripts/deploy_service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const chalk = require('chalk');
const oasis = require('@oasislabs/client');

oasis.workspace.MessageBoard.deploy({
header: {confidential: false},
})
.then(res => {
let addrHex = Buffer.from(res._inner.address).toString('hex');
console.log(` ${chalk.green('Deployed')} MessageBoard at 0x${addrHex}`);
})
.catch(err => {
console.error(
`${chalk.red('error')}: could not deploy MessageBoard: ${err.message}`,
);
})
.finally(() => {
oasis.disconnect();
});
Empty file added message-board/app/src/index.ts
Empty file.
21 changes: 21 additions & 0 deletions message-board/app/test/service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import oasis from '@oasislabs/client';

jest.setTimeout(20000);

describe('MessageBoard', () => {
let service;

beforeAll(async () => {
service = await oasis.workspace.MessageBoard.deploy({
header: {confidential: false},
});
});

it('deployed', async () => {
expect(service).toBeTruthy();
});

afterAll(() => {
oasis.disconnect();
});
});
13 changes: 13 additions & 0 deletions message-board/app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"declaration": true,
"esModuleInterop": true,
"module": "es6",
"moduleResolution": "node",
"noImplicitAny": false,
"outDir": "./dist",
"sourceMap": true,
"strict": true
},
"include": ["src"]
}
11 changes: 11 additions & 0 deletions message-board/app/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": [
"tslint-config-standard",
"tslint-config-prettier"
],
"rules": {
"semicolon": [true, "always"],
"quotemark": [true, "single"],
"no-trailing-whitespace": true
}
}
64 changes: 64 additions & 0 deletions message-board/service/.rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
max_width = 100
hard_tabs = false
tab_spaces = 4
newline_style = "Auto"
use_small_heuristics = "Default"
indent_style = "Block"
wrap_comments = false
format_code_in_doc_comments = true
comment_width = 80
normalize_comments = false
normalize_doc_attributes = false
format_strings = false
format_macro_matchers = false
format_macro_bodies = true
empty_item_single_line = true
struct_lit_single_line = true
fn_single_line = false
where_single_line = false
imports_indent = "Block"
imports_layout = "Mixed"
merge_imports = true
reorder_imports = true
reorder_modules = true
reorder_impl_items = false
type_punctuation_density = "Wide"
space_before_colon = false
space_after_colon = true
spaces_around_ranges = false
binop_separator = "Front"
remove_nested_parens = true
combine_control_expr = true
overflow_delimited_expr = false
struct_field_align_threshold = 0
enum_discrim_align_threshold = 0
match_arm_blocks = true
force_multiline_blocks = false
fn_args_layout = "Tall"
brace_style = "SameLineWhere"
control_brace_style = "AlwaysSameLine"
trailing_semicolon = true
trailing_comma = "Vertical"
match_block_trailing_comma = false
blank_lines_upper_bound = 1
blank_lines_lower_bound = 0
edition = "2018"
version = "One"
inline_attribute_width = 0
merge_derives = true
use_try_shorthand = false
use_field_init_shorthand = false
force_explicit_abi = true
condense_wildcard_suffixes = false
color = "Auto"
unstable_features = false
disable_all_formatting = false
skip_children = false
hide_parse_errors = false
error_on_line_overflow = false
error_on_unformatted = false
report_todo = "Never"
report_fixme = "Never"
ignore = []
emit_mode = "Files"
make_backup = false
14 changes: 14 additions & 0 deletions message-board/service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "message-board"
version = "0.1.0"
authors = ["Oasis Labs <[email protected]>"]
edition = "2018"
publish = false

[dependencies]
map_vec = "0.2"
oasis-std = "0.2"
serde = { version = "1.0", features = ["derive"] }

[dev-dependencies]
oasis-test = "0.2"
Loading