-
Notifications
You must be signed in to change notification settings - Fork 11
74 lines (71 loc) · 2.56 KB
/
build.yml
File metadata and controls
74 lines (71 loc) · 2.56 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
name: Build Project and Run Tests
on:
push:
branches: ["main"]
pull_request:
env:
CARGO_TERM_COLOR: always
PKG_CONFIG_PATH: /usr/lib/pkgconfig
PUBLIC_STELLAR_NETWORK: local
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
runner/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "npm"
# Add the wasm32v1-none target for building contracts
- run: rustup target add wasm32v1-none
- run:
sudo apt-get update && sudo apt-get install -y libudev-dev
libdbus-1-dev pkg-config
# Install binstall to quickly install stellar-scaffold-cli
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main
# Check for stellar-scaffold-cli binary and install if not present
- name: Check for stellar-scaffold binary
run: |
if ! command -v stellar-scaffold &> /dev/null; then
echo "stellar-scaffold not found, installing..."
cargo install --git https://github.com/theahaco/scaffold-stellar stellar-scaffold-cli --rev cde0d2588492a4cc37c6c90b2570c07e8032b4b6 --locked
else
echo "stellar-scaffold already installed. Clear cache to force reinstall."
fi
echo "Scaffold Version:"
stellar-scaffold version
- run: npm ci
- run: npm run lint
- run: npx prettier . --check
- name: Build with Scaffold and build client packages
run:
STELLAR_SCAFFOLD_ENV=development stellar-scaffold build
--build-clients 2>&1 | tee build_clients.log
- name: Check client generation summary
run: |
# Extract the number after "Failed: "
FAILED=$(grep -Eo "Failed: [0-9]+" build_clients.log | awk '{print $2}')
if [ -z "$FAILED" ]; then
echo "Could not find 'Failed: N' in build_clients.log, all clients succeeded."
exit 0
fi
if [ "$FAILED" -gt 0 ]; then
echo "Client generation summary check failed: Failed: $FAILED"
echo "Check the \"Build with Scaffold\" step logs."
exit 1
fi
- run: npm run install:contracts
- run: npm run build
- name: Run tests
run: npm test --if-present