Skip to content

Add retry mechanism to better handle ConnectionError #858

Add retry mechanism to better handle ConnectionError

Add retry mechanism to better handle ConnectionError #858

Workflow file for this run

name: Pre-merge tests
# Controls when the action will run. This action can be triggered manually
# (workflow_dispatch trigger), and it will be run automatically when a PR to main is made.
on:
workflow_dispatch:
pull_request:
branches:
- main
env:
PREMERGE_TEST_REPORT: pre_merge_test_report.html
REPORT_DIRECTORY: reports
PYTHONUTF8: '1'
permissions:
contents: read
checks: read
actions: read
jobs:
pr_tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest, macos-latest]
# include: # DISABELED UNTIL 2.0 RELEASE - Run test with legacy cassette (Currently - Geti 1.8)
# - os: ubuntu-22.04
# python-version: '3.10'
# env: GETI_PLATFORM_VERSION=LEGACY
fail-fast: true
max-parallel: 4
steps:
- name: Harden Runner
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
lfs: true
- name: Set up Python
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: ${{ matrix.python-version }}
- name: Install package with dev and notebook requirements
run: |
python -m pip install --upgrade pip
pip install ".[dev,notebooks]"
- name: Create report directory
# Creates the temporary directory that is used to store the test report
run: |
mkdir -p env.REPORT_DIRECTORY
- name: Check formatting with black
run: black . --check
- name: Check imports with isort
run: isort . --check
if: ${{ always() }}
- name: Flake8 linting
run: flake8 .
if: ${{ always() }}
- name: Pydocstyle linting
run: pydocstyle geti_sdk --count
if: ${{ always() }}
- name: Test with pytest
run: |
pytest tests/pre-merge -c tests/offline.ini --cov=geti_sdk --html=env.REPORT_DIRECTORY/env.PREMERGE_TEST_REPORT --self-contained-html --cov-report html:env.REPORT_DIRECTORY/coverage
- name: Upload test report for pre-merge tests
# Publish the test report to github
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: ${{ always() }}
with:
name: pre-merge-test-reports
path: ${{ env.REPORT_DIRECTORY }}
- name: Clean up report directories
# Remove temporary report directory
if: ${{ always() }}
run: |
rm -r env.REPORT_DIRECTORY