Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHA release workflow, refactor PR and Daily workflows #1968

Merged
merged 52 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
24c4693
Added BUILD_ARGS field to Docker build matrix yaml, modified flow to …
Feb 14, 2023
2b508f4
Try pretty-print JSON
Feb 14, 2023
d96bb11
Experiments with refactoring
Feb 14, 2023
abda4e1
Refactor and further generalize GHA Docker workflows
Feb 15, 2023
7d8c0c9
Refactor workflow directory structure
Feb 15, 2023
0e23ad6
Merge branch 'dev' into bandish/ci_release
bandish-shah Feb 15, 2023
a598991
Fix trigger ptah
Feb 15, 2023
ebb994d
Apparently the workflow dir can't have sub-directories
Feb 15, 2023
c4cb514
Rrefactor pytest-gpu to reusable workflow, add top-level pr-gpu workflow
Feb 15, 2023
d5b253d
Add pull_request trigger to pr-gpu test
Feb 15, 2023
ecc8de8
Add secrets field to pytest-gpu workflow
Feb 15, 2023
553e858
Add secrets field to top level pr-gpu workflow
Feb 15, 2023
35d0f2d
Fix typos
Feb 15, 2023
5ef22aa
Fix more typos
Feb 15, 2023
85980f6
Merge branch 'dev' into bandish/ci_release
bandish-shah Feb 16, 2023
64dc368
fix pytest-markers reference
Feb 16, 2023
648f6df
Merge branch 'bandish/ci_release' of github.com:mosaicml/composer int…
Feb 16, 2023
8a512fd
Refactor pytest-cpu workflow, added coverage and pr-cpu reusable work…
Feb 17, 2023
525eb6b
Fix typos
Feb 17, 2023
ca0cde2
Fix invalid field
Feb 17, 2023
53b3511
Try creating reusable_workflows folder
Feb 17, 2023
13c4bd7
Revert "Try creating reusable_workflows folder"
Feb 17, 2023
4f0cc0b
Clean up triggers
Feb 17, 2023
22bc54a
Clean up triggers and push for pr-docker workflow
Feb 17, 2023
738de8d
Refactor daily test flow Part 1
Feb 17, 2023
ff37766
Add coverage to daily
Feb 17, 2023
e5c753a
Add gpu tests to daily, fix typos
Feb 17, 2023
5228d98
Add gpu tests to daily, fix typos
Feb 17, 2023
5372b80
Fix GPU timeouts
Feb 17, 2023
494c93d
Merge branch 'dev' into bandish/ci_release
bandish-shah Feb 17, 2023
43cf988
Release packaging workflow
Feb 17, 2023
a8276fe
Fix contains for test pypi job
Feb 17, 2023
6f5c004
Fix pypi-packaging job name
Feb 17, 2023
4b7acc1
Add missing parentheses
Feb 17, 2023
0d84189
Added Docker release workflows
Feb 17, 2023
207cd57
Fixes
Feb 17, 2023
531e610
Got my logic flipped
Feb 17, 2023
b456217
Fix build cache tag parsing
Feb 17, 2023
1915f4d
Fix IMAGE_TAG variable name
bandish-shah Feb 17, 2023
5fb8c40
Fix regex
bandish-shah Feb 17, 2023
2a1aedd
Remove pull_request trigger from release-docker workflow, enable publ…
Feb 18, 2023
fceee45
Merge branch 'dev' into bandish/ci_release
bandish-shah Feb 18, 2023
4833890
minor cleanup, pass secrets
Feb 18, 2023
dacf2fc
Remove pull_request trigger from daily, fix secrets in release
Feb 18, 2023
1135469
guard docker build with tag push
Feb 18, 2023
42fe3c9
Remove pull_request trigger from release workflow
Feb 18, 2023
2c9cbb5
Removed pytest-daily since refactored to daily
Feb 20, 2023
2b518bd
Merge branch 'dev' into bandish/ci_release
bandish-shah Feb 21, 2023
314e924
Address @dakinggg's feedback
Feb 22, 2023
79ab128
Merge branch 'bandish/ci_release' of github.com:mosaicml/composer int…
Feb 22, 2023
b408e70
Address @mvpatel2000's feedback
Feb 22, 2023
1214f70
Merge branch 'dev' into bandish/ci_release
bandish-shah Feb 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PyTest Coverage
on:
workflow_call:
inputs:
download-path:
required: true
type: string
jobs:
coverage:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup
run: |
set -ex
python -m pip install --upgrade 'pip<23' wheel
pip install coverage[toml]==6.5.0
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: ${{ inputs.download-path }}
- name: Generate coverage report
run: |
set -ex

