Skip to content

feat(RPS-976): added integration test CI #4

feat(RPS-976): added integration test CI

feat(RPS-976): added integration test CI #4

Workflow file for this run

name: Run examples
on:
pull_request:
branches:
- main
jobs:
run-examples:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
strategy:
fail-fast: false
max-parallel: 1
matrix:
example_file:
- "01_basic.py"
- "02_plan_and_execute.py"
- "03_move_and_set_ios.py"
- "04_move_multiple_robots.py"
- "05_selection_motion_group_activation.py"
- "06_api_usage.py"
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Create NOVA instance and check connection
env:
PORTAL_STG_REFRESH_URL: ${{ secrets.PORTAL_STG_REFRESH_URL }}
PORTAL_STG_REFRESH_CLIENT_ID: ${{ secrets.PORTAL_STG_REFRESH_CLIENT_ID }}
PORTAL_STG_REFRESH_TOKEN: ${{ secrets.PORTAL_STG_REFRESH_TOKEN }}
API_VERSION: "v1"
# Optional
PROJECT_VERSION: "1.0.0"
GITHUB_RUN_ID: ${{ github.run_id }}
INSECURE_CURL: "true" # If you need to skip SSL verification
run: |
source ./scripts/create_nova_instance.sh
echo $PORTAL_STG_HOST
echo "PORTAL_STG_HOST=$PORTAL_STG_HOST" >> $GITHUB_ENV
echo "PORTAL_STG_INSTANCE_ID=$PORTAL_STG_INSTANCE_ID" >> $GITHUB_ENV
echo "PORTAL_STG_ACCESS_TOKEN=$PORTAL_STG_ACCESS_TOKEN" >> $GITHUB_ENV
- name: Set up Python environment
run: |
pip install poetry
poetry install
- name: "Run example: examples/${{ matrix.example_file }}"
run: |
touch ./.env
echo "NOVA_API=https://${{ env.PORTAL_STG_HOST }}" >> ./.env
echo "NOVA_ACCESS_TOKEN=${{ env.PORTAL_STG_ACCESS_TOKEN }}" >> ./.env
echo "CELL_NAME=cell" >> ./.env
n=0
max_retries=3
until [ $n -ge $max_retries ]
do
echo "Attempt $((n+1)) to run ${{ matrix.example_file }}..."
PYTHONPATH=. poetry run python examples/${{ matrix.example_file }} && break
n=$((n+1))
echo "Failed attempt $n. Retrying in 5s..."
sleep 5
done
if [ $n -ge $max_retries ]; then
echo "Failed after $max_retries attempts."
exit 1
fi
# Always run cleanup, whether success or failure
- name: Cleanup - Delete instance
if: always()
run: |
./scripts/delete_nova_instance.sh
env:
PORTAL_STG_INSTANCE_ID: ${{ env.PORTAL_STG_INSTANCE_ID }}
PORTAL_STG_ACCESS_TOKEN: ${{ env.PORTAL_STG_ACCESS_TOKEN }}