Merge branch 'main' into SCRUM-4802 #4732
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: unittest | |
on: [push] | |
jobs: | |
run-unittests: | |
permissions: | |
id-token: write # This is required for requesting the JWT for gaining permissions to assume the IAM role to perform AWS actions | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: actions/setup-python@v4 | |
name: setup python | |
with: | |
python-version: 3.11 | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r requirements.dev.txt | |
- name: AWS credentials configuration | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: ${{secrets.GH_ACTIONS_AWS_ROLE}} | |
role-session-name: gh-actions-${{github.run_id}}.${{github.run_number}}.${{github.run_attempt}}-unittest | |
aws-region: us-east-1 | |
- name: Amazon ECR login | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: run unit tests | |
env: | |
ENV_STATE: test | |
HOST: 0.0.0.0 | |
PSQL_USERNAME: postgres | |
PSQL_PASSWORD: postgres | |
PSQL_HOST: localhost | |
PSQL_PORT: 5432 | |
PSQL_DATABASE: literature-test | |
PYTHONPATH: agr_literature_service/lit_processing/ | |
OKTA_DOMAIN: 'dev-30456587.okta.com/oauth2/default' | |
OKTA_API_AUDIENCE: 'api://default' | |
RESOURCE_DESCRIPTOR_URL: 'https://raw.githubusercontent.com/alliance-genome/agr_schemas/master/resourceDescriptors.yaml' | |
ELASTICSEARCH_HOST: localhost | |
ELASTICSEARCH_PORT: 9200 | |
ELASTICSEARCH_INDEX: references_index | |
XML_PATH: ${GITHUB_WORKSPACE}/tests/tmp/ | |
OKTA_CLIENT_ID: ${{ secrets.okta_client_id }} | |
OKTA_CLIENT_SECRET: ${{ secrets.okta_client_secret }} | |
run: | | |
docker compose --env-file .env.test down -v | |
docker compose --env-file .env.test up -d postgres | |
sleep 5 | |
docker compose --env-file .env.test up -d elasticsearch | |
sleep 10 | |
pytest -m "not webtest" | |
docker compose --env-file .env.test down -v |