Repository navigation
Expand file tree
/
Copy pathJustfile
More file actions
133 lines (110 loc) · 5.36 KB
/
Copy pathJustfile
File metadata and controls
133 lines (110 loc) · 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Default: show available recipes
default:
just --list
# Coverage exclusion regex (mockery-generated files), aligned with chainlink-ccv Justfile
COVERAGE_EXCLUDE_REGEX := '(/mock_.*\\.go:|/_mocks/.*:|/mocks/.*:)'
# Host target triple (needed to override .cargo/config.toml wasm target for tests)
host_target := `rustc -vV | grep host | awk '{print $2}'`
mod data_feeds 'contracts/data-feeds/Justfile'
# Run all Soroban contract tests
test-contracts:
cargo test --workspace --target {{host_target}} --verbose
just data_feeds test
# Check all contracts compile (faster than full test)
check-contracts:
cargo check --workspace --target {{host_target}}
just data_feeds check
# Build all contract WASMs
build-contracts:
stellar contract build
just data_feeds build
# Rebuild the embedded CRE contract WASM committed under deployment/cre/artifacts/
# (served to Go consumers via deployment/cre.Artifact). CI fails if out of sync.
# Always builds in a pinned linux/amd64 docker container (bytes are
# host-platform-dependent, so there is exactly one canonical environment).
update-cre-artifacts:
./scripts/update_cre_artifacts.sh
# Format all Rust code
fmt-contracts:
cargo fmt --all
just data_feeds fmt
# Check Rust formatting (CI mode, no changes)
fmt-contracts-check:
cargo fmt --all -- --check
just data_feeds fmt-check
# Run contract linters
lint-contracts:
just data_feeds lint
# Run Go unit tests (root production module) with coverage; optional second arg "short" runs -short tests only.
# The /tests directory is a separate Go module (tests/go.mod), so `go list ./...` from the root
# already excludes it; e2e/integration tests live there and are run via `just test-go-tests`.
# Writes filtered coverprofile to coverage_file (strips mock files matching COVERAGE_EXCLUDE_REGEX).
test-coverage coverage_file="coverage.out" short="":
#!/usr/bin/env bash
set -euo pipefail
pkgs=$(go list ./...)
go test -v -race -fullpath -shuffle on {{ if short != "" { "-short" } else { "" } }} -coverprofile={{ coverage_file }} $pkgs
{ head -n1 {{ coverage_file }}; tail -n +2 {{ coverage_file }} | grep -v -E '{{ COVERAGE_EXCLUDE_REGEX }}' || true; } > {{ coverage_file }}.filtered
mv {{ coverage_file }}.filtered {{ coverage_file }}
# Run Go unit tests (root production module) with coverage.
# The /tests directory is a separate Go module, so this covers production code only.
# Run e2e tests with: cd tests && go test -v -timeout 10m ./e2e/...
test-go:
#!/usr/bin/env bash
set -euo pipefail
pkgs=$(go list ./...)
go test -v -race -fullpath -shuffle on -coverprofile=coverage.out $pkgs
go tool cover -func=coverage.out
# Run Go unit tests (tests module) with coverage; excludes ./e2e (requires a running devenv).
test-go-tests:
#!/usr/bin/env bash
set -euo pipefail
cd tests
pkgs=$(go list ./... | grep -v '/e2e' || true)
go test -v -race -fullpath -shuffle on -coverprofile=coverage-tests.out $pkgs
go tool cover -func=coverage-tests.out
# Run Go unit tests (bindings module) with coverage
test-go-bindings:
cd bindings && go test -v -race -fullpath -shuffle on -coverprofile=coverage-bindings.out ./...
cd bindings && go tool cover -func=coverage-bindings.out
# Run Go unit tests (deployment module) with coverage
test-go-deployment:
cd deployment && go test -v -race -fullpath -shuffle on -coverprofile=coverage-deployment.out ./...
cd deployment && go tool cover -func=coverage-deployment.out
# Run Go unit tests (relayer module) with coverage
test-go-relayer:
cd relayer && go test -v -race -fullpath -shuffle on -coverprofile=coverage-relayer.out ./...
cd relayer && go tool cover -func=coverage-relayer.out
# Run Go unit tests (ccv module) with coverage
# ccv/ is its own Go module (github.com/smartcontractkit/chainlink-stellar/ccv): the
# Stellar CCV adapter (accessors, source/destination readers, contract transmitter).
# Its tests reach relayer/mocks via a local replace on the relayer submodule.
test-go-ccv:
cd ccv && go test -v -race -fullpath -shuffle on -coverprofile=coverage-ccv.out ./...
cd ccv && go tool cover -func=coverage-ccv.out
# Run Go unit tests (capabilities module) with coverage
# capabilities/ is its own small Go module: FakeStellarChain for `cre workflow simulate`.
test-go-capabilities:
cd capabilities && go test -v -race -fullpath -shuffle on -coverprofile=coverage-capabilities.out ./...
cd capabilities && go tool cover -func=coverage-capabilities.out
# Run all Go unit tests
test-go-all: test-go test-go-tests test-go-bindings test-go-deployment test-go-relayer test-go-ccv test-go-capabilities
# Run Go integration tests (requires running Stellar localnet)
test-go-integration:
cd tests && go test -tags integration -v -timeout 20m ./integration/...
# Generate mocks using mockery (mocks live in the relayer module under ./mocks)
mock:
@echo "Cleaning existing mocks..."
cd relayer && find ./mocks -type f -name 'mock_*.go' -delete 2>/dev/null || true
@echo "Generating mocks with mockery..."
cd relayer && mockery
# Run all tests (contracts + Go)
test-all: test-contracts test-go-all
# Full pipeline: build WASM, make generate-interfaces + generate-bindings, fmt, lint, test-all
all: build-contracts
make generate-interfaces
make generate-bindings
just fmt-contracts
just lint-contracts
just test-all
just update-cre-artifacts