Merge pull request #1 from IDinsight/customize #1
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: Retrieval validation | |
on: | |
push: | |
branches: [main] | |
paths: | |
- "core_backend/app/**" | |
workflow_dispatch: | |
env: | |
POSTGRES_PASSWORD: postgres-test-pw | |
POSTGRES_USER: postgres-test-user | |
POSTGRES_DB: postgres-test-db | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
validate: | |
runs-on: ubuntu-20.04 | |
container: node:20.7-bullseye | |
services: | |
postgres: | |
image: pgvector/pgvector:pg16 | |
env: | |
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
environment: validation-mc | |
steps: | |
- name: Install dependencies | |
run: apt-get update && apt-get install -y lsb-release && apt-get clean all | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github_actions_dev | |
role-session-name: github-actions | |
role-duration-seconds: 7200 | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Install Python dependencies | |
run: | | |
python -m pip install -r core_backend/requirements.txt | |
python -m pip install -r core_backend/validation/retrieval/requirements.txt | |
- name: Run migration scripts | |
run: | | |
cd core_backend | |
export POSTGRES_HOST=postgres POSTGRES_USER=${{ env.POSTGRES_USER }} \ | |
POSTGRES_PASSWORD=${{ env.POSTGRES_PASSWORD }} POSTGRES_DB=${{ env.POSTGRES_DB }} | |
python -m alembic upgrade head | |
- name: Run validation script | |
env: | |
N_TOP_CONTENT_FOR_SEARCH: 10 | |
PROMETHEUS_MULTIPROC_DIR: /tmp | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
REPO: ${{ github.repository }} | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
HASH: ${{ github.sha }} | |
REF: ${{ github.ref }} | |
POSTGRES_HOST: postgres | |
POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
run: | | |
python -m pytest core_backend/validation/retrieval/validate_retrieval.py \ | |
--validation_data_path \ | |
${{ secrets.VALIDATION_DATA_S3_PATH }} \ | |
--content_data_path \ | |
${{ secrets.CONTENT_DATA_S3_PATH }} \ | |
--validation_data_question_col \ | |
${{ vars.VALIDATION_DATA_QUESTION_COL }} \ | |
--validation_data_label_col \ | |
${{ vars.VALIDATION_DATA_LABEL_COL }} \ | |
--content_data_label_col \ | |
${{ vars.CONTENT_DATA_LABEL_COL }} \ | |
--content_data_text_col \ | |
${{ vars.CONTENT_DATA_TEXT_COL }} \ | |
--notification_topic \ | |
arn:aws:sns:${{ secrets.AWS_REGION }}:${{ secrets.AWS_ACCOUNT_ID }}:aaq-validation-topic \ | |
-n auto -s |