Add tests 2 #959
Workflow file for this run
This file contains hidden or 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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Run tests | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 45 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python-version: ["3.8", "3.9"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install uv | |
uv venv | |
uv pip install -r requirements.txt | |
uv pip install -r tests/requirements.txt | |
- name: Run static analysis lint | |
uses: pre-commit/[email protected] | |
- name: Prepare the API keys & run pytest | |
env: | |
CLARIFAI_USER_EMAIL_SECURE_HOSTING: ${{ secrets.CLARIFAI_USER_EMAIL_SECURE_HOSTING }} | |
CLARIFAI_USER_EMAIL: ${{ secrets.INTERNAL_USER_EMAIL }} | |
CLARIFAI_USER_PASSWORD: ${{ secrets.INTERNAL_USER_PASSWORD }} | |
shell: bash | |
run: | | |
export PYTHONPATH=. | |
export CLARIFAI_APP_ID="$(python scripts/app_and_key_for_tests.py --create-app python-github)" | |
export CLARIFAI_API_KEY="$(python scripts/app_and_key_for_tests.py --create-key ${CLARIFAI_APP_ID})" | |
export CLARIFAI_PAT_KEY="$(python scripts/app_and_key_for_tests.py --create-pat)" | |
python scripts/app_and_key_for_tests.py --create-workflow ${CLARIFAI_API_KEY} | |
export CLARIFAI_APP_ID_SECURE_HOSTING="$(python scripts/app_and_key_for_tests.py --user-email ${CLARIFAI_USER_EMAIL_SECURE_HOSTING} --create-app python-github-secure-hosting)" | |
export CLARIFAI_API_KEY_SECURE_HOSTING="$(python scripts/app_and_key_for_tests.py --user-email ${CLARIFAI_USER_EMAIL_SECURE_HOSTING} --create-key ${CLARIFAI_APP_ID_SECURE_HOSTING})" | |
export CLARIFAI_PAT_KEY_SECURE_HOSTING="$(python scripts/app_and_key_for_tests.py --user-email ${CLARIFAI_USER_EMAIL_SECURE_HOSTING} --create-pat)" | |
export CLARIFAI_SESSION_TOKEN_SECURE_HOSTING="$(python scripts/app_and_key_for_tests.py --user-email ${CLARIFAI_USER_EMAIL_SECURE_HOSTING} --create-session-token)" | |
uv run pytest tests/ -n auto | |
uv run python scripts/app_and_key_for_tests.py --delete-app ${CLARIFAI_APP_ID} | |
uv run python scripts/app_and_key_for_tests.py --user-email ${CLARIFAI_USER_EMAIL_SECURE_HOSTING} --delete-app ${CLARIFAI_APP_ID_SECURE_HOSTING} | |
- name: Slack Notify | |
if: ${{ failure() }} | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_ICON: "https://raw.githubusercontent.com/github/explore/2c7e603b797535e5ad8b4beb575ab3b7354666e1/topics/actions/actions.png" | |
SLACK_USERNAME: "GitHub Alerts" | |
SLACK_CHANNEL: "#grpc-client-repo-alerts" | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_MESSAGE: "Test failure" | |
SLACK_FOOTER: "Clarifai Python GRPC Repo" |