-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Oliver Koenig <[email protected]> Signed-off-by: Terry Kong <[email protected]> Co-authored-by: Terry Kong <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
378c7cd
commit c92a3bf
Showing
4 changed files
with
114 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: ~test template | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
RUNNER: | ||
type: string | ||
description: Runner to use for test | ||
required: true | ||
TIMEOUT: | ||
type: number | ||
description: Max runtime of test in minutes | ||
required: false | ||
default: 10 | ||
SCRIPT: | ||
type: string | ||
description: Test script to execute | ||
required: true | ||
AFTER_SCRIPT: | ||
type: string | ||
description: Script to run after main test | ||
required: false | ||
default: ":" | ||
IS_OPTIONAL: | ||
type: boolean | ||
description: Failure will cancel all other tests if set to true | ||
required: false | ||
default: false | ||
outputs: | ||
conclusion: | ||
description: Conclusion of main test step | ||
value: ${{ jobs.main.outputs.conclusion }} | ||
log: | ||
description: Last 2000 characters of the test step's log | ||
value: ${{ jobs.main.outputs.log }} | ||
jobs: | ||
|
||
main: | ||
runs-on: ${{ inputs.RUNNER }} | ||
outputs: | ||
conclusion: ${{ steps.main.conclusion }} | ||
log: ${{ steps.main.outputs.log }} | ||
steps: | ||
- name: Docker system cleanup | ||
run: | | ||
docker system prune -a --filter "until=48h" --force || true | ||
- name: Docker pull image | ||
run: | | ||
docker pull nemoci.azurecr.io/nemo_aligner_container:${{ github.run_id }} | ||
- id: main | ||
name: Run main script | ||
timeout-minutes: ${{ inputs.TIMEOUT }} | ||
run: | | ||
mkdir -p ${{ github.run_id }} | ||
cd ${{ github.run_id }}/ | ||
set +e | ||
( | ||
set -e | ||
docker run --rm --device=/dev/nvidia0 --gpus all --shm-size=8g --env TRANSFORMERS_OFFLINE=0 --env HYDRA_FULL_ERROR=1 --volume /mnt/datadrive/TestData:/home/TestData:ro nemoci.azurecr.io/nemo_aligner_container:${{ github.run_id }} bash -c '${{ inputs.SCRIPT }}' | ||
) 2> >(tee err.log) | ||
EXIT_CODE=$? | ||
echo "log=$(tail -c 2000 err.log | base64 -w 0)" >> "$GITHUB_OUTPUT" | ||
exit $EXIT_CODE | ||
- uses: "NVIDIA/NeMo/.github/actions/cancel-workflow@main" | ||
if: failure() && inputs.IS_OPTIONAL == false | ||
- name: after_script | ||
if: always() && inputs.AFTER_SCRIPT != ':' | ||
run: | | ||
docker run --rm --device=/dev/nvidia0 --gpus all --shm-size=8g --env TRANSFORMERS_OFFLINE=0 --env HYDRA_FULL_ERROR=1 --volume /mnt/datadrive/TestData:/home/TestData nemoci.azurecr.io/nemo_aligner_container:${{ github.run_id }} bash -c '${{ inputs.AFTER_SCRIPT }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters