Moonshot Data Smoke Test #94
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
# Smoke Test | |
name: Moonshot Data Smoke Test | |
on: | |
# Runs on Pull Request Review | |
pull_request_review: | |
types: [submitted] | |
branches: | |
- 'dev_main' | |
# Run this workflow manually from Actions tab | |
workflow_dispatch: | |
inputs: | |
moonshot_branch: | |
description: 'Moonshot Branch / Tag Name' | |
required: true | |
default: 'dev_main' | |
type: string | |
moonshot_data_branch: | |
description: 'Moonshot Data Branch / Tag Name' | |
required: true | |
default: 'dev_main' | |
type: string | |
moonshot_ui_branch: | |
description: 'Moonshot UI Branch / Tag Name' | |
required: true | |
default: 'dev_main' | |
type: string | |
# Allow one concurrent deployment | |
concurrency: | |
group: ${{ github.repository }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
smoke-test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout Moonshot (Pull Request Review) | |
if: github.event_name == 'pull_request_review' | |
uses: actions/checkout@v4 | |
with: | |
repository: aiverify-foundation/moonshot | |
ref: ${{ vars.MOONSHOT_BRANCH }} | |
- name: Checkout Moonshot (Workflow Dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
uses: actions/checkout@v4 | |
with: | |
repository: aiverify-foundation/moonshot | |
ref: ${{ inputs.moonshot_branch }} | |
- name: Setup Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Setup Moonshot | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
pip install -r requirements.txt | |
touch .env | |
echo "${{ secrets.ENVIRONMENT_VARS }}" >> .env | |
- name: Checkout Moonshot Data (Pull Request Review) | |
if: github.event_name == 'pull_request_review' | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
path: moonshot-data | |
- name: Checkout Moonshot Data (Workflow Dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
uses: actions/checkout@v4 | |
with: | |
repository: aiverify-foundation/moonshot-data | |
ref: ${{ inputs.moonshot_data_branch }} | |
path: moonshot-data | |
- name: Setup Moonshot Data | |
run: | | |
source venv/bin/activate | |
cd moonshot-data | |
pip install -r requirements.txt | |
- name: Checkout Moonshot UI (Pull Request Review) | |
if: github.event_name == 'pull_request_review' | |
uses: actions/checkout@v4 | |
with: | |
repository: aiverify-foundation/moonshot-ui | |
ref: ${{ vars.MOONSHOT_UI_BRANCH }} | |
path: moonshot-ui | |
- name: Checkout Moonshot UI (Workflow Dispatch) | |
if: github.event_name == 'workflow_dispatch' | |
uses: actions/checkout@v4 | |
with: | |
repository: aiverify-foundation/moonshot-ui | |
ref: ${{ inputs.moonshot_ui_branch }} | |
path: moonshot-ui | |
- name: Setup Moonshot UI | |
run: | | |
cd moonshot-ui | |
npm ci | |
npm run build | |
cd ../ | |
source venv/bin/activate | |
python -m moonshot web & | |
- name: Checkout Smoke Test | |
uses: actions/checkout@v4 | |
with: | |
repository: aiverify-foundation/moonshot-smoke-testing | |
path: moonshot-smoke-testing | |
- name: Run Smoke Test | |
env: | |
AZURE_OPENAI_URI: ${{ secrets.AZURE_OPENAI_URI }} | |
AZURE_OPENAI_TOKEN: ${{ secrets.AZURE_OPENAI_TOKEN }} | |
ADDITIONAL_PARAMETERS: ${{ secrets.ADDITIONAL_PARAMETERS }} | |
MOONSHOT_URL: ${{ secrets.MOONSHOT_URL }} | |
MOONSHOT_PORT_NUMBER: ${{ secrets.MOONSHOT_PORT_NUMBER }} | |
run: | | |
cd moonshot-smoke-testing | |
npm ci | |
npx playwright install --with-deps | |
AZURE_OPENAI_URI="$AZURE_OPENAI_URI" AZURE_OPENAI_TOKEN="$AZURE_OPENAI_TOKEN" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" MOONSHOT_URL="$MOONSHOT_URL" MOONSHOT_PORT_NUMBER="$MOONSHOT_PORT_NUMBER" npx playwright test tests/smoke-test.spec.ts |