Skip to content

Commit 5915840

Browse files
committed
Add github workflow
1 parent 80b8134 commit 5915840

4 files changed

Lines changed: 184 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches: [e2e]
6+
pull_request:
7+
branches: [e2e]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v4
19+
with:
20+
go-version: "1.23"
21+
22+
- name: Cache Go modules
23+
uses: actions/cache@v3
24+
with:
25+
path: |
26+
~/.cache/go-build
27+
~/go/pkg/mod
28+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
29+
restore-keys: |
30+
${{ runner.os }}-go-
31+
32+
- name: Install dependencies
33+
run: go mod download
34+
35+
- name: Run unit tests
36+
run: go test -v -race -coverprofile=coverage.out ./...
37+
38+
- name: Upload coverage to Codecov
39+
uses: codecov/codecov-action@v4
40+
with:
41+
file: ./coverage.out
42+
flags: unittests
43+
name: codecov-umbrella
44+
45+
lint:
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
52+
- name: Set up Go
53+
uses: actions/setup-go@v4
54+
with:
55+
go-version: "1.23"
56+
57+
- name: Run golangci-lint
58+
uses: golangci/golangci-lint-action@v3
59+
with:
60+
version: latest
61+
args: --timeout=5m
62+
63+
build:
64+
runs-on: ubuntu-latest
65+
needs: [test, lint]
66+
67+
steps:
68+
- name: Checkout code
69+
uses: actions/checkout@v4
70+
71+
- name: Set up Go
72+
uses: actions/setup-go@v4
73+
with:
74+
go-version: "1.23"
75+
76+
- name: Cache Go modules
77+
uses: actions/cache@v3
78+
with:
79+
path: |
80+
~/.cache/go-build
81+
~/go/pkg/mod
82+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
83+
restore-keys: |
84+
${{ runner.os }}-go-
85+
86+
- name: Build mpcium
87+
run: go build -v ./cmd/mpcium
88+
89+
- name: Build mpcium-cli
90+
run: go build -v ./cmd/mpcium-cli

.github/workflows/e2e-tests.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: E2E Integration Tests
2+
3+
on:
4+
push:
5+
branches: [e2e]
6+
pull_request:
7+
branches: [e2e]
8+
9+
jobs:
10+
e2e-tests:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v4
19+
with:
20+
go-version: "1.23"
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
25+
- name: Verify Docker Compose
26+
run: |
27+
docker --version
28+
docker compose version
29+
30+
- name: Cache Go modules
31+
uses: actions/cache@v3
32+
with:
33+
path: |
34+
~/.cache/go-build
35+
~/go/pkg/mod
36+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
37+
restore-keys: |
38+
${{ runner.os }}-go-
39+
40+
- name: Install dependencies
41+
run: |
42+
go mod download
43+
cd e2e && go mod download
44+
45+
- name: Build mpcium binary
46+
run: |
47+
go build -o mpcium ./cmd/mpcium
48+
49+
- name: Build mpcium-cli binary
50+
run: |
51+
go build -o mpcium-cli ./cmd/mpcium-cli
52+
53+
- name: Make binaries executable and add to PATH
54+
run: |
55+
chmod +x mpcium mpcium-cli
56+
sudo mv mpcium /usr/local/bin/
57+
sudo mv mpcium-cli /usr/local/bin/
58+
59+
- name: Verify binaries are available
60+
run: |
61+
which mpcium
62+
which mpcium-cli
63+
mpcium --version || echo "mpcium binary ready"
64+
mpcium-cli --version || echo "mpcium-cli binary ready"
65+
66+
- name: Run E2E tests
67+
run: |
68+
cd e2e
69+
go test -v -timeout=600s -run TestKeyGeneration
70+
env:
71+
DOCKER_BUILDKIT: 1
72+
73+
- name: Cleanup Docker containers
74+
if: always()
75+
run: |
76+
cd e2e
77+
docker compose -f docker-compose.test.yaml down -v || true
78+
docker system prune -f || true
79+
80+
- name: Upload test logs
81+
if: failure()
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: e2e-test-logs
85+
path: e2e/logs/
86+
retention-days: 7
87+

e2e/config.test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
badger_password: yx,qYwu*h!RZ{Q7f;70gU/VT.9kBOFCM
1+
badger_password: +TQ_=Iz^$R&G#2^PZ_3ojE+]2D6~\6$y
22
consul:
33
address: localhost:8501
44
db_path: ./test_db
55
environment: development
6-
event_initiator_pubkey: bc2e465f11317616b3ac5ae1a91473224b9b00b97ebf921928ac6478df608a00
7-
max_concurrent_keygen: 2
6+
event_initiator_pubkey: e42a14842c197a08af77e56b9fb8fae2e50316c3e51b51e14e6a7bf17c1ef77d
7+
max_concurrent_keygen: 1
88
mpc_threshold: 2
99
mpcium_version: 1.0.0
1010
nats:

e2e/keygen_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727

2828
const (
2929
numNodes = 3
30-
keygenTimeout = 120 * time.Second
30+
keygenTimeout = 200 * time.Second
3131
)
3232

3333
type TestConfig struct {
@@ -441,9 +441,9 @@ func (s *E2ETestSuite) testKeyGeneration(t *testing.T) {
441441
// Wait for all nodes to be ready before proceeding
442442
s.waitForNodesReady(t)
443443

444-
// Generate 3 wallet IDs for testing
445-
walletIDs := make([]string, 3)
446-
for i := 0; i < 3; i++ {
444+
// Generate 1 wallet IDs for testing
445+
walletIDs := make([]string, 1)
446+
for i := 0; i < 1; i++ {
447447
walletIDs[i] = uuid.New().String()
448448
s.walletIDs = append(s.walletIDs, walletIDs[i])
449449
}

0 commit comments

Comments
 (0)