Skip to content

Merge pull request #95 from corva-ai/fix/DEVC-1505-fix-for-sdk-docume… #682

Merge pull request #95 from corva-ai/fix/DEVC-1505-fix-for-sdk-docume…

Merge pull request #95 from corva-ai/fix/DEVC-1505-fix-for-sdk-docume… #682

Workflow file for this run

name: CI
on: push
env:
PYTHON_VERSIONS: '[ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]'
jobs:
set-python-matrix:
runs-on: ubuntu-latest
outputs:
python_versions: ${{ env.PYTHON_VERSIONS }} # Pass the env variable as an output
steps:
- name: Export PYTHON_VERSIONS
run: echo "PYTHON_VERSIONS=$PYTHON_VERSIONS" >> $GITHUB_ENV
static:
name: Static analysis on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
needs: set-python-matrix
strategy:
fail-fast: false # Ensure all matrix jobs run to completion
matrix:
python-version: ${{ fromJSON(needs.set-python-matrix.outputs.python_versions) }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: make install-lint
- name: Run
run: make lint
test:
name: Testing on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
needs: set-python-matrix
strategy:
fail-fast: false # Ensure all matrix jobs run to completion
matrix:
python-version: ${{ fromJSON(needs.set-python-matrix.outputs.python_versions) }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: make install-test
- name: Run
run: make coverage
check-static-and-test-status:
name: Verify All Jobs Succeeded
runs-on: ubuntu-latest
needs: [ static, test ] # Ensure all jobs complete before checking
if: always() # This ensures the job runs even if previous jobs failed
steps:
- name: Check Job Results
run: |
# Initialize a flag to track failures
FAILED=0
# Check the result of the 'static' job
if [ "${{ needs.static.result }}" == "failure" ]; then
echo "Static analysis job failed."
FAILED=1
fi
# Check the result of the 'test' job
if [ "${{ needs.test.result }}" == "failure" ]; then
echo "Test job failed."
FAILED=1
fi
# Exit with status 1 if any job failed
if [ "$FAILED" -ne 0 ]; then
echo "One or more jobs failed."
exit 1
else
echo "All jobs passed successfully."
fi
deploy:
name: Build and publish to PyPI
needs: check-static-and-test-status
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: pip install -U setuptools wheel
- name: Build the package
run: python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
docs:
name: Build and publish docs
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: make docs
- name: Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: docs/build/site