Skip to content

Commit 68c93d8

Browse files
authored
Use aciton.yaml and omit default runner (#18)
* Use aciton.yaml and omit default runner * add latest as default tag * latest * ci_repo_ref * Update README.md * Update action.yaml * add env * add python version * test out auto ref and add description * revert * delete workflows * description * Update action.yaml * Update action.yaml * Update README.md * Required at top
1 parent fd81d01 commit 68c93d8

File tree

5 files changed

+240
-216
lines changed

5 files changed

+240
-216
lines changed
+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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
+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Pytest GPU
2+
inputs:
3+
name:
4+
required: true
5+
type: string
6+
container:
7+
required: true
8+
type: string
9+
gpu_num:
10+
required: true
11+
type: number
12+
git_repo:
13+
required: true
14+
type: string
15+
ci_repo_gpu_test_ref:
16+
description: "CI repo version of the GPU tests to run"
17+
required: true
18+
type: string
19+
pip_deps:
20+
required: true
21+
type: string
22+
pytest_command:
23+
required: true
24+
type: string
25+
pytest_markers:
26+
required: true
27+
type: string
28+
mcloud_api_key:
29+
required: true
30+
description: "MosaicML API key - Pass in as repo secret"
31+
python_version:
32+
required: false
33+
type: string
34+
default: 3.9
35+
mcloud_timeout:
36+
required: false
37+
type: number
38+
default: 2700
39+
composer_package_name:
40+
required: false
41+
type: string
42+
gha_timeout:
43+
required: false
44+
type: number
45+
default: 60
46+
git_ssh_clone:
47+
required: false
48+
type: boolean
49+
default: false
50+
slack_notifications_bot_token:
51+
required: false
52+
description: "Slack notifications bot token - Pass in as repo secret"
53+
code_eval_device:
54+
required: false
55+
description: "CodeEval device - Pass in as repo secret"
56+
code_eval_url:
57+
required: false
58+
description: "CodeEval URL - Pass in as repo secret"
59+
code_eval_apikey:
60+
required: false
61+
description: "CodeEval API key - Pass in as repo secret"
62+
runs:
63+
using: composite
64+
steps:
65+
- name: Checkout Repo
66+
uses: actions/checkout@v3
67+
with:
68+
repository: "mosaicml/ci-testing"
69+
ref: ${{ inputs.ci_repo_gpu_test_ref }}
70+
- name: Setup Python
71+
uses: actions/setup-python@v4
72+
with:
73+
python-version: ${{ inputs.python_version }}
74+
- name: Cache pip
75+
uses: actions/cache@v3
76+
with:
77+
# This path is specific to Ubuntu
78+
path: ~/.cache/pip
79+
# Look to see if there is a cache hit for the corresponding requirements file
80+
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
81+
restore-keys: |
82+
${{ runner.os }}-pip-
83+
${{ runner.os }}-
84+
- name: Setup MCLI
85+
shell: bash
86+
run: |
87+
set -ex
88+
python -m pip install mosaicml-cli
89+
mcli version
90+
- name: Submit Run
91+
id: tests
92+
shell: bash
93+
env:
94+
MOSAICML_API_KEY: ${{ inputs.mcloud_api_key }}
95+
SLACK_NOTIFICATIONS_BOT_TOKEN: ${{ inputs.slack_notifications_bot_token }}
96+
CODE_EVAL_DEVICE: ${{ inputs.code_eval_device }}
97+
CODE_EVAL_URL: ${{ inputs.code_eval_url }}
98+
CODE_EVAL_APIKEY: ${{ inputs.code_eval_apikey }}
99+
run: |
100+
set -ex
101+
102+
PR_NUMBER="$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")"
103+
REF_ARGS=""
104+
105+
# Use the PR number if it exists, commit SHA for protected branches and the branch name otherwise
106+
if [ -z "$PR_NUMBER" ] || [ "$PR_NUMBER" = "null" ]; then
107+
if [[ "$GITHUB_REF" =~ "refs/heads/dev" || "$GITHUB_REF" =~ "refs/heads/main" || \
108+
"$GITHUB_REF" =~ "refs/heads/release" ]]; then
109+
REF_ARGS="--git_commit $GITHUB_SHA"
110+
else
111+
REF_ARGS="--git_branch $GITHUB_REF_NAME"
112+
fi
113+
else
114+
REF_ARGS="--pr_number $PR_NUMBER"
115+
fi
116+
117+
python .github/mcli/mcli_pytest.py \
118+
--image '${{ inputs.container }}' \
119+
--git_repo '${{ inputs.git_repo }}' \
120+
--pip_deps '${{ inputs.pip_deps }}' \
121+
--pip_package_name '${{ inputs.composer_package_name }}' \
122+
--pytest_markers '${{ inputs.pytest_markers }}' \
123+
--pytest_command '${{ inputs.pytest_command }}' \
124+
--timeout ${{ inputs.mcloud_timeout }} \
125+
--gpu_num ${{ inputs.gpu_num }} \
126+
--git_ssh_clone ${{ inputs.git_ssh_clone }} \
127+
${REF_ARGS}

.github/workflows/pytest-cpu.yaml

-98
This file was deleted.

0 commit comments

Comments
 (0)