Skip to content

Commit

Permalink
test(github action): integity test
Browse files Browse the repository at this point in the history
  • Loading branch information
ActivePeter committed Mar 7, 2024
1 parent 301afaa commit 3e7ac61
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 7 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ jobs:
run: sudo bash scripts/install/install_python_and_ansible.sh

- name: Install build
run: sudo bash scripts/install/run_ans_install_build.sh
run: ansible-playbook -vvv scripts/install/ans_install_build.yml -i scripts/local_ansible_conf.ini

- name: Build Locally
run: bash scripts/deploy_single_node/run_ans_build.sh
run: ansible-playbook -vvv scripts/deploy_single_node/ans_build.yml -i scripts/local_ansible_conf.ini

- name: Integirty Test
run: ansible-playbook -vvv scripts/ans_integity_test.yml -i scripts/local_ansible_conf.ini

- name: Build WasmEdge Image
run: bash scripts/docker/WasmEdge/build_image.sh

- name: Build Waverless Image
run: bash scripts/docker/Waverless/build_image.sh



17 changes: 17 additions & 0 deletions apps/_wasm_serverless_lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,23 @@ impl KvBatch {
// }
// }

#[cfg(feature = "test")]
pub struct HostFile;

#[cfg(feature = "test")]
impl HostFile {
pub fn open(fname: &str) -> Self {
tracing::warn!("test HostFile open not implemented");
Self
}

// data will be append to `buf` until the file is read to the end or `buf` is full to capacity
pub fn read_at(&self, offset: usize, buf: &mut Vec<u8>) -> usize {
tracing::warn!("test HostFile read_at not implemented");
0
}
}

#[cfg(not(feature = "test"))]
pub struct HostFile {
fd: i32,
Expand Down
17 changes: 17 additions & 0 deletions scripts/ans_integity_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- hosts: localhost
tasks:
- name: Build the application on the master node
become: yes
shell: |
cat > /tmp/cargotest.sh <<'END'
#!/bin/bash
echo $PATH
export PATH="/root/.cargo/bin/:$PATH"
export PATH="/root/.wasmedge/bin/:$PATH"
cargo test --workspace
END
bash /tmp/cargotest.sh
rm -f /tmp/cargotest.sh
14 changes: 13 additions & 1 deletion scripts/build/_ans_build_demo_apps_each.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
- name: Build the WASM demo
shell: cargo build --target wasm32-wasi --release
become: yes
shell: |
cat > /tmp/compile.sh <<'END'
#!/bin/bash
echo $PATH
export PATH="/root/.cargo/bin/:$PATH"
export PATH="/root/.wasmedge/bin/:$PATH"
cargo build --target wasm32-wasi --release
END
bash /tmp/compile.sh
rm -f /tmp/compile.sh
args:
chdir: ../../apps/{{ item }}
- name: Mkdir
Expand Down
16 changes: 14 additions & 2 deletions scripts/deploy_single_node/ans_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@
- hosts: localhost
tasks:
- name: Build the application on the master node
shell: cargo build --release
become: yes
shell: |
cat > /tmp/compile.sh <<'END'
#!/bin/bash
echo $PATH
export PATH="/root/.cargo/bin/:$PATH"
export PATH="/root/.wasmedge/bin/:$PATH"
cargo build --release
END
bash /tmp/compile.sh
rm -f /tmp/compile.sh
- name: Run build ansible script
shell: ansible-playbook -i local_ansible_conf.ini build/ans_build_demo_apps.yml
shell: ansible-playbook -vvv build/ans_build_demo_apps.yml -i local_ansible_conf.ini
args:
chdir: ../
# mkdir -p scripts/deploy_single_node/test_dir/files
Expand Down
18 changes: 18 additions & 0 deletions scripts/install/_ans_install_wasmedge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,21 @@
args:
chdir: "../.."
creates: "/usr/local/bin/wasmedge" # Skip if WasmEdge is already installed

- name: Debug WasmEdge version
become: true
shell: |
cat > /tmp/debug_wasmedge.sh <<'END'
#!/bin/bash
ls /root/.wasmedge/bin/
export PATH="/root/.wasmedge/bin/":$PATH
# source ~/.bashrc
whereis wasmedge
wasmedge --version
END
bash /tmp/debug_wasmedge.sh
rm -f /tmp/debug_wasmedge.sh
6 changes: 4 additions & 2 deletions scripts/install/inner/wasm_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -1622,9 +1622,11 @@ def main(args):
wasmedge_output = run_shell_command(
". {0}/env && {0}/bin/wasmedge --version".format(args.path)
)

if args.version in wasmedge_output:
logging.info("WasmEdge Successfully installed")
ls_dir=run_shell_command(f"ls {args.path}/bin")
logging.info(f"ls install dir: {ls_dir}")
logging.info(f"WasmEdge Successfully installed at: {args.path}/bin/wasmedge")
else:
logging.critical(
"WasmEdge installation incorrect: {0}".format(wasmedge_output)
Expand Down

0 comments on commit 3e7ac61

Please sign in to comment.