Skip to content

rename invere root to root inverse #993

rename invere root to root inverse

rename invere root to root inverse #993

Workflow file for this run

# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
#
# 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: CICD NeMo
on:
schedule:
- cron: 0 0 * * *
push:
branches:
- main
- "pull-request/[0-9]+"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.event.label.name || 'main' }}-${{ github.event_name }}
cancel-in-progress: true
permissions:
id-token: write
contents: read
statuses: write
jobs:
pre-flight:
uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_cicd_preflight.yml@cf5acebace78c7c339bc1f804357a991336f1c4d # v1.8.10
with:
default_runner_prefix: nemo-ci-aws-gpu-x2
non_nvidia_runner_prefix: nemo-ci-aws-gpu-x2-ephemeral
default_test_data_path: /mnt/datadrive/TestData/nemo-fw/TestData
non_nvidia_test_data_path: /mnt/datadrive/TestData/nemo-fw/TestData
default_registry: 766267172432.dkr.ecr.us-east-1.amazonaws.com
non_nvidia_registry: 766267172432.dkr.ecr.us-east-1.amazonaws.com
sso_users_filename: ${{ vars.SSO_USERS_FILENAME }}
secrets:
NVIDIA_MANAGEMENT_ORG_PAT: ${{ secrets.NVIDIA_MANAGEMENT_ORG_PAT }}
cicd-wait-in-queue:
needs: [pre-flight]
runs-on: ubuntu-latest
environment: test
if: |
!(needs.pre-flight.outputs.is_ci_workload == 'true'
|| needs.pre-flight.outputs.is_deployment_workflow == 'true'
|| needs.pre-flight.outputs.docs_only == 'true')
steps:
- name: Running CI tests
run: |
echo "Running CI tests"
cicd-container-build:
needs: [pre-flight, cicd-wait-in-queue]
runs-on: ${{ needs.pre-flight.outputs.runner_prefix }}
if: |
(
success()
|| needs.pre-flight.outputs.is_ci_workload == 'true'
|| needs.pre-flight.outputs.force_run_all == 'true'
)
&& !cancelled()
steps:
- name: Get PR info
id: get-pr-info
if: startsWith(github.ref, 'refs/heads/pull-request/')
uses: nv-gha-runners/get-pr-info@090577647b8ddc4e06e809e264f7881650ecdccf # main
- name: Get merge commit sha
shell: bash -x -e -u -o pipefail {0}
id: sha
env:
IS_PR: ${{ startsWith(github.ref, 'refs/heads/pull-request/') }}
run: |
if [[ "$IS_PR" == "true" ]]; then
SHA=${{ fromJSON(steps.get-pr-info.outputs.pr-info || '{}').merge_commit_sha }}
else
SHA=${GITHUB_SHA}
fi
echo "main=${SHA}" | tee -a "$GITHUB_OUTPUT"
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
submodules: recursive
ref: ${{ steps.sha.outputs.main }}
- name: Install GH CLI
shell: bash
run: |
for i in 1 2 3; do
apt-get update && apt-get install -y gh && break
echo "Attempt $i failed, retrying in 10s..."
sleep 10
done
- name: Get last merged PR
id: cache_from
env:
GH_TOKEN: ${{ github.token }}
run: |
LAST_PRS=$(gh api graphql -f query='
query {
repository(owner: "NVIDIA-NeMo", name: "Emerging-Optimizers") {
pullRequests(states: MERGED, first: 100, orderBy: {field: UPDATED_AT, direction: DESC}) {
nodes {
number
}
}
}
}' | jq -r '.data.repository.pullRequests.nodes[].number' | while read -r number; do
echo "type=registry,ref=${{ needs.pre-flight.outputs.registry }}/emerging-optimizers:$number-buildcache,mode=max"
done)
echo "LAST_PRS<<EOF" | tee -a $GITHUB_OUTPUT
echo "$LAST_PRS" | tee -a $GITHUB_OUTPUT
echo "EOF" | tee -a $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Compute cache keys
id: cache_keys
shell: bash
run: |
PR_NUMBER="${{ fromJSON(steps.get-pr-info.outputs.pr-info || '{}').number }}"
BRANCH_SANITIZED=$(echo "${{ github.ref_name }}" | tr '/' '-' | tr -cd '[:alnum:]._-')
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
KEY="main"
elif [[ -n "$PR_NUMBER" ]]; then
KEY="$PR_NUMBER"
else
KEY="$BRANCH_SANITIZED"
fi
echo "key=$KEY" | tee -a "$GITHUB_OUTPUT"
echo "cache-to=type=registry,ref=${{ needs.pre-flight.outputs.registry }}/emerging-optimizers:${KEY}-buildcache,mode=max" | tee -a "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
with:
file: ./docker/Dockerfile.ci
push: true
context: .
platforms: linux/amd64
cache-from: |
type=registry,ref=${{ needs.pre-flight.outputs.registry }}/emerging-optimizers:${{ steps.cache_keys.outputs.key }}-buildcache,mode=max
type=registry,ref=${{ needs.pre-flight.outputs.registry }}/emerging-optimizers:main-buildcache,mode=max
${{ steps.cache_from.outputs.LAST_PRS }}
cache-to: ${{ steps.cache_keys.outputs.cache-to }}
no-cache: false
tags: |
${{ needs.pre-flight.outputs.registry }}/emerging-optimizers:${{ steps.cache_keys.outputs.key }}
${{ needs.pre-flight.outputs.registry }}/emerging-optimizers:${{ github.sha }}
cicd-unit-tests:
strategy:
fail-fast: false
matrix:
include:
- script: L0_Tests_GPU
runner: ${{ needs.pre-flight.outputs.runner_prefix }}
timeout: 30
- script: L0_Tests_CPU
runner: ${{ needs.pre-flight.outputs.runner_prefix }}
timeout: 30
cpu-only: true
needs: [pre-flight, cicd-container-build]
runs-on: ${{ matrix.runner }}
name: ${{ matrix.script }}
if: |
(
success()
|| needs.pre-flight.outputs.is_ci_workload == 'true'
|| needs.pre-flight.outputs.force_run_all == 'true'
)
&& !cancelled()
steps:
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: main
uses: ./.github/actions/test-template
with:
script: ${{ matrix.script }}
timeout: ${{ matrix.timeout || 10 }}
is_unit_test: "true"
container-image: ${{ needs.pre-flight.outputs.registry }}/emerging-optimizers:${{ github.sha }}
cpu-only: ${{ matrix.cpu-only || false }}
test-data-path: ${{ needs.pre-flight.outputs.test_data_path }}
runner: ${{ matrix.runner }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: test-results-${{ matrix.script }}
path: test-results/**/*.xml
if-no-files-found: ignore
cicd-nightly-tests:
needs: [pre-flight, cicd-container-build]
runs-on: ${{ needs.pre-flight.outputs.runner_prefix }}
name: L1_Tests_GPU
if: |
github.event_name == 'schedule'
&& (
success()
|| needs.pre-flight.outputs.is_ci_workload == 'true'
|| needs.pre-flight.outputs.force_run_all == 'true'
)
&& !cancelled()
steps:
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: main
uses: ./.github/actions/test-template
with:
script: L1_Tests_GPU
timeout: 60
is_unit_test: "true"
container-image: ${{ needs.pre-flight.outputs.registry }}/emerging-optimizers:${{ github.sha }}
runner: ${{ needs.pre-flight.outputs.runner_prefix }}
test-data-path: ${{ needs.pre-flight.outputs.test_data_path }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: test-results-L1_Tests_GPU
path: test-results/**/*.xml
if-no-files-found: ignore
publish-test-results:
needs: [cicd-unit-tests]
if: always()
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- name: Download Test Results
continue-on-error: true
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
pattern: test-results-L0_*
merge-multiple: true
- name: Publish Test Report
uses: EnricoMi/publish-unit-test-result-action@d0a4676d0e0b938bc201470d88276b7c74c712b3 # v2
with:
files: "**/*.xml"
fail_on: "nothing"
publish-nightly-test-results:
needs: [cicd-nightly-tests]
if: always() && github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- name: Download Test Results
continue-on-error: true
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
pattern: test-results-L1_*
merge-multiple: true
- name: Publish Test Report
uses: EnricoMi/publish-unit-test-result-action@d0a4676d0e0b938bc201470d88276b7c74c712b3 # v2
with:
files: "**/*.xml"
fail_on: "nothing"
check_name: "Nightly Test Results"
Nemo_CICD_Test:
needs:
- pre-flight
- cicd-container-build
- cicd-unit-tests
if: |
(
needs.pre-flight.outputs.docs_only == 'true'
|| needs.pre-flight.outputs.is_deployment_workflow == 'true'
|| needs.pre-flight.outputs.is_ci_workload == 'true'
|| always()
)
&& !cancelled()
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Get workflow result
id: result
env:
GH_TOKEN: ${{ github.token }}
RUN_ID: ${{ github.run_id }}
DOCS_ONLY: ${{ needs.pre-flight.outputs.docs_only }}
IS_DEPLOYMENT: ${{ needs.pre-flight.outputs.is_deployment_workflow }}
IS_CI_WORKLOAD: ${{ needs.pre-flight.outputs.is_ci_workload }}
run: |
# Get workflow run details and check job conclusions
NUM_FAILED=$(gh run view $RUN_ID --json jobs -q '[.jobs[] | select(.conclusion == "failure" and .name != "L1_Tests_GPU") | .name] | length')
NUM_CANCELLED=$(gh run view $RUN_ID --json jobs -q '[.jobs[] | select(.conclusion == "cancelled" and .name != "L1_Tests_GPU") | .name] | length')
if [[ ($NUM_FAILED -eq 0 && $NUM_CANCELLED -eq 0) || $DOCS_ONLY == 'true' || $IS_DEPLOYMENT == 'true' || $IS_CI_WORKLOAD == 'true' ]]; then
RESULT="success"
elif [[ $NUM_CANCELLED -gt 0 ]]; then
RESULT="cancelled"
else
RESULT="failure"
fi
# Output the final status
echo "code=$RESULT" | tee -a $GITHUB_OUTPUT
- name: Checkout for GH CLI
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Remove label if not cancelled
if: |
steps.result.outputs.code != 'cancelled'
&& github.event.label.name == 'Run CICD'
&& github.event.pull_request.head.repo.full_name == github.repository
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.number }}
run: gh pr edit "$PR_NUMBER" --remove-label "Run CICD"
- name: Pipeline successful, add PR comment
if: |
steps.result.outputs.code == 'success'
&& github.event_name == 'pull_request'
&& env.SLACK_WEBHOOK != ''
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
REPOSITORY: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
with:
issue-number: ${{ github.event.number }}
body: |
[🤖]: Hi @${{ github.event.pull_request.user.login }} 👋,
We wanted to let you know that a [CICD pipeline](https://github.com/${{ env.REPOSITORY }}/actions/runs/${{ env.RUN_ID }}) for this PR just finished successfully.
So it might be time to merge this PR or get some approvals.
//cc @chtruong814 @ko3n1g @pablo-garay @thomasdhc
- name: "Pipeline not successful and not cancelled: Send Slack alert & create step summary"
if: |
steps.result.outputs.code == 'failure'
&& github.event.label.name == 'Run CICD'
&& env.SLACK_WEBHOOK != ''
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
PR_NUMBER: ${{ github.event.number }}
SERVER_URL: ${{ github.server_url }}
run: |
set -x
pip install PyGithub
export BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
python .github/scripts/notify.py
- name: Exit
if: ${{ always() }}
env:
RESULT: ${{ steps.result.outputs.code }}
run: |
if [ $RESULT == "success" ]; then
exit 0
else
exit 1
fi
Coverage_Fake:
runs-on: ubuntu-latest
needs: [Nemo_CICD_Test, pre-flight]
if: |
(
needs.pre-flight.outputs.docs_only == 'true'
|| needs.pre-flight.outputs.is_deployment_workflow == 'true'
)
&& needs.pre-flight.outputs.is_ci_workload == 'false'
&& !cancelled()
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ vars.BOT_ID }}
private-key: ${{ secrets.BOT_KEY }}
- name: Generate fake coverage report
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: 'success',
description: 'No code changes - coverage check skipped',
context: 'codecov/patch'
});
Coverage:
runs-on: ubuntu-latest
needs: [pre-flight, Nemo_CICD_Test]
if: |
(
(needs.pre-flight.outputs.is_ci_workload == 'true' && !failure())
|| success()
)
&& !cancelled()
strategy:
matrix:
flag: [unit-test]
steps:
- name: Get PR info
id: get-pr-info
if: startsWith(github.ref, 'refs/heads/pull-request/')
uses: nv-gha-runners/get-pr-info@090577647b8ddc4e06e809e264f7881650ecdccf # main
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Download coverage reports of current branch
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
pattern: coverage-${{ matrix.flag }}-*
- name: Get total coverage of current branch
shell: bash -x -e -u -o pipefail {0}
if: always()
run: |
pip install coverage
ls -al .
ls -al coverage-*/
coverage combine --keep $(ls coverage-*/.coverage)
coverage report -i
rm -rf coverage-*
ls -al
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
flags: ${{ matrix.flag }}
base_sha: ${{ fromJSON(steps.get-pr-info.outputs.pr-info || '{}').base.sha }}
- name: Upload artifacts
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: coverage-${{ matrix.flag }}-aggregated
path: |
.coverage
include-hidden-files: true