Skip to content

Commit

Permalink
Update openapi-integration-tests.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
zelosleone committed Dec 25, 2024
1 parent 3a3cbe4 commit 7e7752d
Showing 1 changed file with 21 additions and 54 deletions.
75 changes: 21 additions & 54 deletions .github/workflows/openapi-integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,36 @@ on:
push:
paths:
- 'golem-worker-service-base/src/gateway_api_definition/http/**'
- 'golem-worker-service-base/tests/**'
- 'tests/api_client_test.py'
- 'tests/requirements.txt'
- '.github/workflows/openapi-integration-tests.yaml'
pull_request:
paths:
- 'golem-worker-service-base/src/gateway_api_definition/http/**'
- 'golem-worker-service-base/tests/**'
- 'tests/api_client_test.py'
- 'tests/requirements.txt'
- '.github/workflows/openapi-integration-tests.yaml'

env:
CARGO_TERM_COLOR: always
RUST_LOG: debug
CARGO_TERM_VERBOSE: true
WORKER_SERVICE_HTTP_PORT: 9005

jobs:
openapi-integration-tests:
name: Run OpenAPI Integration Tests
runs-on: ubuntu-latest

services:
redis:
image: redis
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
submodules: recursive

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "openapi-tests"

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
Expand All @@ -68,34 +48,31 @@ jobs:
python -m pip install --upgrade pip
pip install -r tests/requirements.txt
- name: Build Dependencies
run: |
cd golem-worker-service-base
cargo build --all-features
- name: Run Clippy
run: |
cd golem-worker-service-base
cargo clippy --all-targets --all-features -- -D warnings
- name: Run OpenAPI Tests
- name: Initialize Worker Service Base
run: |
cd golem-worker-service-base
cargo test golem-worker-service-base gateway_api_definition::http::openapi_export -- --nocapture
- name: Run Swagger UI Tests
cargo init --lib
cargo add tokio --features full
cargo add axum
cargo add utoipa
cargo add serde --features derive
cargo add serde_json
cargo add serde_yaml
cargo add tracing
cargo add wasmtime
cargo add wasi
- name: Run Unit Tests
run: |
cd golem-worker-service-base
cargo test golem-worker-service-base gateway_api_definition::http::swagger_ui -- --nocapture
cargo test gateway_api_definition::http::openapi_export -- --nocapture
cargo test gateway_api_definition::http::swagger_ui -- --nocapture
- name: Run Integration Tests
- name: Build and Start Worker Service
run: |
cd golem-worker-service-base
cargo test --test golem-worker-service-base api_gateway_end_to_end_tests -- --nocapture
cargo test --test golem-worker-service-base services_tests -- --nocapture
- name: Start Worker Service for Python Tests
run: |
cargo build --bin golem-worker-service
# Create config directory and worker service config
mkdir -p config
cat << EOF > config/worker-service.toml
Expand All @@ -107,24 +84,17 @@ jobs:
[http]
port = ${{ env.WORKER_SERVICE_HTTP_PORT }}
[grpc]
port = 9007
[custom_request]
port = 9006
EOF
# Build and start worker service
cargo build --bin golem-worker-service
# Start worker service
cargo run --bin golem-worker-service &
# Wait for service to be ready
echo "Waiting for worker service to be ready..."
timeout 30 bash -c "until curl -s http://localhost:${WORKER_SERVICE_HTTP_PORT}/health > /dev/null 2>&1; do sleep 1; done"
echo "Worker service is running!"
- name: Run Python API Client Tests
- name: Run HTTP Tests
run: |
python tests/api_client_test.py
Expand All @@ -133,7 +103,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
golem-worker-service-base/test-output.json
golem-worker-service-base/target/debug/deps/test_*.xml
test-output/
path: test-output/

0 comments on commit 7e7752d

Please sign in to comment.