diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index 9eda86ae0d0..ae7cc43bc52 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -53,4 +53,12 @@ jobs: build-args: | BRANCH=${{github.head_ref}} push: true - tags: ghcr.io/neuralmagic/sparseml-dev:${{ inputs.name }} \ No newline at end of file + tags: ghcr.io/neuralmagic/sparseml-dev:${{ inputs.name }} + + - name: Build Nightly Docker Container + if: ${{ inputs.dev == 'false' && inputs.release == 'false'}} + uses: docker/build-push-action@v4 + with: + context: ./docker/containers/docker_nightly + push: true + tags: ghcr.io/neuralmagic/sparseml-nightly:latest, ghcr.io/neuralmagic/sparseml-nightly:${{ steps.date.outputs.date }} \ No newline at end of file diff --git a/.github/workflows/build-nightly.yml b/.github/workflows/build-nightly.yml deleted file mode 100644 index be44d8b863e..00000000000 --- a/.github/workflows/build-nightly.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: build-nightly -run-name: ${{ github.workflow }} is to create nightly wheel file for pypi -on: - push: - branches: - - 'main' - schedule: - - cron: '30 0 * * *' - workflow_dispatch: - - -jobs: - - BUILD-SPARSEML-NIGHTLY: - - uses: ./.github/workflows/util.yml - with: - runs_on: ubuntu-22.04 - run_id: ${{ github.run_id }} - build_type: nightly - testmo_project_id: 9 - secrets: inherit diff --git a/.github/workflows/build-wheel-and-container.yml b/.github/workflows/build-wheel-and-container.yml index 3eaaf674e08..421e227577a 100644 --- a/.github/workflows/build-wheel-and-container.yml +++ b/.github/workflows/build-wheel-and-container.yml @@ -4,15 +4,8 @@ on: types: [opened, synchronize, reopened] branches: - main - - 'release/[0-9]+.[0-9]+' - push: - branches: - - 'release/[0-9]+.[0-9]+' - - main - release: - types: [created, published] schedule: - - cron: '0 0 * * *' + - cron: '0 20 * * *' permissions: id-token: write @@ -23,10 +16,10 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true -# if not dev or release, will create a nightly build +# TODO: do we want to push to nightly everytime we push to main? +# if not dev or release, will create a nightly build; turning off release for now env: - PRODUCTION: ${{ github.event_name == 'schedule' || github.event_name == 'release'}} - RELEASE: ${{ github.event_name =='release' || startsWith(github.base_ref, 'release/') }} + RELEASE: 'false' DEV: ${{ github.base_ref == 'main' && github.event_name == 'pull_request'}} jobs: @@ -42,8 +35,14 @@ jobs: echo "dev=$DEV" >> $GITHUB_OUTPUT echo "release=$RELEASE" >> $GITHUB_OUTPUT - build-wheel-and-push: + test-nightly: needs: set-outputs + if: ${{ needs.set-outputs.outputs.dev == 'false' && needs.set-outputs.outputs.release == 'false'}} + uses: ./.github/workflows/test-nightly.yml + + build-wheel-and-push: + needs: [set-outputs, test-nightly] + if: ${{ always() && needs.set-outputs.outputs.dev == 'false' && needs.test-nightly.result == 'success' || always() && needs.set-outputs.outputs.dev == 'true' && needs.set-outputs.result == 'success' }} uses: ./.github/workflows/build-wheel.yml with: build-label: ubuntu-20.04 @@ -55,22 +54,24 @@ jobs: python: '3.10' secrets: inherit - test-wheel-and-push-internal: - needs: build-wheel-and-push - uses: ./.github/workflows/test-wheel-push-to-internal.yml + test-wheel-and-publish: + needs: [set-outputs, build-wheel-and-push] + if: ${{ always() && !cancelled() && needs.build-wheel-and-push.result == 'success' }} + uses: ./.github/workflows/test-wheel-and-publish.yml with: build-label: ubuntu-20.04 whl: ${{ needs.build-wheel-and-push.outputs.wheel }} python: '3.10' + dev: ${{ needs.set-outputs.outputs.dev }} + release: ${{ needs.set-outputs.outputs.release }} secrets: inherit - # TODO: add nightly and release container build steps once wheel build push - # to production is automated. Removed until then. build-container-and-push: - needs: [set-outputs, test-wheel-and-push-internal] + needs: [test-wheel-and-publish, set-outputs] + if: ${{ always() && !cancelled() && needs.test-wheel-and-publish.result == 'success' }} uses: ./.github/workflows/build-container.yml with: - build-label: k8s-eng-gpu-64G-v100-32G + build-label: k8s-eng-gpu-16G-t4-32G dev: ${{ needs.set-outputs.outputs.dev }} release: ${{ needs.set-outputs.outputs.release }} name: ${{ github.event.number }} diff --git a/.github/workflows/publish-nightly-docker-images.yaml b/.github/workflows/publish-nightly-docker-images.yaml deleted file mode 100644 index 5ca14ac08bc..00000000000 --- a/.github/workflows/publish-nightly-docker-images.yaml +++ /dev/null @@ -1,79 +0,0 @@ -name: Publish Nightly Docker Images - -on: - push: - branches: - - 'main' - schedule: - - cron: '0 1 * * *' - workflow_dispatch: -jobs: - push-nightly-docker-image: - name: Push Version Tagged Nightly Docker Images - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v2 - with: - buildkitd-flags: --debug - - - name: Login to Github Packages - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 1 - - - name: Get version tag - id: extract_tag - run: echo "tag=$(date +%Y%m%d)" >> $GITHUB_OUTPUT - - - name: Current Version Name - run: | - echo ${{ steps.extract_tag.outputs.tag }} - - - name: Sparseml-Nightly latest using default cuda 11.1.1 - uses: docker/build-push-action@v2 - with: - context: ./docker - build-args: | - DEPS=all - BRANCH=main - push: true - tags: | - ghcr.io/neuralmagic/sparseml-nightly:latest - - - name: Today's Sparseml-Nightly using default cuda 11.1.1 - uses: docker/build-push-action@v2 - with: - context: ./docker - build-args: | - DEPS=all - BRANCH=main - push: true - tags: | - ghcr.io/neuralmagic/sparseml-nightly:${{ steps.extract_tag.outputs.tag }} - - - name: Today's Sparseml-Nightly Base using default cuda 11.1.1 - uses: docker/build-push-action@v2 - with: - context: ./docker - build-args: | - DEPS=base - BRANCH=main - push: true - tags: | - ghcr.io/neuralmagic/sparseml-nightly:base-${{ steps.extract_tag.outputs.tag }} - - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.github/workflows/test-nightly.yml b/.github/workflows/test-nightly.yml index 8472b6c8134..4fc1c19cd84 100644 --- a/.github/workflows/test-nightly.yml +++ b/.github/workflows/test-nightly.yml @@ -1,8 +1,7 @@ name: Run Nightly Tests on: - schedule: - - cron: '0 20 * * *' workflow_dispatch: + workflow_call: jobs: test-nightly-tests: runs-on: k8s-mle-gpu-12-vcpu-225GB-ram-2-a6000-48G @@ -33,6 +32,5 @@ jobs: run: | pytest tests/sparseml/transformers/obcq -m integration - name: Run finetune tests - if: always() run: | pytest tests/sparseml/transformers/finetune -m integration \ No newline at end of file diff --git a/.github/workflows/test-wheel-push-to-internal.yml b/.github/workflows/test-wheel-and-publish.yml similarity index 57% rename from .github/workflows/test-wheel-push-to-internal.yml rename to .github/workflows/test-wheel-and-publish.yml index 28af2f272e7..e40fa462ded 100644 --- a/.github/workflows/test-wheel-push-to-internal.yml +++ b/.github/workflows/test-wheel-and-publish.yml @@ -1,4 +1,4 @@ -name: Test Wheel and Push to Internal PyPi +name: Test Wheel and Publish on: workflow_call: inputs: @@ -11,9 +11,15 @@ on: required: true python: type: string + dev: + type: string + required: true + release: + type: string + required: true jobs: - test-wheel-and-push-internal: + test-wheel-and-publish: runs-on: ${{ inputs.build-label }} steps: - uses: actions/setup-python@v4 @@ -36,24 +42,37 @@ jobs: filename: ${{ inputs.whl }} dst: dist_s3 - - name: Set Env - run: | - pip3 install virtualenv - virtualenv venv - source venv/bin/activate - - name: Fetch name of whl run: | echo "FILENAME=$(echo dist_s3/*.whl)" >> $GITHUB_ENV - name: Install whl run: | - pip3 install $FILENAME[dev] + pip3 install $FILENAME[dev,onnxruntime,torch,torchvision,transformers] - name: Checkout code uses: actions/checkout@v3 - name: Remove src files and run tests run: | + pwd rm -rf src - make test \ No newline at end of file + make test + + - name: Make directory for wheel + run: | + mkdir dist_s3 + + - name: Pull from s3 + uses: neuralmagic/nm-actions/actions/s3_pull@main + with: + filename: ${{ inputs.whl }} + dst: dist_s3 + + - name: Publish Nightly Wheel + if: ${{ inputs.DEV == 'false' && inputs.RELEASE == 'false'}} + uses: neuralmagic/nm-actions/actions/publish-whl@main + with: + username: ${{ secrets.PYPI_PUBLIC_USER }} + password: ${{ secrets.PYPI_PUBLIC_AUTH }} + whl: ./$FILENAME \ No newline at end of file