-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (117 loc) · 3.36 KB
/
pytest-gpu.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Pytest GPU
on:
workflow_call:
inputs:
container:
required: true
type: string
gha-timeout:
required: false
type: number
default: 60
git_repo:
required: true
type: string
name:
required: true
type: string
pip_deps:
required: true
type: string
pytest-command:
required: true
type: string
pytest-markers:
required: true
type: string
python-version:
required: false
type: string
default: 3.9
mcloud-timeout:
required: false
type: number
default: 2700
composer_package_name:
required: false
type: string
git-ssh-clone:
required: false
type: boolean
default: false
gpu_configurations:
required: true
type: string
secrets:
mcloud-api-key:
required: true
slack-notifications-bot-token:
required: false
code-eval-device:
required: false
code-eval-url:
required: false
code-eval-apikey:
required: false
jobs:
pytest-gpu:
timeout-minutes: ${{ inputs.gha-timeout }}
runs-on: ubuntu-latest
strategy:
matrix:
gpu_num: [${{ fromJSON(inputs.gpu_configurations) }}]
name: Pytest GPU ${{ matrix.gpu_num }}
env:
MOSAICML_API_KEY: ${{ secrets.mcloud-api-key }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
repository: "mosaicml/ci-testing"
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
- name: Cache pip
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Setup MCLI
run: |
set -ex
python -m pip install mosaicml-cli
mcli version
- name: Submit Run
id: tests
run: |
set -ex
PR_NUMBER="$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")"
REF_ARGS=""
# Use the PR number if it exists, commit SHA for protected branches and the branch name otherwise
if [ -z "$PR_NUMBER" ] || [ "$PR_NUMBER" = "null" ]; then
if [[ "$GITHUB_REF" =~ "refs/heads/dev" || "$GITHUB_REF" =~ "refs/heads/main" || \
"$GITHUB_REF" =~ "refs/heads/release" ]]; then
REF_ARGS="--git_commit $GITHUB_SHA"
else
REF_ARGS="--git_branch $GITHUB_REF_NAME"
fi
else
REF_ARGS="--pr_number $PR_NUMBER"
fi
python .github/mcli/mcli_pytest.py \
--image '${{ inputs.container }}' \
--git_repo '${{ inputs.git_repo }}' \
--pip_deps '${{ inputs.pip_deps }}' \
--pip_package_name '${{ inputs.composer_package_name }}' \
--pytest_markers '${{ inputs.pytest-markers }}' \
--pytest_command '${{ inputs.pytest-command }}' \
--timeout ${{ inputs.mcloud-timeout }} \
--gpu_num ${{ matrix.gpu_num }} \
--git_ssh_clone ${{ inputs.git-ssh-clone }} \
${REF_ARGS}