name: API Integration Test on: push: branches: - "main" paths-ignore: - "**.md" - "**.yml" - "**.yaml" pull_request: branches: - "*" paths-ignore: - "**.md" - "**.yml" - "**.yaml" env: COLUMNS: 150 ZO_ROOT_USER_EMAIL: root@example.com ZO_ROOT_USER_PASSWORD: Complexpass#123 ZO_BASE_URL: http://localhost:5080/ ZO_BASE_URL_SC: http://localhost:5080/ WS_ZO_BASE_URL: ws://localhost:5080/ ZO_SMTP_ENABLED: true ZO_CREATE_ORG_THROUGH_INGESTION: true jobs: api_integration_tests: name: api_integration_tests runs-on: ubicloud-standard-8 steps: - name: Remove unused tools run: | sudo rm -rf /usr/share/dotnet sudo rm -rf /opt/ghc sudo rm -rf "/usr/local/share/boost" sudo rm -rf "$AGENT_TOOLSDIRECTORY" - name: Checkout git repo uses: actions/checkout@v5 with: fetch-depth: 0 - name: Check if API code has changes id: check_changes run: | if [ -n "${{ github.event.before }}" ]; then if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -qE '^src/|^Cargo\.(toml|lock)$'; then echo "has_changes=true" >> $GITHUB_OUTPUT else echo "has_changes=false" >> $GITHUB_OUTPUT fi else # For new branches or when before is unavailable, check against base branch if git diff --name-only origin/${{ github.base_ref || 'main' }} ${{ github.sha }} | grep -qE '^src/|^Cargo\.(toml|lock)$'; then echo "has_changes=true" >> $GITHUB_OUTPUT else echo "has_changes=false" >> $GITHUB_OUTPUT fi fi - name: Setup Rust Toolchain if: steps.check_changes.outputs.has_changes == 'true' uses: dtolnay/rust-toolchain@master with: toolchain: nightly-2025-07-20 - name: Setup Rust Cache if: steps.check_changes.outputs.has_changes == 'true' uses: Swatinem/rust-cache@v2 with: cache-on-failure: true prefix-key: api-testing - name: Install Protoc if: steps.check_changes.outputs.has_changes == 'true' uses: arduino/setup-protoc@v3 with: version: "21.12" - name: Build OpenObserve debug binary if: steps.check_changes.outputs.has_changes == 'true' run: cargo build --features mimalloc - name: Setup Python if: steps.check_changes.outputs.has_changes == 'true' uses: actions/setup-python@v5 with: python-version: "3.11.6" - name: Setup rye if: steps.check_changes.outputs.has_changes == 'true' uses: eifinger/setup-rye@v4 with: enable-cache: true working-directory: "tests/api-testing/" version: "0.27.0" - name: Start OpenObserve if: steps.check_changes.outputs.has_changes == 'true' run: target/debug/openobserve & - name: Wait for start if: steps.check_changes.outputs.has_changes == 'true' run: sleep 15 - name: Pin cpython if: steps.check_changes.outputs.has_changes == 'true' run: rye pin cpython@3.11.6 working-directory: tests/api-testing/ - name: Rye sync if: steps.check_changes.outputs.has_changes == 'true' run: rye sync working-directory: tests/api-testing/ - name: Run tests if: steps.check_changes.outputs.has_changes == 'true' run: rye run pytest --force-sugar working-directory: tests/api-testing/