Skip to content

Commit

Permalink
Add gitpod config (stellar#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch authored Oct 21, 2022
1 parent 88cb7b0 commit d58801d
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
/.sccache
24 changes: 24 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM gitpod/workspace-full:2022-10-17-21-33-26

RUN mkdir -p ~/.local/bin
RUN curl -L https://github.com/stellar/soroban-cli/releases/download/v0.1.2/soroban-cli-0.1.2-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/.local/bin soroban
RUN curl -L https://github.com/mozilla/sccache/releases/download/v0.3.0/sccache-v0.3.0-x86_64-unknown-linux-musl.tar.gz | tar xz --strip-components 1 -C ~/.local/bin sccache-v0.3.0-x86_64-unknown-linux-musl/sccache
RUN chmod +x ~/.local/bin/sccache
RUN curl -L https://github.com/taiki-e/cargo-hack/releases/download/v0.5.21/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xz -C ~/.local/bin cargo-hack
RUN curl -L https://github.com/watchexec/cargo-watch/releases/download/v8.1.2/cargo-watch-v8.1.2-x86_64-unknown-linux-gnu.tar.xz | tar xJ --strip-components 1 -C ~/.local/bin cargo-watch-v8.1.2-x86_64-unknown-linux-gnu/cargo-watch

ENV RUSTC_WRAPPER=sccache
ENV SCCACHE_CACHE_SIZE=5G
ENV SCCACHE_DIR=/workspace/.sccache

RUN rustup install stable
RUN rustup target add --toolchain stable wasm32-unknown-unknown
RUN rustup component add --toolchain stable rust-src
RUN rustup install nightly
RUN rustup target add --toolchain nightly wasm32-unknown-unknown
RUN rustup component add --toolchain nightly rust-src
RUN rustup default stable

RUN sudo apt-get update && sudo apt-get install -y binaryen

# RUN docker pull stellar/quickstart:soroban-dev
23 changes: 23 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
image:
file: .gitpod.Dockerfile

tasks:
- init: |
cargo fetch
make build test
command: |
code increment/src/lib.rs
make build test
soroban invoke --id 1 --wasm target/wasm32-unknown-unknown/release/soroban_increment_contract.wasm --fn increment
vscode:
extensions:
- matklad.rust-analyzer
- vadimcn.vscode-lldb

github:
prebuilds:
addBadge: true
addComment: true
pullRequests: true
pullRequestsFromForks: true
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
// These settings exist to support the gitpod configuration.
"workbench.startupEditor": "none",
"rust-analyzer.cargo.useRustcWrapperForBuildScripts": false,
}
16 changes: 6 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
default: build-normal
default: build

all: build test

export RUSTFLAGS=-Dwarnings

test: build-normal
cargo hack --feature-powerset test

test-optimized: build-optimized
test: build
cargo hack --feature-powerset test

build: build-normal build-optimized

build-normal:
build:
cargo build --target wasm32-unknown-unknown --release -p soroban-token-contract
cargo build --target wasm32-unknown-unknown --release -p soroban-liquidity-pool-contract
cargo build --target wasm32-unknown-unknown --release -p soroban-single-offer-contract
Expand All @@ -22,6 +15,9 @@ build-normal:
ls -l "$$i"; \
done

test-optimized: build-optimized
cargo hack --feature-powerset test

build-optimized:
cargo +nightly build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort -p soroban-token-contract
cargo +nightly build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort -p soroban-liquidity-pool-contract
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# soroban-examples

Example contracts for Soroban
Example contracts for Soroban.

WARNING: These implementations have not been tested or audited. They are likely to
have significant errors and security vulnerabilities. They should not be relied
on for any purpose.
Follow along at https://soroban.stellar.org/docs/examples.

Open a development environment on GitPod:
https://gitpod.io/#https://github.com/stellar/soroban-examples

WARNING: These implementations have not been tested or audited. They are likely
to have significant errors and security vulnerabilities. They should not be
relied on for any purpose.

0 comments on commit d58801d

Please sign in to comment.