Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 6380 | |
REDIS_URL: redis://localhost:6380 | |
# Golem Service Ports | |
GOLEM_ROUTER_PORT: 9881 | |
WORKER_SERVICE_HTTP_PORT: 9005 | |
WORKER_SERVICE_GRPC_PORT: 9007 | |
WORKER_SERVICE_CUSTOM_REQUEST_PORT: 9006 | |
COMPONENT_SERVICE_HTTP_PORT: 8083 | |
COMPONENT_SERVICE_GRPC_PORT: 9090 | |
SHARD_MANAGER_HTTP_PORT: 8081 | |
SHARD_MANAGER_GRPC_PORT: 9002 | |
COMPONENT_COMPILATION_SERVICE_HTTP_PORT: 8084 | |
COMPONENT_COMPILATION_SERVICE_GRPC_PORT: 9091 | |
WORKER_EXECUTOR_HTTP_PORT: 8082 | |
WORKER_EXECUTOR_GRPC_PORT: 9000 | |
# Additional Golem Configuration | |
GOLEM_ROUTER_COMPONENT_MAX_SIZE_ALLOWED: 1g | |
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: | |
- 6380:6380 | |
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 | |
run: | | |
# Install expect | |
sudo apt-get update && sudo apt-get install -y expect | |
# 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 }} | |
EOF | |
# Create expect script | |
cat << 'EOF' > init.exp | |
#!/usr/bin/expect -f | |
set timeout -1 | |
spawn cargo run --bin golem-cli init | |
expect "Select database type:" | |
send "2\r" | |
expect eof | |
EOF | |
# Make expect script executable and run it | |
chmod +x init.exp | |
./init.exp | |
- 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/ |