Update openapi-integration-tests.yaml #87
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: OpenAPI Integration Tests | |
on: | |
push: | |
paths: | |
- 'golem-worker-service-base/src/gateway_api_definition/http/**' | |
- '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/**' | |
- 'tests/api_client_test.py' | |
- 'tests/requirements.txt' | |
- '.github/workflows/openapi-integration-tests.yaml' | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_LOG: debug | |
WORKER_SERVICE_HTTP_PORT: 9005 | |
jobs: | |
openapi-integration-tests: | |
name: Run OpenAPI Integration Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- 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: Run Unit Tests | |
run: | | |
cd golem-worker-service-base | |
cargo test gateway_api_definition::http::openapi_export -- --nocapture | |
cargo test gateway_api_definition::http::swagger_ui -- --nocapture | |
- name: Build and Start Worker Service | |
run: | | |
cd golem-worker-service-base | |
cargo build --bin golem-worker-service | |
# Create config directory and data directory | |
mkdir -p config data | |
touch data/golem_worker.sqlite | |
# Create worker service 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 }} | |
[db] | |
type = "Sqlite" | |
url = "sqlite://../data/golem_worker.sqlite" | |
EOF | |
# 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 HTTP Tests | |
run: | | |
python tests/api_client_test.py | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: test-output/ |