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 | |
CARGO_INCREMENTAL: 0 # Disable incremental compilation for faster builds | |
CARGO_NET_RETRY: 10 # Increase network retry attempts | |
RUSTC_WRAPPER: sccache # Use sccache for faster compilation | |
SCCACHE_CACHE_SIZE: 10G | |
RUST_BACKTRACE: 1 | |
jobs: | |
rust-unit-tests: | |
name: Run Rust Unit Tests | |
runs-on: ubuntu-latest-16-cores | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Install sccache | |
run: | | |
SCCACHE_VERSION=v0.5.4 | |
curl -L "https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" | tar xz | |
sudo mv sccache-*/sccache /usr/local/bin/sccache | |
echo "$(which sccache)" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- name: Cache Rust dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
~/.cache/sccache | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}- | |
${{ runner.os }}-cargo- | |
- name: Start sccache server | |
run: sccache --start-server | |
- name: Run Unit Tests | |
run: | | |
cd golem-worker-service-base | |
cargo test gateway_api_definition::http::openapi_export -- --nocapture --test-threads $(nproc) | |
cargo test gateway_api_definition::http::swagger_ui -- --nocapture --test-threads $(nproc) | |
- name: Print sccache stats | |
run: sccache --show-stats | |
python-integration-tests: | |
name: Run Python Integration Tests | |
needs: rust-unit-tests | |
runs-on: ubuntu-latest-16-cores | |
strategy: | |
fail-fast: false | |
matrix: | |
test-group: [openapi, swagger-ui, edge-cases] | |
include: | |
- test-group: openapi | |
test-pattern: "test_openapi_export" | |
- test-group: swagger-ui | |
test-pattern: "test_swagger_ui" | |
- test-group: edge-cases | |
test-pattern: "test_.*_edge_cases" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- 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' | |
cache: 'pip' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r tests/requirements.txt | |
pip install pytest pytest-asyncio pytest-xdist | |
- name: Build and Start Worker Service | |
run: | | |
cd golem-worker-service-base | |
RUSTFLAGS="-C target-cpu=native" cargo build --release --bin golem-worker-service | |
mkdir -p config data | |
touch data/golem_worker.sqlite | |
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 | |
./target/release/golem-worker-service & | |
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 Integration Tests | |
run: | | |
pytest tests/api_client_test.py -v -n auto -k "${{ matrix.test-pattern }}" --asyncio-mode=auto | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-${{ matrix.test-group }} | |
path: test-output/ | |
test-summary: | |
name: Summarize Test Results | |
needs: [rust-unit-tests, python-integration-tests] | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: Download Test Results | |
uses: actions/download-artifact@v4 | |
with: | |
path: test-results | |
- name: Generate Test Summary | |
run: | | |
echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY | |
echo "### Rust Unit Tests" >> $GITHUB_STEP_SUMMARY | |
if [ "${{ needs.rust-unit-tests.result }}" == "success" ]; then | |
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY | |
else | |
echo "❌ Failed" >> $GITHUB_STEP_SUMMARY | |
fi | |
echo "### Python Integration Tests" >> $GITHUB_STEP_SUMMARY | |
if [ "${{ needs.python-integration-tests.result }}" == "success" ]; then | |
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY | |
else | |
echo "❌ Failed" >> $GITHUB_STEP_SUMMARY | |
fi |