forked from golemcloud/golem
-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (151 loc) · 5.54 KB
/
python-api-client-tests.yaml
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
name: Python API Client Tests
on:
push:
paths:
- 'tests/api_client_test.py'
- 'tests/requirements.txt'
- '.github/workflows/python-api-client-tests.yaml'
- 'golem-worker-service-base/src/gateway_api_definition/http/**'
pull_request:
paths:
- 'tests/api_client_test.py'
- 'tests/requirements.txt'
- '.github/workflows/python-api-client-tests.yaml'
- 'golem-worker-service-base/src/gateway_api_definition/http/**'
env:
CARGO_TERM_COLOR: always
RUST_LOG: debug
RUST_PORT: 8001
PROTOC_VERSION: 21.12
# Database Configuration
POSTGRES_DB: golem_db
POSTGRES_USER: golem_user
POSTGRES_PASSWORD: golem_password
POSTGRES_PORT: 5432
# Redis Configuration
REDIS_PORT: 6379
REDIS_URL: redis://localhost:6379
# Golem Service Ports
GOLEM_ROUTER_PORT: 8001
WORKER_SERVICE_HTTP_PORT: 8002
WORKER_SERVICE_GRPC_PORT: 8003
WORKER_SERVICE_CUSTOM_REQUEST_PORT: 8004
COMPONENT_SERVICE_HTTP_PORT: 8005
COMPONENT_SERVICE_GRPC_PORT: 8006
SHARD_MANAGER_HTTP_PORT: 8007
SHARD_MANAGER_GRPC_PORT: 8008
COMPONENT_COMPILATION_SERVICE_HTTP_PORT: 8009
COMPONENT_COMPILATION_SERVICE_GRPC_PORT: 8010
WORKER_EXECUTOR_HTTP_PORT: 8011
WORKER_EXECUTOR_GRPC_PORT: 8012
# Additional Golem Configuration
GOLEM_ROUTER_COMPONENT_MAX_SIZE_ALLOWED: 10485760
ENVIRONMENT: local
jobs:
python-api-tests:
name: Run Python API Client Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: golem_db
POSTGRES_USER: golem_user
POSTGRES_PASSWORD: golem_password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Protocol Buffers Compiler
run: |
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO $PB_REL/download/v${{ env.PROTOC_VERSION }}/protoc-${{ env.PROTOC_VERSION }}-linux-x86_64.zip
unzip protoc-${{ env.PROTOC_VERSION }}-linux-x86_64.zip -d $HOME/.local
echo "$HOME/.local/bin" >> $GITHUB_PATH
protoc --version
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
source "$HOME/.cargo/env"
rustup install stable
rustup default stable
rustup component add rustfmt clippy
cargo --version
rustc --version
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "python-api-tests"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements.txt
- name: Build Golem CLI
run: |
cargo build --bin golem-cli
- name: Initialize Golem Configuration
env:
GOLEM_INIT_MODE: postgres
GOLEM_NON_INTERACTIVE: "true"
run: |
# Create .env file with custom configuration
cat << EOF > .env
GOLEM_ROUTER_PORT=${{ env.GOLEM_ROUTER_PORT }}
POSTGRES_DB=${{ env.POSTGRES_DB }}
POSTGRES_USER=${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD=${{ env.POSTGRES_PASSWORD }}
POSTGRES_PORT=${{ env.POSTGRES_PORT }}
REDIS_PORT=${{ env.REDIS_PORT }}
REDIS_URL=${{ env.REDIS_URL }}
WORKER_SERVICE_HTTP_PORT=${{ env.WORKER_SERVICE_HTTP_PORT }}
WORKER_SERVICE_GRPC_PORT=${{ env.WORKER_SERVICE_GRPC_PORT }}
WORKER_SERVICE_CUSTOM_REQUEST_PORT=${{ env.WORKER_SERVICE_CUSTOM_REQUEST_PORT }}
COMPONENT_SERVICE_HTTP_PORT=${{ env.COMPONENT_SERVICE_HTTP_PORT }}
COMPONENT_SERVICE_GRPC_PORT=${{ env.COMPONENT_SERVICE_GRPC_PORT }}
SHARD_MANAGER_HTTP_PORT=${{ env.SHARD_MANAGER_HTTP_PORT }}
SHARD_MANAGER_GRPC_PORT=${{ env.SHARD_MANAGER_GRPC_PORT }}
COMPONENT_COMPILATION_SERVICE_HTTP_PORT=${{ env.COMPONENT_COMPILATION_SERVICE_HTTP_PORT }}
COMPONENT_COMPILATION_SERVICE_GRPC_PORT=${{ env.COMPONENT_COMPILATION_SERVICE_GRPC_PORT }}
WORKER_EXECUTOR_HTTP_PORT=${{ env.WORKER_EXECUTOR_HTTP_PORT }}
WORKER_EXECUTOR_GRPC_PORT=${{ env.WORKER_EXECUTOR_GRPC_PORT }}
GOLEM_ROUTER_COMPONENT_MAX_SIZE_ALLOWED=${{ env.GOLEM_ROUTER_COMPONENT_MAX_SIZE_ALLOWED }}
GOLEM_INIT_MODE=postgres
GOLEM_NON_INTERACTIVE=true
EOF
# Run golem-cli init
cargo run --bin golem-cli init
- name: Start Golem Server
run: |
cargo run --bin golem-cli &
echo "Waiting for Rust server to be ready..."
timeout 30 bash -c 'until curl -s http://localhost:${{ env.RUST_PORT }}/health > /dev/null 2>&1; do sleep 1; done'
- name: Run Python Tests
run: |
python tests/api_client_test.py --rust-port ${{ env.RUST_PORT }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: test-output/