-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (121 loc) · 4.01 KB
/
ci.yml
File metadata and controls
147 lines (121 loc) · 4.01 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
---
name: CI
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true
- name: Check formatting
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Code is not formatted:"
gofmt -l .
exit 1
fi
- name: Run go vet
run: go vet ./...
build:
name: Build Check
runs-on: ubuntu-latest
needs: [lint]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true
- name: Build
run: |
CGO_ENABLED=0 go build -o sekai-cli ./cmd/sekai-cli
./sekai-cli --help
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
needs: [lint]
env:
CONTAINER: sekin-sekai-1
CHAIN_ID: testnet-1
SEKAI_CONTAINER: sekin-sekai-1
SEKAI_CHAIN_ID: testnet-1
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true
- name: Build sekai-cli
run: CGO_ENABLED=0 go build -o sekai-cli ./cmd/sekai-cli
- name: Clone sekin repository
run: git clone --depth 1 https://github.com/kiracore/sekin.git /tmp/sekin
- name: Start SEKAI infrastructure
run: |
cd /tmp/sekin
docker compose up -d sekai syslog-ng
echo "Waiting for containers to start..."
sleep 10
docker ps
- name: Initialize SEKAI network
run: |
# Run the spin-local-testnet script steps (except start which blocks)
echo ">>> Step 1: Initialize sekaid"
docker exec ${CONTAINER} /scaller init --chain-id "${CHAIN_ID}" --moniker "CI-Node"
echo ">>> Step 2: Add genesis key"
docker exec ${CONTAINER} /scaller keys-add --name genesis
echo ">>> Step 3: Add genesis account"
docker exec ${CONTAINER} /scaller add-genesis-account --name genesis --coins 300000000000000ukex
echo ">>> Step 4: Claim validator role"
docker exec ${CONTAINER} /scaller gentx-claim --name genesis --moniker "CI-Validator"
echo ">>> Step 5: Start sekaid (background with auto-restart)"
docker exec -d ${CONTAINER} /scaller start --restart always
echo "Waiting for node to start producing blocks..."
sleep 30
- name: Wait for chain to be ready
run: |
echo "Checking chain status..."
for i in {1..30}; do
if docker exec ${CONTAINER} /sekaid status 2>/dev/null | grep -q '"catching_up":false'; then
echo "Chain is ready and synced!"
docker exec ${CONTAINER} /sekaid status
exit 0
fi
echo "Attempt $i/30: Chain not ready yet, waiting..."
sleep 5
done
echo "Chain did not become ready in time"
docker exec ${CONTAINER} /sekaid status || true
exit 1
- name: Run sekai-cli status check
run: ./sekai-cli status
- name: Run scenario-based integration test
run: ./sekai-cli scenario run examples/scenarios/ci-integration-test.yaml
- name: Run Go integration tests
run: go test -v -timeout 30m -p 1 ./test/integration/...
- name: Collect logs on failure
if: failure()
run: |
echo "=== Docker containers ==="
docker ps -a
echo "=== SEKAI container logs ==="
docker logs ${CONTAINER} 2>&1 | tail -200 || true
echo "=== Syslog logs ==="
docker logs sekin-syslog-ng-1 2>&1 | tail -100 || true
- name: Cleanup
if: always()
run: |
cd /tmp/sekin
docker compose down -v || true