COH-32107 - Create a GitHub workflow action for running Python exampl… #14
This file contains hidden or 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
# Copyright 2025, Oracle Corporation and/or its affiliates. | |
# Licensed under the Universal Permissive License v 1.0 as shown at | |
# https://oss.oracle.com/licenses/upl. | |
name: Run Examples | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: [ main ] | |
jobs: | |
run-examples: | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9.x"] | |
poetry-version: ["1.8.4"] | |
os: [ubuntu-latest] | |
coherence-image: | |
- ghcr.io/oracle/coherence-ce | |
coherenceVersion: | |
- 25.03.1 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Get Docker Images | |
shell: bash | |
run: | | |
docker pull ${{ matrix.coherence-image }}:${{ matrix.coherenceVersion }} | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
shell: bash | |
run: | | |
pip install poetry==${{ matrix.poetry-version }} | |
- name: Install Dependencies | |
run: python -m poetry install | |
- name: Install Coherence Python Client | |
shell: bash | |
run: | | |
python -m pip install --upgrade pip | |
python -m poetry run pip install sentence-transformers # required for vector_search example | |
- name: Start the Server using image | |
shell: bash | |
run: | | |
docker run -d -p 1408:1408 ${{ matrix.coherence-image }}:${{ matrix.coherenceVersion }} | |
sleep 20 | |
- name: Run the example | |
shell: bash | |
run: | | |
cd examples | |
for file in *.py; do | |
echo "Run example ${file}" | |
COHERENCE_CLIENT_REQUEST_TIMEOUT=180.0 python -m poetry run python3 $file | |
echo "==== Done running example ${file} ======" | |
done |