External tests #1064
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: External tests | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
pull_request: | |
types: [ labeled, opened, synchronize, reopened ] | |
env: | |
MODULE_NAME: "spacy_llm" | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
CO_API_KEY: ${{ secrets.CO_API_KEY }} | |
TEST_EXTERNAL: 1 | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
if: "github.repository_owner == 'explosion' && (contains(github.event.pull_request.labels.*.name, 'Test external') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
cache: "pip" | |
- name: Build sdist | |
run: | | |
python -m pip install -U build pip setuptools | |
python -m build --sdist | |
- name: Delete source directory | |
shell: bash | |
run: | | |
rm -rf $MODULE_NAME | |
- name: Install from sdist | |
shell: bash | |
run: | | |
SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1) | |
python -m pip install dist/$SDIST | |
- name: Test import | |
shell: bash | |
run: | | |
python -c "import $MODULE_NAME" -Werror | |
- name: Install test requirements | |
run: | | |
python -m spacy download en_core_web_md | |
python -m pip install -U -r requirements.txt -r requirements-dev.txt | |
- name: Run tests | |
shell: bash | |
run: python -m pytest --pyargs $MODULE_NAME -x | |
- name: Run usage tests | |
shell: bash | |
run: python -m pytest --pyargs usage_examples -x | |
# - name: Report Status | |
# if: always() | |
# uses: ravsamhq/notify-slack-action@v1 | |
# with: | |
# status: ${{ job.status }} | |
# notification_title: "{workflow} have {status_message}" | |
# message_format: "{emoji} external workflow has {status_message}" | |
# notify_when: "failure" | |
# env: | |
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_MONITORING_WEBHOOK_URL }} |