Skip to content

Worker improvements #992

Worker improvements

Worker improvements #992

Workflow file for this run

name: Continuous Integration
on: [pull_request, workflow_dispatch]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-test:
runs-on: ubuntu-latest
env:
COVERAGE_FILE: coverage.xml
COVERAGE_DIR: .coverage-reports
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest pytest-cov coverage
- name: Prepare coverage directory
run: |
mkdir -p ${{ env.COVERAGE_DIR }}
- name: Run unit tests
id: unit_tests
continue-on-error: true
env:
CONDUCTOR_AUTH_KEY: ${{ secrets.CONDUCTOR_AUTH_KEY }}
CONDUCTOR_AUTH_SECRET: ${{ secrets.CONDUCTOR_AUTH_SECRET }}
CONDUCTOR_SERVER_URL: ${{ secrets.CONDUCTOR_SERVER_URL }}
COVERAGE_FILE: ${{ env.COVERAGE_DIR }}/.coverage.unit
run: |
coverage run -m pytest tests/unit -v
- name: Run backward compatibility tests
id: bc_tests
continue-on-error: true
env:
CONDUCTOR_AUTH_KEY: ${{ secrets.CONDUCTOR_AUTH_KEY }}
CONDUCTOR_AUTH_SECRET: ${{ secrets.CONDUCTOR_AUTH_SECRET }}
CONDUCTOR_SERVER_URL: ${{ secrets.CONDUCTOR_SERVER_URL }}
COVERAGE_FILE: ${{ env.COVERAGE_DIR }}/.coverage.bc
run: |
coverage run -m pytest tests/backwardcompatibility -v
- name: Run serdeser tests
id: serdeser_tests
continue-on-error: true
env:
CONDUCTOR_AUTH_KEY: ${{ secrets.CONDUCTOR_AUTH_KEY }}
CONDUCTOR_AUTH_SECRET: ${{ secrets.CONDUCTOR_AUTH_SECRET }}
CONDUCTOR_SERVER_URL: ${{ secrets.CONDUCTOR_SERVER_URL }}
COVERAGE_FILE: ${{ env.COVERAGE_DIR }}/.coverage.serdeser
run: |
coverage run -m pytest tests/serdesertest -v
- name: Generate coverage report
id: coverage_report
continue-on-error: true
run: |
coverage combine ${{ env.COVERAGE_DIR }}/.coverage.*
coverage report
coverage xml
- name: Verify coverage file
id: verify_coverage
if: always()
continue-on-error: true
run: |
if [ ! -s "${{ env.COVERAGE_FILE }}" ]; then
echo "Coverage file is empty or does not exist"
ls -la ${{ env.COVERAGE_FILE }} ${{ env.COVERAGE_DIR }}
exit 1
fi
echo "Coverage file exists and is not empty"
- name: Upload coverage to Codecov
if: always() && steps.verify_coverage.outcome == 'success'
continue-on-error: true
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ env.COVERAGE_FILE }}
- name: Check test results
if: steps.unit_tests.outcome == 'failure' || steps.bc_tests.outcome == 'failure' || steps.serdeser_tests.outcome == 'failure'
run: exit 1