forked from golemcloud/golem
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (116 loc) · 3.88 KB
/
openapi-integration-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
name: OpenAPI Integration Tests
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:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- 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 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
run: |
cd golem-worker-service-base
cargo test gateway_api_definition::http::openapi_export -- --nocapture
- name: Run Swagger UI Tests
run: |
cd golem-worker-service-base
cargo test gateway_api_definition::http::swagger_ui -- --nocapture
- name: Run Integration Tests
run: |
cd golem-worker-service-base
cargo test --test api_gateway_end_to_end_tests -- --nocapture
cargo test --test services_tests -- --nocapture
- name: Start Worker Service for Python Tests
run: |
# Create config directory and worker service config
mkdir -p config
cat << EOF > config/worker-service.toml
environment = "local"
[rust]
backtrace = 1
log = "info,h2=warn,hyper=warn,tower=warn"
[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
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
run: |
python tests/api_client_test.py
- name: Upload Test Results
if: always()
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/