Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Integration Test Workflow #306

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Smoke Test

name: Moonshot Integration Test

on:
# Runs on Pull Request
pull_request_review:
types: [submitted]
branches:
- 'main'

# Run this workflow manually from Actions tab
workflow_dispatch:
inputs:
moonshot_branch:
description: 'Moonshot Branch / Tag Name'
required: true
default: 'main'
type: string
moonshot_data_branch:
description: 'Moonshot Data Branch / Tag Name'
required: true
default: 'main'
type: string
moonshot_ui_branch:
description: 'Moonshot UI Branch / Tag Name'
required: true
default: '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: 20

steps:

- name: Checkout Moonshot (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 }}

- 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 "${{ vars.ENVIRONMENT_VARS }}" >> .env

- name: Checkout Moonshot Data (Pull Request Review)
if: github.event_name == 'pull_request_review'
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-data
ref: ${{ vars.MOONSHOT_DATA_BRANCH }}
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 Integration Test
uses: actions/checkout@v4
with:
repository: aiverify-foundation/moonshot-integration-testing
path: moonshot-smoke-testing

- name: Run Integration Test
env:
URI: ${{ secrets.URI }}
TOKEN: ${{ secrets.TOKEN }}
ADDITIONAL_PARAMETERS: ${{ vars.ADDITIONAL_PARAMETERS }}
run: |
cd moonshot-smoke-testing/ui-integration-testing
npm ci
npx playwright install --with-deps
URI="$URI" TOKEN="$TOKEN" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" npx playwright test
Loading