Skip to content

Commit fcec2d6

Browse files
authored
Merge pull request #25 from FabianSanchezD/feat/unit-tests-propertyregistry
Feat/unit tests propertyregistry
2 parents 75c730c + 8cf657c commit fcec2d6

4 files changed

Lines changed: 947 additions & 109 deletions

File tree

.github/workflows/ci.yml

Lines changed: 59 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -20,73 +20,65 @@ jobs:
2020
- beta
2121
- nightly
2222
steps:
23-
- uses: actions/checkout@v4
24-
25-
- name: Install Rust
26-
uses: actions-rs/toolchain@v1
27-
with:
28-
profile: minimal
29-
toolchain: ${{ matrix.rust }}
30-
override: true
31-
components: rustfmt, clippy
32-
33-
- name: Cache cargo registry
34-
uses: actions/cache@v3
35-
with:
36-
path: |
37-
~/.cargo/registry
38-
~/.cargo/git
39-
target
40-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
41-
42-
- name: Add WASM target
43-
run: rustup target add wasm32-unknown-unknown
44-
45-
- name: Install cargo-contract
46-
run: cargo install cargo-contract --locked
47-
48-
- name: Check formatting
49-
run: cargo fmt --all -- --check
50-
51-
- name: Run clippy
52-
run: cargo clippy --all-targets --all-features -- -D warnings
53-
54-
- name: Run unit tests
55-
run: cargo test --all-features
56-
57-
- name: Run e2e tests
58-
run: cargo test -p propchain-tests --features e2e-tests
59-
60-
- name: Run coverage analysis
61-
run: cargo tarpaulin --all-features --workspace --out Xml --exclude-files contracts/lib/src/tests.rs tests/property_registry_tests.rs
62-
63-
- name: Upload coverage reports
64-
uses: codecov/codecov-action@v3
65-
with:
66-
file: ./cobertura.xml
67-
fail_ci_if_error: false
68-
69-
- name: Build contracts
70-
run: |
71-
cd contracts
72-
for dir in */; do
73-
if [ -f "$dir/Cargo.toml" ]; then
74-
cd "$dir"
75-
cargo contract build
76-
cd ..
77-
fi
78-
done
79-
80-
- name: Run contract tests
81-
run: |
82-
cd contracts
83-
for dir in */; do
84-
if [ -f "$dir/Cargo.toml" ]; then
85-
cd "$dir"
86-
cargo contract test
87-
cd ..
88-
fi
89-
done
23+
- uses: actions/checkout@v4
24+
25+
- name: Install Rust
26+
uses: actions-rs/toolchain@v1
27+
with:
28+
profile: minimal
29+
toolchain: ${{ matrix.rust }}
30+
override: true
31+
components: rustfmt, clippy
32+
33+
- name: Cache cargo registry
34+
uses: actions/cache@v3
35+
with:
36+
path: |
37+
~/.cargo/registry
38+
~/.cargo/git
39+
target
40+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
41+
42+
- name: Add WASM target
43+
run: rustup target add wasm32-unknown-unknown
44+
45+
- name: Install cargo-contract
46+
run: cargo install cargo-contract --locked
47+
48+
- name: Check formatting
49+
run: cargo fmt --all -- --check
50+
51+
- name: Run clippy
52+
run: cargo clippy --all-targets --all-features -- -D warnings
53+
54+
- name: Run tests
55+
run: cargo test --all-features
56+
57+
- name: Run PropertyRegistry unit tests
58+
working-directory: contracts/lib
59+
run: cargo test --lib
60+
61+
- name: Build contracts
62+
run: |
63+
cd contracts
64+
for dir in */; do
65+
if [ -f "$dir/Cargo.toml" ]; then
66+
cd "$dir"
67+
cargo contract build
68+
cd ..
69+
fi
70+
done
71+
72+
- name: Run contract tests
73+
run: |
74+
cd contracts
75+
for dir in */; do
76+
if [ -f "$dir/Cargo.toml" ]; then
77+
cd "$dir"
78+
cargo contract test
79+
cd ..
80+
fi
81+
done
9082
9183
security:
9284
name: Security Audit

.github/workflows/test.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop, master ]
6+
paths:
7+
- 'contracts/lib/**'
8+
- 'contracts/traits/**'
9+
- 'Cargo.toml'
10+
- 'Cargo.lock'
11+
pull_request:
12+
branches: [ main, develop, master ]
13+
paths:
14+
- 'contracts/lib/**'
15+
- 'contracts/traits/**'
16+
- 'Cargo.toml'
17+
- 'Cargo.lock'
18+
workflow_dispatch:
19+
20+
env:
21+
CARGO_TERM_COLOR: always
22+
23+
jobs:
24+
test:
25+
name: PropertyRegistry Unit Tests
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- uses: dtolnay/rust-toolchain@stable
31+
32+
- uses: actions/cache@v4
33+
with:
34+
path: |
35+
~/.cargo/bin/
36+
~/.cargo/registry/index/
37+
~/.cargo/registry/cache/
38+
~/.cargo/git/db/
39+
target/
40+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
41+
restore-keys: |
42+
${{ runner.os }}-cargo-
43+
44+
- name: Run PropertyRegistry unit tests
45+
working-directory: contracts/lib
46+
run: cargo test --lib

0 commit comments

Comments
 (0)