Ver Fonte

Run examples in CI

armaniferrante há 4 anos atrás
pai
commit
4792d1ce49

+ 21 - 2
.travis.yml

@@ -1,3 +1,4 @@
+dist: bionic
 language: rust
 rust:
   - stable
@@ -10,17 +11,35 @@ _defaults: &defaults
   - rustup component add rustfmt
   - nvm install $NODE_VERSION
 
+_examples: &examples
+  before_install:
+  - nvm install $NODE_VERSION
+  - npm install -g mocha
+  - npm install -g @project-serum/anchor
+  - sudo apt-get install -y pkg-config build-essential libudev-dev
+  - sh -c "$(curl -sSfL https://release.solana.com/v1.5.0/install)"
+  - export PATH="/home/travis/.local/share/solana/install/active_release/bin:$PATH"
+  - export NODE_PATH="/home/travis/.nvm/versions/node/v$NODE_VERSION/lib/node_modules/:$NODE_PATH"
+  - yes | solana-keygen new
+  - cargo install --git https://github.com/project-serum/anchor anchor-cli
+
 jobs:
   include:
     - <<: *defaults
-      name: Build and Test Rust
+      name: Build and test Rust
       script:
         - cargo build
         - cargo fmt -- --check
         - cargo test
     - <<: *defaults
-      name: Build and Test TypeScript
+      name: Build and test TypeScript
       script:
         - cd ts
         - yarn
         - yarn build
+    - <<: *examples
+      name: Runs the examples
+      script:
+        - pushd examples/tutorial/basic-0 && anchor test && popd
+        - pushd examples/tutorial/basic-1 && anchor test && popd
+        - pushd examples/tutorial/basic-2 && anchor test && popd

+ 1 - 4
cli/src/main.rs

@@ -367,10 +367,7 @@ fn deploy_ws(url: &str, keypair: &str) -> Result<Vec<(Program, Pubkey)>> {
     let mut programs = vec![];
     println!("Deploying workspace to {}...", url);
     for program in read_all_programs()? {
-        let binary_path = format!(
-            "target/bpfel-unknown-unknown/release/{}.so",
-            program.lib_name
-        );
+        let binary_path = format!("target/deploy/{}.so", program.lib_name);
         println!("Deploying {}...", binary_path);
         let exit = std::process::Command::new("solana")
             .arg("deploy")

+ 6 - 0
docs/src/getting-started/installation.md

@@ -37,6 +37,12 @@ For now, we can use Cargo to install the CLI.
 cargo install --git https://github.com/project-serum/anchor anchor-cli
 ```
 
+On Linux systems you may need to install additional dependencies. On Ubuntu,
+
+```bash
+sudo apt-get install -y pkg-config build-essential libudev-dev
+```
+
 To install the JavaScript package.
 
 ```bash

+ 1 - 1
examples/tutorial/basic-1/Anchor.toml

@@ -1,2 +1,2 @@
 cluster = "localnet"
-wallet = "/home/armaniferrante/.config/solana/id.json"
+wallet = "~/.config/solana/id.json"

+ 1 - 1
examples/tutorial/basic-2/Anchor.toml

@@ -1,2 +1,2 @@
 cluster = "localnet"
-wallet = "/home/armaniferrante/.config/solana/id.json"
+wallet = "~/.config/solana/id.json"