forked from mosaicml/llm-foundry
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (81 loc) · 2.44 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
name: Pytest GPU
on:
workflow_call:
inputs:
container:
required: true
type: string
mcloud-timeout:
required: false
type: number
default: 1800
name:
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
deps-group:
required: true
type: string
secrets:
mcloud-api-key:
required: true
jobs:
pytest-gpu:
timeout-minutes: 60 # ${{ inputs.gha-timeout }} for some reason not able to turn this into an input
runs-on: ubuntu-latest
env:
MOSAICML_API_KEY: ${{ secrets.mcloud-api-key }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- 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 init --mcloud
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/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/mcp/mcp_pytest.py \
--image '${{ inputs.container }}' \
--pytest_markers '${{ inputs.pytest-markers }}' \
--pytest_command '${{ inputs.pytest-command }}' \
--timeout ${{ inputs.mcloud-timeout }} ${REF_ARGS} \
--deps_group ${{ inputs.deps-group }}