Skip to content

Nightly Transformer Engine test #191

Nightly Transformer Engine test

Nightly Transformer Engine test #191

name: Nightly Transformer Engine test
on:
workflow_run:
workflows: [Nightly Transformer Engine build]
types: [completed]
branches: [main]
workflow_dispatch:
inputs:
JAX_TE_IMAGE:
type: string
description: 'JAX-TE image build by NVIDIA/JAX-Toolbox'
required: true
default: 'ghcr.io/nvidia/jax-te:latest'
PUBLISH:
type: boolean
description: Update status badge?
default: false
required: true
permissions:
contents: read # to fetch code
actions: write # to cancel previous workflows
packages: write # to upload container
env:
DEFAULT_JAX_TE_IMAGE: 'ghcr.io/nvidia/jax-te:latest'
jobs:
metadata:
runs-on: ubuntu-22.04
outputs:
JAX_TE_IMAGE: ${{ steps.meta.outputs.JAX_TE_IMAGE }}
PUBLISH: ${{ steps.meta.outputs.PUBLISH }}
steps:
- name: Set metadata
id: meta
shell: bash -x -e {0}
run: |
if [[ -z "${{ inputs.JAX_TE_IMAGE }}" ]]; then
JAX_TE_IMAGE=${{ env.DEFAULT_JAX_TE_IMAGE }}
else
JAX_TE_IMAGE=${{ inputs.JAX_TE_IMAGE }}
fi
echo "JAX_TE_IMAGE=${JAX_TE_IMAGE}" >> $GITHUB_OUTPUT
echo "PUBLISH=${{ inputs.PUBLISH }}" >> $GITHUB_OUTPUT
run-jobs:
needs: metadata
uses: ./.github/workflows/_test_te.yaml
if: (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'workflow_dispatch'
with:
JAX_TE_IMAGE: ${{ needs.metadata.outputs.JAX_TE_IMAGE }}
secrets: inherit
publish-unit:
needs: [metadata, run-jobs]
uses: ./.github/workflows/_publish_badge.yaml
if: (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'workflow_dispatch'
secrets: inherit
with:
ENDPOINT_FILENAME: 'te-unit-test-status.json'
PUBLISH: ${{ github.event_name == 'workflow_run' || needs.metadata.outputs.PUBLISH == 'true' }}
SCRIPT: |
ARTIFACTS="${{ needs.run-jobs.outputs.UNIT_TEST_ARTIFACT_NAME }}/*.jsonl"
all_outcomes() {
cat $ARTIFACTS | jq -r '. | select((.["$report_type"] == "TestReport") and (.when == "call")) | .outcome'
}
cnt_type() {
cat $ARTIFACTS | jq '. | select((.["$report_type"] == "TestReport") and (.when == "call") and (.outcome | contains("'${1}'"))) | .outcome' | wc -l
}
SKIPPED_TESTS=$(cnt_type skipped)
FAILED_TESTS=$(cnt_type failed)
PASSED_TESTS=$(cnt_type passed)
TOTAL_TESTS=$(all_outcomes | wc -l)
echo "Unit test breakdown:"
all_outcomes | sort | uniq -c
if [[ $FAILED_TESTS -eq 0 ]] && [[ $TOTAL_TESTS -gt 0 ]]; then
BADGE_COLOR=brightgreen
else
if [[ $PASSED_TESTS -eq 0 ]]; then
BADGE_COLOR=red
else
BADGE_COLOR=yellow
fi
fi
echo "LABEL='Unit'" >> $GITHUB_OUTPUT
echo "MESSAGE='${PASSED_TESTS}/${SKIPPED_TESTS}/${FAILED_TESTS} pass/skip/fail'" >> $GITHUB_OUTPUT
echo "COLOR='${BADGE_COLOR}'" >> $GITHUB_OUTPUT
publish-integration:
needs: [metadata, run-jobs]
uses: ./.github/workflows/_publish_badge.yaml
if: (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'workflow_dispatch'
secrets: inherit
with:
ENDPOINT_FILENAME: 'te-integration-test-status.json'
PUBLISH: ${{ github.event_name == 'workflow_run' || needs.metadata.outputs.PUBLISH == 'true' }}
SCRIPT: |
ARTIFACTS="${{ needs.run-jobs.outputs.INTEGRATION_TEST_ARTIFACT_NAME }}/*.jsonl"
all_outcomes() {
cat $ARTIFACTS | jq -r '. | select((.["$report_type"] == "TestReport") and (.when == "call")) | .outcome'
}
cnt_type() {
cat $ARTIFACTS | jq '. | select((.["$report_type"] == "TestReport") and (.when == "call") and (.outcome | contains("'${1}'"))) | .outcome' | wc -l
}
SKIPPED_TESTS=$(cnt_type skipped)
FAILED_TESTS=$(cnt_type failed)
PASSED_TESTS=$(cnt_type passed)
TOTAL_TESTS=$(all_outcomes | wc -l)
echo "Unit test breakdown:"
all_outcomes | sort | uniq -c
if [[ $FAILED_TESTS -eq 0 ]] && [[ $TOTAL_TESTS -gt 0 ]]; then
BADGE_COLOR=brightgreen
else
if [[ $PASSED_TESTS -eq 0 ]]; then
BADGE_COLOR=red
else
BADGE_COLOR=yellow
fi
fi
echo "LABEL='Integration'" >> $GITHUB_OUTPUT
echo "MESSAGE='${PASSED_TESTS}/${SKIPPED_TESTS}/${FAILED_TESTS} pass/skip/fail'" >> $GITHUB_OUTPUT
echo "COLOR='${BADGE_COLOR}'" >> $GITHUB_OUTPUT
if-upstream-failed:
runs-on: ubuntu-latest
if: (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure') && github.event_name != 'workflow_dispatch'
steps:
- run: echo 'Upstream workflow failed, aborting run' && exit 1