Skip to content

test prototype

test prototype #7

name: traceability tests v2
permissions:
contents: read
id-token: write
on:
workflow_dispatch:
inputs:
include-expression:
description: 'Specify keyword expression for test selection. e.g. (req and test_directory and test_file or test_class and not test_func). Leave empty to run all.'
required: false
type: string
push:
branches:
- jmares-pytest
# schedule:
# - cron: '0 5 * * WED'
# - cron: '0 7 * * SUN'
jobs:
run-tests:
runs-on: ubuntu-latest
timeout-minutes: 150
concurrency:
group: parallel_tests
cancel-in-progress: false
env:
AWS_DEFAULT_REGION: us-east-1
ENVIRONMENT: staging
TEST_PATH: qe_tests
steps:
- name: Checkout Repo
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: configure AWS secrets credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: arn:aws:iam::263799606133:role/mainQeWorkflowRolesForSec-readerRoleForSecretsForB-Q4ETNJYGWW6Z
role-session-name: my-gha-role-session
aws-region: ${{env.AWS_DEFAULT_REGION}}
- name: download and mask aws user secrets
run: |
users_stg=$(aws secretsmanager get-secret-value --secret-id vdev/qe/users_stg | jq -cr '.SecretString | fromjson')
s3=$(aws secretsmanager get-secret-value --secret-id vdev/qe/users_stg/S3_AWS | jq -cr '.SecretString | fromjson')
secrets=$(jq -crs '.[0] * .[1]' <(echo $users_stg) <(echo $s3))
echo "SECRETS=$secrets" >> $GITHUB_ENV
jq -cr '.[]' <<< $secrets | while read secret; do echo "::add-mask::$secret"; done
- name: extract org admin token
run: |
token=$(jq -r .dnanexus_apps_test_robot <<< $SECRETS)
echo "::add-mask::$token"
echo "SPENDING_ACCESS_TOKEN=$token" >> $GITHUB_ENV
- name: configure AWS ECR credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-access-key-id: ${{ secrets.VDEV_ECR_DOCKER_PUBLISH_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.VDEV_ECR_DOCKER_PUBLISH_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{env.AWS_DEFAULT_REGION}}
- name: run tests
working-directory: ${{ env.TEST_PATH }}
run: bash run_traceability_tests.sh '${{ inputs.include-expression }}'
- name: create tests summary
if: always()
working-directory: ${{ env.TEST_PATH }}
run: |
docker-compose run medusa python /root/medusa/pytest_code/summary_writer.py
cat summary.md >> $GITHUB_STEP_SUMMARY
- name: archive traceability
if: always()
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: traceability_${{ inputs.artifact-archive-suffix }}
path: ${{ env.TEST_PATH }}/traceability.csv
retention-days: 15
- name: upload test report
if: always()
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: report
path: ${{ env.TEST_PATH }}/report.html
retention-days: 10
- name: archive test debug log files
if: always()
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: tests debug logs
path: ${{ env.TEST_PATH }}/*.debug.log
retention-days: 10
# - name: send notification
# if: ${{ always() && github.event_name == 'schedule' }}
# uses: dnanexus/qe-tools/.github/actions/slack_notification@3603ef012b1864eabe0fc0ab009fba12f9bd27c5
# with:
# slack-channel: ${{ secrets.SLACK_ALERT_BIG_STAGING_WEBHOOK_URL }}
# # for prod channel use SLACK_ALERT_BIG_PRODUCTION_WEBHOOK_URL
# status: ${{ job.status == 'success' && 'PASSED' || 'FAILED' }}
# image-url: https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png