From 2640b2994acf99a4f811c7f807a4d05fa620e54c Mon Sep 17 00:00:00 2001 From: v-chen_data Date: Tue, 22 Oct 2024 13:06:10 -0700 Subject: [PATCH 1/4] change base --- .github/workflows/release.yaml | 50 ++-------------------------------- 1 file changed, 2 insertions(+), 48 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 15c83035e0..52c936a295 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,54 +7,8 @@ on: workflow_dispatch: jobs: - code-quality: - uses: ./.github/workflows/code-quality.yaml - - pypi-packaging: - name: Build and Publish llm-foundry PyPI Package - needs: - - code-quality - runs-on: linux-ubuntu-latest - steps: - - name: Checkout source - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: "3.9" - - - name: Build source and wheel distributions - run: | - if [[ "${{ github.ref }}" =~ refs\/tags\/v ]]; then - PYPI_PACKAGE_NAME="llm-foundry" - else - PYPI_PACKAGE_NAME="llm-foundry-test-$(date +%Y%m%d%H%M%S)" - fi - - python -m pip install --upgrade build twine - python -m build - twine check --strict dist/* - - - name: Publish 📦 to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - if: contains(github.ref, 'refs/tags/v') - with: - user: __token__ - password: ${{ secrets.PROD_PYPI_API_TOKEN }} - - - name: Publish distribution 📦 to Test PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - if: contains(github.ref, 'refs/heads/') || contains(github.ref, 'refs/pull/') - with: - user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - build-docker: name: Build llm-foundry Release Docker Image - needs: - - code-quality runs-on: mosaic-8wide if: github.repository_owner == 'mosaicml' steps: @@ -93,7 +47,7 @@ jobs: ${{ env.AWS_DOCKER_TAG }} ${{ env.AWS_LATEST_TAG }} build-args: | - BASE_IMAGE=mosaicml/pytorch:2.4.0_cu124-python3.11-ubuntu20.04-aws + BASE_IMAGE=mosaicml/llm-foundry:2.4.0_cu124-latest BRANCH_NAME=${{ env.BRANCH_NAME }} DEP_GROUPS=[all] KEEP_FOUNDRY=true @@ -108,7 +62,7 @@ jobs: ${{ env.DOCKER_TAG }} ${{ env.LATEST_TAG }} build-args: | - BASE_IMAGE=mosaicml/pytorch:2.4.0_cu124-python3.11-ubuntu20.04 + BASE_IMAGE=mosaicml/llm-foundry:2.4.0_cu124-latest BRANCH_NAME=${{ env.BRANCH_NAME }} DEP_GROUPS=[all] KEEP_FOUNDRY=true From 9d0c9fce7561e1c9130bbcb93b2a281e6891d9d1 Mon Sep 17 00:00:00 2001 From: v-chen_data Date: Tue, 22 Oct 2024 13:21:00 -0700 Subject: [PATCH 2/4] safeguard --- .github/workflows/release.yaml | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 52c936a295..467f738a11 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,8 +7,54 @@ on: workflow_dispatch: jobs: + code-quality: + uses: ./.github/workflows/code-quality.yaml + + pypi-packaging: + name: Build and Publish llm-foundry PyPI Package + needs: + - code-quality + runs-on: linux-ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: "3.9" + + - name: Build source and wheel distributions + run: | + if [[ "${{ github.ref }}" =~ refs\/tags\/v ]]; then + PYPI_PACKAGE_NAME="llm-foundry" + else + PYPI_PACKAGE_NAME="llm-foundry-test-$(date +%Y%m%d%H%M%S)" + fi + + python -m pip install --upgrade build twine + python -m build + twine check --strict dist/* + + - name: Publish 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: contains(github.ref, 'refs/tags/v') + with: + user: __token__ + password: ${{ secrets.PROD_PYPI_API_TOKEN }} + + - name: Publish distribution 📦 to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: contains(github.ref, 'refs/heads/') || contains(github.ref, 'refs/pull/') + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + build-docker: name: Build llm-foundry Release Docker Image + needs: + - code-quality runs-on: mosaic-8wide if: github.repository_owner == 'mosaicml' steps: From 93913c2b0a53316d59ca227afde904d3557bcfb3 Mon Sep 17 00:00:00 2001 From: v-chen_data Date: Tue, 22 Oct 2024 13:21:10 -0700 Subject: [PATCH 3/4] safeguard --- .github/workflows/release.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 467f738a11..2d37d38651 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -77,10 +77,16 @@ jobs: TAG_NAME=$(echo "${BRANCH_NAME}" | sed 's/\//_/g') echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV - echo "DOCKER_TAG=mosaicml/llm-foundry:release_${TAG_NAME}" >> $GITHUB_ENV - echo "AWS_DOCKER_TAG=mosaicml/llm-foundry:release_${TAG_NAME}_aws" >> $GITHUB_ENV - echo "LATEST_TAG=mosaicml/llm-foundry:release-latest" >> $GITHUB_ENV - echo "AWS_LATEST_TAG=mosaicml/llm-foundry:release_aws-latest" >> $GITHUB_ENV + # Don't overwrite latest if testing + if [[ "${GITHUB_EVENT_NAME}" == "push" && "${GITHUB_REF}" =~ ^refs/tags/v ]]; then + echo "DOCKER_TAG=mosaicml/llm-foundry:release_${TAG_NAME}" >> $GITHUB_ENV + echo "AWS_DOCKER_TAG=mosaicml/llm-foundry:release_${TAG_NAME}_aws" >> $GITHUB_ENV + echo "LATEST_TAG=mosaicml/llm-foundry:release-latest" >> $GITHUB_ENV + echo "AWS_LATEST_TAG=mosaicml/llm-foundry:release_aws-latest" >> $GITHUB_ENV + else + echo "DOCKER_TAG=mosaicml/llm-foundry:test_release_${TAG_NAME}" >> $GITHUB_ENV + echo "AWS_DOCKER_TAG=mosaicml/llm-foundry:test_release_${TAG_NAME}_aws" >> $GITHUB_ENV + fi - name: Build and push AWS Docker image From 2bbb30de0a76743bfe9c88e8f19aa83b4c453302 Mon Sep 17 00:00:00 2001 From: v-chen_data Date: Tue, 22 Oct 2024 13:24:56 -0700 Subject: [PATCH 4/4] nit comment --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2d37d38651..fd0ba95e83 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -77,7 +77,7 @@ jobs: TAG_NAME=$(echo "${BRANCH_NAME}" | sed 's/\//_/g') echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV - # Don't overwrite latest if testing + # Don't trigger formal release if manual trigger if [[ "${GITHUB_EVENT_NAME}" == "push" && "${GITHUB_REF}" =~ ^refs/tags/v ]]; then echo "DOCKER_TAG=mosaicml/llm-foundry:release_${TAG_NAME}" >> $GITHUB_ENV echo "AWS_DOCKER_TAG=mosaicml/llm-foundry:release_${TAG_NAME}_aws" >> $GITHUB_ENV