# Flatten the coverage files
ls ${{ inputs.download-path }} | while read x; do mv ${{ inputs.download-path }}/$x/.coverage .coverage.$x; done

python -m coverage combine
python -m coverage report
132 changes: 34 additions & 98 deletions .github/workflows/pytest-daily.yaml → .github/workflows/daily.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pytest-Daily
name: Daily
on:
schedule:
- cron: '30 2 * * *' # 2:30 every day
Expand All @@ -7,19 +7,15 @@ on:
- dev
- main
- release/**
workflow_call:
workflow_dispatch:
# Cancel old runs when a new commit is pushed to the same branch if not on main or dev
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }}
jobs:
pytest-cpu:
timeout-minutes: 45
runs-on: ubuntu-20.04
if: github.repository_owner == 'mosaicml'
daily-pytest-cpu:
uses: ./.github/workflows/pytest-cpu.yaml
strategy:
fail-fast: false
matrix:
include:
- name: 'cpu-3.8-1.11'
Expand Down Expand Up @@ -63,71 +59,31 @@ jobs:
markers: 'daily and (remote or not remote) and not gpu and not vision and doctest'
pytest_command: 'coverage run -m pytest tests/test_docs.py'
name: ${{ matrix.name }}
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v2
- name: Setup
run: |
set -ex
export PATH=/composer-python:$PATH
python -m pip install --upgrade 'pip<23' wheel
python -m pip install --upgrade .[all]
- name: Run Tests
id: tests
run: |
set -ex
export PATH=/composer-python:$PATH
export WANDB_API_KEY='${{ secrets.WANDB_API_KEY }}'
export WANDB_ENTITY='mosaicml-public-integration-tests'
export WANDB_PROJECT="integration-tests-${{ github.sha }}"
export AWS_ACCESS_KEY_ID='${{ secrets.AWS_ACCESS_KEY_ID }}'
export AWS_SECRET_ACCESS_KEY='${{ secrets.AWS_SECRET_ACCESS_KEY }}'
export S3_BUCKET='mosaicml-internal-integration-testing'
export COMMON_ARGS="-v --durations=20 -m '${{ matrix.markers }}' --s3_bucket '$S3_BUCKET'"

# Necessary to run git diff for doctests
git config --global --add safe.directory /__w/composer/composer

make test PYTEST='${{ matrix.pytest_command }}' EXTRA_ARGS="$COMMON_ARGS --codeblocks"
make test-dist PYTEST='${{ matrix.pytest_command }}' EXTRA_ARGS="$COMMON_ARGS" WORLD_SIZE=2

python -m coverage combine
- uses: actions/upload-artifact@v3
with:
name: coverage-${{ github.sha }}-${{ matrix.name }}
path: .coverage
if: github.repository_owner == 'mosaicml'
with:
container: ${{ matrix.container }}
name: ${{ matrix.name }}
pytest-command: ${{ matrix.pytest_command }}
pytest-markers: ${{ matrix.markers }}
pytest-s3-bucket: 'mosaicml-internal-integration-testing'
python-version: 3.9
pytest-wandb-entity: 'mosaicml-public-integration-tests'
pytest-wandb-project: "integration-tests-${{ github.sha }}"
secrets:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
wandb-api-key: ${{ secrets.WANDB_API_KEY }}
coverage:
needs: [ pytest-cpu ]
timeout-minutes: 30
runs-on: ubuntu-20.04
uses: ./.github/workflows/coverage.yaml
name: Coverage Results
if: github.repository_owner == 'mosaicml'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup
run: |
set -ex
python -m pip install --upgrade 'pip<23' wheel
pip install coverage[toml]==6.5.0
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Generate coverage report
run: |
set -ex

# Flatten the coverage files
ls artifacts | while read x; do mv artifacts/$x/.coverage .coverage.$x; done
needs: [ daily-pytest-cpu ]
with:
download-path: artifacts

python -m coverage combine
python -m coverage report
pytest-gpu:
timeout-minutes: 45
runs-on: ubuntu-20.04
if: github.repository_owner == 'mosaicml'
daily-pytest-gpu:
uses: ./.github/workflows/pytest-gpu.yaml
strategy:
fail-fast: false
matrix:
# Unlike CPU tests, we run daily tests together with GPU tests to minimize launch time
# on MCLOUD and not eat up all GPUs at once
Expand All @@ -149,33 +105,13 @@ jobs:
markers: '(daily or not daily) and (remote or not remote) and gpu and (vision or doctest)'
pytest_command: 'coverage run -m pytest'
name: ${{ matrix.name }}
env:
MOSAICML_API_KEY: ${{ secrets.MCLOUD_API_KEY }}
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Cache pip
uses: actions/cache@v2
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 --upgrade mosaicml-cli
mcli init --mcloud
mcli version
- name: Submit Run
id: tests
run: |
set -ex
python .github/mcp/mcp_pytest.py --image '${{ matrix.container }}' --git_commit $GITHUB_SHA --pytest_markers '${{ matrix.markers }}' --pytest_command '${{ matrix.pytest_command }}'
if: github.repository_owner == 'mosaicml'
with:
container: ${{ matrix.container }}
mcloud-timeout: 1800
name: ${{ matrix.name }}
pytest-command: ${{ matrix.pytest_command }}
pytest-markers: ${{ matrix.markers }}
python-version: 3.9
secrets:
mcloud-api-key: ${{ secrets.MCLOUD_API_KEY }}
100 changes: 0 additions & 100 deletions .github/workflows/docker-build.yaml

This file was deleted.

87 changes: 87 additions & 0 deletions .github/workflows/docker-configure-build-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Docker Image Configure-Build-Push
on:
workflow_call:
inputs:
build-args:
required: false
type: string
context:
required: true
type: string
image-name:
required: true
type: string
image-uuid:
required: false
type: string
push:
required: true
type: boolean
staging:
required: true
type: boolean
staging-repo:
required: false
type: string
tags:
required: true
type: string
target:
required: false
type: string
secrets:
username:
required: true
password:
required: true
jobs:
configure-build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup QEMU
uses: docker/setup-qemu-action@v2

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.username }}
password: ${{ secrets.password }}

- name: Calculate Docker Image Variables
run: |
set -euo pipefail

###################
# Calculate the tag
###################
if [ "${{ inputs.staging }}" = "true" ]; then
STAGING_REPO=${{ inputs.staging-repo }}
IMAGE_TAG=${STAGING_REPO}:${{ inputs.image-uuid }}
IMAGE_CACHE="${STAGING_REPO}:${{ inputs.image-name }}-buildcache"
else
IMAGE_TAG=${{ inputs.tags }}
IMAGE_CACHE="${IMAGE_TAG/,*/}-buildcache"
fi

echo "IMAGE_TAG=${IMAGE_TAG}" >> ${GITHUB_ENV}
echo "IMAGE_CACHE=${IMAGE_CACHE}" >> ${GITHUB_ENV}

mvpatel2000 marked this conversation as resolved.
Show resolved Hide resolved
- name: IMAGE_TAG = ${{ env.IMAGE_TAG }}
run: echo ${{ env.IMAGE_TAG }}

- name: Build and Push the Docker Image
uses: docker/build-push-action@v3
with:
context: ${{ inputs.context }}
tags: ${{ env.IMAGE_TAG }}
target: ${{ inputs.target }}
push: ${{ inputs.push }}
cache-from: type=registry,ref=${{ env.IMAGE_CACHE }}
cache-to: type=registry,ref=${{ env.IMAGE_CACHE }},mode=max
build-args: ${{ inputs.build-args }}
Loading