Skip to content

Integration Tests

Integration Tests #574

name: Integration Tests
on:
push:
branches:
- main
workflow_dispatch:
inputs:
commit-to-test:
description: "Commit SHA to test"
required: true
type: string
env:
POETRY_VERSION: "1.7.1"
POETRY_URL: https://install.python-poetry.org
jobs:
integration-tests:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
python-version: ["3.11"]
pydantic-version: ["^1.10", "^2.0"]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.commit-to-test }}
- name: Set status to pending
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/github-script@v7
with:
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: '${{ inputs.commit-to-test }}',
state: 'pending',
context: 'Integration Tests',
description: 'Integration tests are in progress'
})
- name: Install Poetry
run: |
pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
cache-dependency-path: poetry.lock
- name: Set Poetry environment
run: |
poetry env use ${{ matrix.python-version }}
- name: Install dependencies
run: |
poetry install --all-extras
- name: Override Pydantic version
run: |
if [[ "${{ matrix.pydantic-version }}" == ^1.* ]]; then
# Since there's a mismatch between pydantic 1.x and the python-semantic-release version
# we have in the project, we need to downgrade its version when running tests on pydantic v1
poetry remove python-semantic-release
poetry add [email protected]
fi
poetry add pydantic@${{ matrix.pydantic-version }}
poetry lock --no-update
- name: Run Integration Tests
env:
AI21_API_KEY: ${{ secrets.AI21_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
poetry run pytest tests/integration_tests/
- name: Upload pytest integration tests results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Set status to success
if: ${{ github.event_name == 'workflow_dispatch' && success() }}
uses: actions/github-script@v7
with:
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: '${{ inputs.commit-to-test }}',
state: 'success',
context: 'Integration Tests',
description: 'Integration tests passed'
})
- name: Set status to failure
if: ${{ github.event_name == 'workflow_dispatch' && failure() }}
uses: actions/github-script@v7
with:
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: '${{ inputs.commit-to-test }}',
state: 'failure',
context: 'Integration Tests',
description: 'Integration tests failed'
})