|
| 1 | +name: Pytest CPU |
| 2 | +inputs: |
| 3 | + composer_package_name: |
| 4 | + required: false |
| 5 | + type: string |
| 6 | + container: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + name: |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + pip_deps: |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + pytest_command: |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + pytest_markers: |
| 19 | + required: true |
| 20 | + type: string |
| 21 | + pytest_wandb_entity: |
| 22 | + required: false |
| 23 | + type: string |
| 24 | + pytest_wandb_project: |
| 25 | + required: false |
| 26 | + type: string |
| 27 | + safe_directory: |
| 28 | + required: true |
| 29 | + type: string |
| 30 | + wandb_api_key: |
| 31 | + required: false |
| 32 | + description: "wandb API key - Pass in as repo secret" |
| 33 | + aws_access_key_id: |
| 34 | + required: false |
| 35 | + description: "aws access key id - Pass in as repo secret" |
| 36 | + aws_secret_access_key: |
| 37 | + required: false |
| 38 | + description: "aws secret access key - Pass in as repo secret" |
| 39 | + slack_notifications_bot_token: |
| 40 | + required: false |
| 41 | + description: "Slack notifications bot token - Pass in as repo secret" |
| 42 | + code_eval_device: |
| 43 | + required: false |
| 44 | + description: "CodeEval device - Pass in as repo secret" |
| 45 | + code_eval_url: |
| 46 | + required: false |
| 47 | + description: "CodeEval URL - Pass in as repo secret" |
| 48 | + code_eval_apikey: |
| 49 | + required: false |
| 50 | + description: "CodeEval API key - Pass in as repo secret" |
| 51 | + gcs_key: |
| 52 | + required: false |
| 53 | + description: "GCS key - Pass in as repo secret" |
| 54 | + gcs_secret: |
| 55 | + required: false |
| 56 | + description: "GCS secret - Pass in as repo secret" |
| 57 | + azure_account_name: |
| 58 | + required: false |
| 59 | + description: "Azure account name - Pass in as repo secret" |
| 60 | + azure_account_access_key: |
| 61 | + required: false |
| 62 | + description: "Azure account access key - Pass in as repo secret" |
| 63 | +runs: |
| 64 | + using: composite |
| 65 | + steps: |
| 66 | + - name: Checkout |
| 67 | + uses: actions/checkout@v3 |
| 68 | + - name: Setup |
| 69 | + shell: bash |
| 70 | + run: | |
| 71 | + set -ex |
| 72 | + export PATH=/composer-python:$PATH |
| 73 | + export COMPOSER_PACKAGE_NAME='${{ inputs.composer_package_name }}' |
| 74 | + python -m pip install --upgrade 'pip<23' wheel |
| 75 | + python -m pip install --upgrade .${{ inputs.pip_deps }} |
| 76 | + - name: Run Tests |
| 77 | + id: tests |
| 78 | + shell: bash |
| 79 | + run: | |
| 80 | + set -ex |
| 81 | + export PATH=/composer-python:$PATH |
| 82 | + export WANDB_API_KEY='${{ inputs.wandb_api_key }}' |
| 83 | + export WANDB_ENTITY='${{ inputs.pytest_wandb_entity }}' |
| 84 | + export WANDB_PROJECT='${{ inputs.pytest_wandb_project }}' |
| 85 | + export AWS_ACCESS_KEY_ID='${{ inputs.aws_access_key_id }}' |
| 86 | + export AWS_SECRET_ACCESS_KEY='${{ inputs.aws_secret_access_key }}' |
| 87 | + export CODE_EVAL_DEVICE='${{ inputs.code_eval_device }}' |
| 88 | + export CODE_EVAL_URL='${{ inputs.code_eval_url }}' |
| 89 | + export CODE_EVAL_APIKEY='${{ inputs.code_eval_apikey }}' |
| 90 | + export GCS_KEY='${{ inputs.gcs_key }}' |
| 91 | + export GCS_SECRET='${{ inputs.gcs_secret }}' |
| 92 | + export AZURE_ACCOUNT_NAME='${{ inputs.azure_account_name }}' |
| 93 | + export AZURE_ACCOUNT_ACCESS_KEY='${{ inputs.azure_account_access_key }}' |
| 94 | + export COMMON_ARGS="-v --durations=20 -m '${{ inputs.pytest_markers }}' -o tmp_path_retention_policy=failed" |
| 95 | +
|
| 96 | + # Necessary to run git diff for doctests |
| 97 | + git config --global --add safe.directory /__w/${{ inputs.safe_directory }}/${{ inputs.safe_directory }} |
| 98 | + make test PYTEST='${{ inputs.pytest_command }}' EXTRA_ARGS="$COMMON_ARGS --codeblocks" |
| 99 | + make test-dist PYTEST='${{ inputs.pytest_command }}' EXTRA_ARGS="$COMMON_ARGS" WORLD_SIZE=2 |
| 100 | +
|
| 101 | + python -m coverage combine |
| 102 | + - uses: actions/upload-artifact@v3 |
| 103 | + with: |
| 104 | + name: coverage-${{ github.sha }}-${{ inputs.name }} |
| 105 | + path: .coverage |
0 commit comments