Test API #1642
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: Test API | |
on: | |
workflow_dispatch: | |
inputs: | |
url: | |
description: 'Triggering URL' | |
required: true | |
default: 'cli' | |
action: | |
description: 'Action that triggers this workflow' | |
required: true | |
default: 'scheduled' | |
# Only allow a single workflow to run at a time. | |
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CORTEX_API_KEY: ${{ secrets.CORTEX_API_KEY_STAGING }} | |
CORTEX_API_KEY_VIEWER: ${{ secrets.CORTEX_API_KEY_VIEWER_STAGING }} | |
CORTEX_BASE_URL: ${{ vars.CORTEX_BASE_URL_STAGING }} | |
GH_PAT: ${{ secrets.GH_PAT }} | |
GH_WEBHOOK_SECRET: ${{ secrets.GH_WEBHOOK_SECRET_STAGING }} | |
CORTEX_GH_WEBHOOK_URL: ${{ vars.CORTEX_GH_WEBHOOK_URL_STAGING }} | |
CORTEX_TENANT: jeff-staging | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: trigger | |
if: github.event.inputs.action == 'Trigger from Staging' | |
run: | | |
echo "Workflow triggered by url: ${{ github.event.inputs.url }}" | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install -r requirements.txt | |
- name: Test with pytest | |
run: | | |
make | |
- name: Notify slack success | |
if: success() | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_ERROR_REPORTING_BOT_TOKEN }} | |
uses: voxmedia/github-action-slack-notify-build@v1 | |
with: | |
channel: jeff-test | |
status: SUCCESS | |
color: good | |
- name: Notify slack fail | |
if: failure() | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_ERROR_REPORTING_BOT_TOKEN }} | |
uses: voxmedia/github-action-slack-notify-build@v1 | |
with: | |
channel: jeff-test-failures | |
status: FAILED | |
color: danger | |
- name: Pytest Report | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: html-report | |
path: report.html | |