diff --git a/.github/workflows/_build_container.yml b/.github/workflows/_build_container.yml deleted file mode 100644 index 314338ff9..000000000 --- a/.github/workflows/_build_container.yml +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright (c) 2020-2021, NVIDIA CORPORATION. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -name: Build NeMo Aligner container -on: - workflow_call: - inputs: - ref: - description: Git ref to checkout - default: ${{ github.sha }} - required: false - type: string - -defaults: - run: - shell: bash -x -e -u -o pipefail {0} - -jobs: - main: - runs-on: self-hosted-azure-builder - steps: - - name: Clean runner cache - run: | - docker system prune --filter "until=24h" --force - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - # We use `docker` driver as this speeds things up for - # trivial (non-multi-stage) builds. - driver: docker - - - name: Pull cache images - run: | - docker pull nemoci.azurecr.io/nemo_aligner_container:${{ github.event.pull_request.number || 'buildcache' }} || true - docker pull nemoci.azurecr.io/nemo_aligner_container:buildcache || true - - - name: Build and push - uses: docker/build-push-action@v5 - with: - file: Dockerfile - push: true - build-args: | - MAX_JOBS=32 - ALIGNER_COMMIT=${{ inputs.ref }} - cache-from: | - nemoci.azurecr.io/nemo_aligner_container:${{ github.event.pull_request.number || 'buildcache' }} - nemoci.azurecr.io/nemo_aligner_container:buildcache - cache-to: type=inline - tags: nemoci.azurecr.io/nemo_aligner_container:${{ github.run_id }} - - - name: Update PR image - if: github.event_name == 'pull_request' - run: | - docker tag nemoci.azurecr.io/nemo_aligner_container:${{ github.run_id }} nemoci.azurecr.io/nemo_aligner_container:${{ github.event.pull_request.number }} - docker push nemoci.azurecr.io/nemo_aligner_container:${{ github.event.pull_request.number }} - - - name: Update buildcache image - if: github.ref == 'refs/heads/main' - run: | - docker tag nemoci.azurecr.io/nemo_aligner_container:${{ github.run_id }} nemoci.azurecr.io/nemo_aligner_container:buildcache - docker push nemoci.azurecr.io/nemo_aligner_container:buildcache \ No newline at end of file diff --git a/.github/workflows/cicd-main.yml b/.github/workflows/cicd-main.yml index 5c747a851..97ca07da4 100644 --- a/.github/workflows/cicd-main.yml +++ b/.github/workflows/cicd-main.yml @@ -54,7 +54,14 @@ jobs: build-container: if: ${{ github.event.label.name == 'Run CICD' || github.ref == 'refs/heads/main' }} - uses: ./.github/workflows/_build_container.yml + uses: NVIDIA/NeMo-FW-CI-templates/.github/workflows/_build_container.yml@v0.1.0 + with: + image-name: nemo_aligner_container + dockerfile: Dockerfile + image-label: nemo-aligner + build-args: | + MAX_JOBS=32 + ALIGNER_COMMIT=${{ github.event.pull_request.head.sha || github.sha }} Unit_Tests: name: ${{ matrix.test_case }} diff --git a/.github/workflows/release-freeze.yml b/.github/workflows/release-freeze.yml index b0762e320..8c7593cf9 100644 --- a/.github/workflows/release-freeze.yml +++ b/.github/workflows/release-freeze.yml @@ -12,119 +12,11 @@ on: - pre_release jobs: - create-release-branch: - runs-on: ubuntu-latest - if: contains(fromJSON('["ko3n1g"]'), github.actor) - environment: - name: main - outputs: - version: ${{ steps.release-branch.outputs.version }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - path: ${{ github.run_id }} - fetch-depth: 0 - fetch-tags: true - ref: main - token: ${{ secrets.PAT }} - - - name: Get release branch ref - id: release-branch - run: | - cd ${{ github.run_id }} - - if [[ "${{ inputs.type_of_release }}" != "pre_release" ]]; then - sed -i "/^PRE_RELEASE/c\PRE_RELEASE = ''" nemo_aligner/package_info.py - fi - - VERSION=$(python -c 'import nemo_aligner; print(nemo_aligner.__version__)') - - echo "Release version r$VERSION" > version - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - git switch --force-create r$VERSION origin/main - git push -u origin r$VERSION --force - - bump-next-version: - runs-on: ubuntu-latest - needs: [create-release-branch] - environment: - name: main - env: - VERSION_FILE: nemo_aligner/package_info.py - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - path: ${{ github.run_id }} - fetch-depth: 0 - fetch-tags: true - ref: main - token: ${{ secrets.PAT }} - - - name: Bump version - id: bump-version - run: | - cd ${{ github.run_id }} - PRE_RELEASE=$(cat nemo_aligner/package_info.py | awk '/^PRE_RELEASE = /' | awk -F"= " '{print $2}' | tr -d '"' | tr -d "'") - MAJOR=$(cat nemo_aligner/package_info.py | awk '/^MAJOR = /' | awk -F"= " '{print $2}') - MINOR=$(cat nemo_aligner/package_info.py | awk '/^MINOR = /' | awk -F"= " '{print $2}') - PATCH=$(cat nemo_aligner/package_info.py | awk '/^PATCH = /' | awk -F"= " '{print $2}') - - if [[ "${{ inputs.type_of_release }}" == "pre_release" ]]; then - NEXT_MAJOR=$MAJOR - NEXT_MINOR=$MINOR - NEXT_PRE_RELEASE=rc$(( $(echo $PRE_RELEASE | awk -F"rc" '{print $2}') + 1)) - elif [[ "${{ inputs.type_of_release }}" == "major" ]]; then - NEXT_MAJOR=$(( MAJOR + 1)) - NEXT_MINOR=0 - NEXT_PRE_RELEASE=rc0 - else - NEXT_MAJOR=$MAJOR - NEXT_MINOR=$(( MINOR + 1)) - NEXT_PRE_RELEASE=rc0 - fi - - sed -i "/^MAJOR/c\MAJOR = $NEXT_MAJOR" nemo_aligner/package_info.py - sed -i "/^MINOR/c\MINOR = $NEXT_MINOR" nemo_aligner/package_info.py - sed -i "/^PRE_RELEASE/c\PRE_RELEASE = '$NEXT_PRE_RELEASE'" nemo_aligner/package_info.py - - echo "version=$NEXT_MAJOR.$NEXT_MINOR.$PATCH$NEXT_PRE_RELEASE" >> "$GITHUB_OUTPUT" - - - name: Create Version Bump PR - uses: peter-evans/create-pull-request@v6 - id: create-pull-request - with: - path: ${{ github.run_id }} - branch: bot/chore/version-bump-${{ steps.bump-version.outputs.version }} - title: 'Version bump to `${{ steps.bump-version.outputs.version }}`' - body: | - 🚀 Version bump NeMo-Aligner to `${{ steps.bump-version.outputs.version }}` - - commit-message: "[🤠]: Howdy folks, let's bump NeMo-Aligner `${{ steps.bump-version.outputs.version }}` !" - signoff: true - assignees: okoenig - labels: 'Run CICD' - - notify: - runs-on: ubuntu-latest - needs: [create-release-branch, bump-next-version] - environment: - name: main - steps: - - name: Main - run: | - MESSAGE='{ - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "Releasebot 🤖: NeMo-Aligner has been frozen 🎉 to branch `r${{ needs.create-release-branch.outputs.version }}`" - } - } - ] - }' - - curl -X POST -H "Content-type: application/json" --data "$MESSAGE" ${{ secrets.SLACK_RELEASE_ENDPOINT }} \ No newline at end of file + code-freeze: + uses: NVIDIA/NeMo-FW-CI-templates/.github/workflows/_code_freeze.yml@v0.1.0 + with: + name_of_library: NeMo-Aligner + type_of_release: ${{ inputs.type_of_release }} + python_package: nemo_aligner + secrets: + SLACK_RELEASE_ENDPOINT: ${{ secrets.SLACK_RELEASE_ENDPOINT }} \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2558f8aae..fb9b02871 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,7 +22,9 @@ on: jobs: build-container: - uses: ./.github/workflows/_build_container.yml + uses: NVIDIA/NeMo-FW-CI-templates/.github/workflows/_build_container.yml@v0.1.0 + with: + image-label: nemo-aligner build-and-test-wheel: needs: build-container diff --git a/Dockerfile b/Dockerfile index c94cadc68..44a9f8651 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,6 +39,7 @@ pip install --no-cache-dir --no-deps -e . EOF FROM ${BASE_IMAGE} as final +LABEL "nemo.library"="nemo-aligner" WORKDIR /opt # needed in case git complains that it can't detect a valid email, this email is fake but works RUN git config --global user.email "worker@nvidia.com"