Merge pull request #2005 from AleoHQ/test-examples

Run examples in circleci
This commit is contained in:
Collin Chin 2022-08-08 15:54:19 -07:00 committed by GitHub
commit 5562132a81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 46 deletions

View File

@ -40,8 +40,6 @@ commands:
paths:
- .cache/sccache
- .cargo
# orbs:
# codecov: codecov/codecov@1.2.3
jobs:
check-style:
@ -76,48 +74,6 @@ jobs:
cargo +nightly clippy --workspace --all-targets --all-features -- -D warnings
- clear_environment:
cache_key: leo-clippy-cache
# code-cov:
# docker:
# - image: cimg/rust:1.62
# resource_class: xlarge
# environment:
# RUSTC_BOOTSTRAP: 1
# steps:
# - checkout
# - setup_environment:
# cache_key: leo-codecov-cache
# - run:
# name: Build and run tests
# no_output_timeout: 30m
# command: cargo test --all
# - run:
# name: Install Code Cov Deps
# no_output_timeout: 30m
# command: |
# sudo apt-get update
# sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
# - run:
# name: Generate Coverage Report
# no_output_timeout: 30m
# command: |
# wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
# tar xzf master.tar.gz
# cd kcov-master
# mkdir build && cd build
# cmake .. && make
# make install DESTDIR=../../kcov-build
# cd ../..
# rm -rf kcov-master
# for file in target/debug/deps/*-*; do if [[ "$file" != *\.* ]]; then mkdir -p "target/cov/$(basename $file)"; ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --exclude-region='@kcov_skip(start):@kcov_skip(end)' --verify "target/cov/$(basename $file)" "$file"; fi done
# steps:
# - codecov/upload:
# file: {{}}
# - persist_to_workspace:
# root: ~/
# paths: project/
# - clear_environment:
# cache_key: leo-codecov-cache
leo-executable:
docker:
@ -133,7 +89,8 @@ jobs:
command: cargo install --path . --root . --locked
- persist_to_workspace:
root: ~/
paths: project/
paths:
- project/
- clear_environment:
cache_key: leo-executable-cache
@ -163,6 +120,19 @@ jobs:
export LEO=/home/circleci/project/project/bin/leo
./project/.circleci/leo-clean.sh
test-examples:
docker:
- image: cimg/rust:1.62
resource_class: xlarge
steps:
- attach_workspace:
at: /home/circleci/project/
- run:
name: test examples example
command: |
export LEO=/home/circleci/project/project/bin/leo
./project/.circleci/test-examples.sh
workflows:
version: 2
main-workflow:
@ -176,3 +146,6 @@ workflows:
- leo-clean:
requires:
- leo-executable
- test-examples:
requires:
- leo-executable

View File

@ -3,5 +3,5 @@ $LEO new foo
ls -la
cd foo && ls -la
# Try to run `leo build`.
# Try to run `leo run`.
$LEO run

46
.circleci/test-examples.sh Executable file
View File

@ -0,0 +1,46 @@
# Build and run the helloworld Leo program.
(
cd ./project/examples/helloworld || exit
$LEO run main
)
# Build and run the bubblesort Leo program.
(
cd ./project/examples/bubblesort || exit
$LEO run bubblesort
)
# Build and run the core example Leo program.
(
cd ./project/examples/core || exit
$LEO run main
)
# Build and run the groups example Leo program.
(
cd ./project/examples/groups || exit
$LEO run main
)
# Build and run the import point example Leo program.
(
cd ./project/examples/import_point || exit
$LEO run main
)
# Build and run the message example Leo program.
(
cd ./project/examples/message || exit
$LEO run main
)
# Build and run the token example programs.
(
cd ./project/examples/token || exit
# Run the mint program.
$LEO run mint
# Run the transfer program.
$LEO run transfer
)