Skip to content

Commit 20f7f47

Browse files
authored
Merge branch 'dev' into nik/lpln
2 parents 7a20f4a + be40689 commit 20f7f47

14 files changed

+480
-308
lines changed

.github/workflows/coverage.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: PyTest Coverage
2+
on:
3+
workflow_call:
4+
inputs:
5+
download-path:
6+
required: true
7+
type: string
8+
jobs:
9+
coverage:
10+
timeout-minutes: 5
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repo
14+
uses: actions/checkout@v3
15+
- name: Setup
16+
run: |
17+
set -ex
18+
python -m pip install --upgrade 'pip<23' wheel
19+
pip install coverage[toml]==6.5.0
20+
- name: Download artifacts
21+
uses: actions/download-artifact@v3
22+
with:
23+
path: ${{ inputs.download-path }}
24+
- name: Generate coverage report
25+
run: |
26+
set -ex
27+
28+
# Flatten the coverage files
29+
ls ${{ inputs.download-path }} | while read x; do mv ${{ inputs.download-path }}/$x/.coverage .coverage.$x; done
30+
31+
python -m coverage combine
32+
python -m coverage report
Lines changed: 33 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pytest-Daily
1+
name: Daily
22
on:
33
schedule:
44
- cron: '30 2 * * *' # 2:30 every day
@@ -7,19 +7,15 @@ on:
77
- dev
88
- main
99
- release/**
10-
workflow_call:
1110
workflow_dispatch:
1211
# Cancel old runs when a new commit is pushed to the same branch if not on main or dev
1312
concurrency:
1413
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1514
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }}
1615
jobs:
17-
pytest-cpu:
18-
timeout-minutes: 45
19-
runs-on: ubuntu-20.04
20-
if: github.repository_owner == 'mosaicml'
16+
daily-pytest-cpu:
17+
uses: ./.github/workflows/pytest-cpu.yaml
2118
strategy:
22-
fail-fast: false
2319
matrix:
2420
include:
2521
- name: 'cpu-3.8-1.11'
@@ -63,71 +59,30 @@ jobs:
6359
markers: 'daily and (remote or not remote) and not gpu and not vision and doctest'
6460
pytest_command: 'coverage run -m pytest tests/test_docs.py'
6561
name: ${{ matrix.name }}
66-
container: ${{ matrix.container }}
67-
steps:
68-
- uses: actions/checkout@v2
69-
- name: Setup
70-
run: |
71-
set -ex
72-
export PATH=/composer-python:$PATH
73-
python -m pip install --upgrade 'pip<23' wheel
74-
python -m pip install --upgrade .[all]
75-
- name: Run Tests
76-
id: tests
77-
run: |
78-
set -ex
79-
export PATH=/composer-python:$PATH
80-
export WANDB_API_KEY='${{ secrets.WANDB_API_KEY }}'
81-
export WANDB_ENTITY='mosaicml-public-integration-tests'
82-
export WANDB_PROJECT="integration-tests-${{ github.sha }}"
83-
export AWS_ACCESS_KEY_ID='${{ secrets.AWS_ACCESS_KEY_ID }}'
84-
export AWS_SECRET_ACCESS_KEY='${{ secrets.AWS_SECRET_ACCESS_KEY }}'
85-
export S3_BUCKET='mosaicml-internal-integration-testing'
86-
export COMMON_ARGS="-v --durations=20 -m '${{ matrix.markers }}' --s3_bucket '$S3_BUCKET'"
87-
88-
# Necessary to run git diff for doctests
89-
git config --global --add safe.directory /__w/composer/composer
90-
91-
make test PYTEST='${{ matrix.pytest_command }}' EXTRA_ARGS="$COMMON_ARGS --codeblocks"
92-
make test-dist PYTEST='${{ matrix.pytest_command }}' EXTRA_ARGS="$COMMON_ARGS" WORLD_SIZE=2
93-
94-
python -m coverage combine
95-
- uses: actions/upload-artifact@v3
96-
with:
97-
name: coverage-${{ github.sha }}-${{ matrix.name }}
98-
path: .coverage
62+
if: github.repository_owner == 'mosaicml'
63+
with:
64+
container: ${{ matrix.container }}
65+
name: ${{ matrix.name }}
66+
pytest-command: ${{ matrix.pytest_command }}
67+
pytest-markers: ${{ matrix.markers }}
68+
pytest-s3-bucket: 'mosaicml-internal-integration-testing'
69+
pytest-wandb-entity: 'mosaicml-public-integration-tests'
70+
pytest-wandb-project: "integration-tests-${{ github.sha }}"
71+
secrets:
72+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
73+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
74+
wandb-api-key: ${{ secrets.WANDB_API_KEY }}
9975
coverage:
100-
needs: [ pytest-cpu ]
101-
timeout-minutes: 30
102-
runs-on: ubuntu-20.04
76+
uses: ./.github/workflows/coverage.yaml
77+
name: Coverage Results
10378
if: github.repository_owner == 'mosaicml'
104-
steps:
105-
- name: Checkout
106-
uses: actions/checkout@v2
107-
- name: Setup
108-
run: |
109-
set -ex
110-
python -m pip install --upgrade 'pip<23' wheel
111-
pip install coverage[toml]==6.5.0
112-
- name: Download artifacts
113-
uses: actions/download-artifact@v3
114-
with:
115-
path: artifacts
116-
- name: Generate coverage report
117-
run: |
118-
set -ex
119-
120-
# Flatten the coverage files
121-
ls artifacts | while read x; do mv artifacts/$x/.coverage .coverage.$x; done
79+
needs: [ daily-pytest-cpu ]
80+
with:
81+
download-path: artifacts
12282

123-
python -m coverage combine
124-
python -m coverage report
125-
pytest-gpu:
126-
timeout-minutes: 45
127-
runs-on: ubuntu-20.04
128-
if: github.repository_owner == 'mosaicml'
83+
daily-pytest-gpu:
84+
uses: ./.github/workflows/pytest-gpu.yaml
12985
strategy:
130-
fail-fast: false
13186
matrix:
13287
# Unlike CPU tests, we run daily tests together with GPU tests to minimize launch time
13388
# on MCLOUD and not eat up all GPUs at once
@@ -149,33 +104,13 @@ jobs:
149104
markers: '(daily or not daily) and (remote or not remote) and gpu and (vision or doctest)'
150105
pytest_command: 'coverage run -m pytest'
151106
name: ${{ matrix.name }}
152-
env:
153-
MOSAICML_API_KEY: ${{ secrets.MCLOUD_API_KEY }}
154-
steps:
155-
- name: Checkout Repo
156-
uses: actions/checkout@v2
157-
- name: Setup Python
158-
uses: actions/setup-python@v2
159-
with:
160-
python-version: 3.9
161-
- name: Cache pip
162-
uses: actions/cache@v2
163-
with:
164-
# This path is specific to Ubuntu
165-
path: ~/.cache/pip
166-
# Look to see if there is a cache hit for the corresponding requirements file
167-
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
168-
restore-keys: |
169-
${{ runner.os }}-pip-
170-
${{ runner.os }}-
171-
- name: Setup MCLI
172-
run: |
173-
set -ex
174-
python -m pip install --upgrade mosaicml-cli
175-
mcli init --mcloud
176-
mcli version
177-
- name: Submit Run
178-
id: tests
179-
run: |
180-
set -ex
181-
python .github/mcp/mcp_pytest.py --image '${{ matrix.container }}' --git_commit $GITHUB_SHA --pytest_markers '${{ matrix.markers }}' --pytest_command '${{ matrix.pytest_command }}'
107+
if: github.repository_owner == 'mosaicml'
108+
with:
109+
container: ${{ matrix.container }}
110+
mcloud-timeout: 1800
111+
name: ${{ matrix.name }}
112+
pytest-command: ${{ matrix.pytest_command }}
113+
pytest-markers: ${{ matrix.markers }}
114+
python-version: 3.9
115+
secrets:
116+
mcloud-api-key: ${{ secrets.MCLOUD_API_KEY }}

.github/workflows/docker-build.yaml

Lines changed: 0 additions & 100 deletions
This file was deleted.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Docker Image Configure-Build-Push
2+
on:
3+
workflow_call:
4+
inputs:
5+
build-args:
6+
required: false
7+
type: string
8+
context:
9+
required: true
10+
type: string
11+
image-name:
12+
required: true
13+
type: string
14+
image-uuid:
15+
required: false
16+
type: string
17+
push:
18+
required: true
19+
type: boolean
20+
staging:
21+
required: true
22+
type: boolean
23+
staging-repo:
24+
required: false
25+
type: string
26+
tags:
27+
required: true
28+
type: string
29+
target:
30+
required: false
31+
type: string
32+
secrets:
33+
username:
34+
required: true
35+
password:
36+
required: true
37+
jobs:
38+
configure-build-push:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v3
43+
44+
- name: Setup QEMU
45+
uses: docker/setup-qemu-action@v2
46+
47+
- name: Setup Docker Buildx
48+
uses: docker/setup-buildx-action@v2
49+
50+
- name: Login to DockerHub
51+
uses: docker/login-action@v2
52+
with:
53+
username: ${{ secrets.username }}
54+
password: ${{ secrets.password }}
55+
56+
- name: Calculate Docker Image Variables
57+
run: |
58+
set -euo pipefail
59+
60+
###################
61+
# Calculate the tag
62+
###################
63+
if [ "${{ inputs.staging }}" = "true" ]; then
64+
STAGING_REPO=${{ inputs.staging-repo }}
65+
IMAGE_TAG=${STAGING_REPO}:${{ inputs.image-uuid }}
66+
IMAGE_CACHE="${STAGING_REPO}:${{ inputs.image-name }}-buildcache"
67+
else
68+
IMAGE_TAG=${{ inputs.tags }}
69+
IMAGE_CACHE="${IMAGE_TAG/,*/}-buildcache"
70+
fi
71+
72+
echo "IMAGE_TAG=${IMAGE_TAG}" >> ${GITHUB_ENV}
73+
echo "IMAGE_CACHE=${IMAGE_CACHE}" >> ${GITHUB_ENV}
74+
75+
- name: IMAGE_TAG = ${{ env.IMAGE_TAG }}
76+
run: echo ${{ env.IMAGE_TAG }}
77+
78+
- name: Build and Push the Docker Image
79+
uses: docker/build-push-action@v3
80+
with:
81+
context: ${{ inputs.context }}
82+
tags: ${{ env.IMAGE_TAG }}
83+
target: ${{ inputs.target }}
84+
push: ${{ inputs.push }}
85+
cache-from: type=registry,ref=${{ env.IMAGE_CACHE }}
86+
cache-to: type=registry,ref=${{ env.IMAGE_CACHE }},mode=max
87+
build-args: ${{ inputs.build-args }}

0 commit comments

Comments
 (0)