-
Notifications
You must be signed in to change notification settings - Fork 20
185 lines (153 loc) · 4.98 KB
/
ci.yml
File metadata and controls
185 lines (153 loc) · 4.98 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Soroban CI
on:
push:
branches:
- main
- develop
paths:
- "soroban-client/**"
- "soroban-contract/**"
- ".github/workflows/**"
pull_request:
branches:
- main
- develop
paths:
- "soroban-client/**"
- "soroban-contract/**"
jobs:
client:
name: Next.js Client CI
runs-on: ubuntu-latest
defaults:
run:
working-directory: soroban-client
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Cache node modules
uses: actions/cache@v4
with:
path: soroban-client/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('soroban-client/package-lock.json', 'soroban-client/yarn.lock', 'soroban-client/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: |
if [ -f package-lock.json ]; then
npm ci
elif [ -f yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -f pnpm-lock.yaml ]; then
npm install -g pnpm && pnpm install --frozen-lockfile
else
npm install
fi
- name: Run linter
run: npm run lint --if-present
continue-on-error: true
- name: Build client
run: npm run build
env:
CI: true
# Add any required env vars for Next.js build
# NEXT_PUBLIC_STELLAR_NETWORK: testnet
- name: Run tests
run: npm test -- --passWithNoTests
if: hashFiles('soroban-client/package.json') != ''
soroban:
name: Soroban Contracts CI
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache target directory
uses: actions/cache@v4
with:
path: soroban-contract/target
key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-target-
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev pkg-config libudev-dev
- name: Install Soroban CLI
run: |
cargo install --locked soroban-cli --features opt || \
cargo install --locked soroban-cli
- name: Check contract formatting
working-directory: soroban-contract
run: cargo fmt --all -- --check
continue-on-error: true
- name: Build contracts
working-directory: soroban-contract
run: |
cargo build --release --target wasm32-unknown-unknown -p ticket_nft
cargo build --release --target wasm32-unknown-unknown -p tba_account
soroban contract build
- name: Optimize contracts
working-directory: soroban-contract
run: soroban contract optimize --wasm target/wasm32-unknown-unknown/release/*.wasm
continue-on-error: true
- name: Run clippy
working-directory: soroban-contract
run: cargo clippy --all-targets -- -D warnings
continue-on-error: true
- name: Run contract tests
working-directory: soroban-contract
run: cargo test --workspace
integration:
name: Integration Tests
runs-on: ubuntu-latest
needs: [client, soroban]
if: github.event_name == 'pull_request'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev pkg-config
- name: Install Soroban CLI
run: cargo install --locked soroban-cli
- name: Install client dependencies
working-directory: soroban-client
run: npm ci 2>/dev/null || npm install
- name: Build contracts
working-directory: soroban-contract
run: soroban contract build
- name: Run integration tests
working-directory: soroban-client
run: npm run test:integration --if-present
continue-on-error: true