|
| 1 | + |
| 2 | +name: Inference test |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + start-aws-runner: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + permissions: |
| 10 | + id-token: write |
| 11 | + contents: read |
| 12 | + outputs: |
| 13 | + mapping: ${{ steps.aws-start.outputs.mapping }} |
| 14 | + instances: ${{ steps.aws-start.outputs.instances }} |
| 15 | + steps: |
| 16 | + - name: Configure AWS credentials |
| 17 | + uses: aws-actions/configure-aws-credentials@v4 |
| 18 | + with: |
| 19 | + role-to-assume: ${{ secrets.AWS_ROLE }} |
| 20 | + aws-region: us-east-1 |
| 21 | + - name: Create cloud runner |
| 22 | + id: aws-start |
| 23 | + uses: omsf-eco-infra/gha-runner@main |
| 24 | + with: |
| 25 | + provider: "aws" |
| 26 | + action: "start" |
| 27 | + aws_region_name: us-east-1 |
| 28 | + aws_image_id: ami-0f7c4a792e3fb63c8 |
| 29 | + aws_instance_type: g4dn.xlarge |
| 30 | + aws_home_dir: /home/ubuntu |
| 31 | + env: |
| 32 | + GH_PAT: ${{ secrets.GH_PAT }} |
| 33 | + inference-test: |
| 34 | + runs-on: ${{ fromJSON(needs.start-aws-runner.outputs.instances) }} |
| 35 | + defaults: |
| 36 | + run: |
| 37 | + shell: bash -leo pipefail {0} |
| 38 | + needs: |
| 39 | + - start-aws-runner |
| 40 | + steps: |
| 41 | + - name: Checkout scripts |
| 42 | + uses: actions/checkout@v4 |
| 43 | + with: |
| 44 | + sparse-checkout: | |
| 45 | + inference-test |
| 46 | + repository: omsf-eco-infra/ci-scripts |
| 47 | + path: ci-scripts |
| 48 | + - name: Print disk usage |
| 49 | + run: "df -h" |
| 50 | + - name: Print Docker details |
| 51 | + run: "docker version || true" |
| 52 | + - name: Check for nvidia-smi |
| 53 | + run: "nvidia-smi || true" |
| 54 | + - uses: mamba-org/setup-micromamba@main |
| 55 | + with: |
| 56 | + environment-file: ci-scripts/inference-test/environment.yml |
| 57 | + - name: Test for GPU |
| 58 | + id: gpu_test |
| 59 | + run: python ci-scripts/inference-test/inference.py |
| 60 | + stop-aws-runner: |
| 61 | + runs-on: ubuntu-latest |
| 62 | + needs: |
| 63 | + - start-aws-runner |
| 64 | + - inference-test |
| 65 | + if: ${{ always() }} |
| 66 | + permissions: |
| 67 | + id-token: write |
| 68 | + contents: read |
| 69 | + steps: |
| 70 | + - name: Configure AWS credentials |
| 71 | + uses: aws-actions/configure-aws-credentials@v4 |
| 72 | + with: |
| 73 | + role-to-assume: ${{ secrets.AWS_ROLE }} |
| 74 | + aws-region: us-east-1 |
| 75 | + - name: Stop instances |
| 76 | + uses: omsf-eco-infra/gha-runner@main |
| 77 | + with: |
| 78 | + provider: "aws" |
| 79 | + action: "stop" |
| 80 | + aws_region_name: us-east-1 |
| 81 | + instance_mapping: ${{ needs.start-aws-runner.outputs.mapping }} |
| 82 | + env: |
| 83 | + GH_PAT: ${{ secrets.GH_PAT }} |
0 commit comments