Skip to content

Inference test

Inference test #25

name: Inference test
on:
workflow_dispatch:
jobs:
start-aws-runner:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
outputs:
mapping: ${{ steps.aws-start.outputs.mapping }}
instances: ${{ steps.aws-start.outputs.instances }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
aws-region: us-east-1
- name: Create cloud runner
id: aws-start
uses: omsf/start-aws-gha-runner@feat/auto-updating-ami
with:
aws_image_id: latest
aws_image_name: Deep Learning Base AMI with Single CUDA (Ubuntu 22.04)
aws_root_device_size: 125
aws_instance_type: g4dn.xlarge
aws_home_dir: /home/ubuntu
aws_tags: '[{"Key":"LaunchedBy","Value":"gha-runner"}]'
env:
GH_PAT: ${{ secrets.GH_PAT }}
inference-test:
runs-on: ${{ fromJSON(needs.start-aws-runner.outputs.instances) }}
defaults:
run:
shell: bash -leo pipefail {0}
needs:
- start-aws-runner
steps:
- name: Fail
run: "exit 1"
- name: Checkout scripts
uses: actions/checkout@v4
with:
sparse-checkout: |
inference-test
repository: omsf-eco-infra/ci-scripts
path: ci-scripts
- name: Print disk usage
run: "df -h"
- name: Print Docker details
run: "docker version || true"
- name: Check for nvidia-smi
run: "nvidia-smi || true"
- uses: mamba-org/setup-micromamba@main
with:
environment-file: ci-scripts/inference-test/environment.yml
- name: Test for pytorch
run: python -c "import torch; assert torch.cuda.is_available()"
- name: Test for GPU
id: gpu_test
run: python ci-scripts/inference-test/inference.py
notify_failure:
needs: [inference-test]
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
if: always() && (needs.inference-test.result == 'failure')
steps:
- name: Create issue
run: 'gh issue create --body "Job failed, please check AWS for running instances."'