| 
 | 1 | +name: Self-Hosted Runner  | 
 | 2 | +on:  | 
 | 3 | +  workflow_dispatch:  | 
 | 4 | + | 
 | 5 | +jobs:  | 
 | 6 | +  start-aws-runner:  | 
 | 7 | +    runs-on: ubuntu-latest  | 
 | 8 | +    permissions:  | 
 | 9 | +      id-token: write  | 
 | 10 | +      contents: read  | 
 | 11 | +    outputs:  | 
 | 12 | +      mapping: ${{ steps.aws-start.outputs.mapping }}  | 
 | 13 | +    steps:  | 
 | 14 | +      - name: Configure AWS credentials  | 
 | 15 | +        uses: aws-actions/configure-aws-credentials@v4  | 
 | 16 | +        with:  | 
 | 17 | +          role-to-assume: arn:aws:iam::009563297724:role/gha-runner-omsf  | 
 | 18 | +          aws-region: us-east-1  | 
 | 19 | +      - name: Create cloud runner  | 
 | 20 | +        id: aws-start  | 
 | 21 | +        uses: omsf-eco-infra/gha-runner@v0.2.0  | 
 | 22 | +        with:  | 
 | 23 | +          provider: "aws"  | 
 | 24 | +          action: "start"  | 
 | 25 | +          aws_image_id: ami-053912f3a44543f8c   | 
 | 26 | +          aws_instance_type: g4dn.xlarge  | 
 | 27 | +          aws_region_name: us-east-1  | 
 | 28 | +          aws_home_dir: /home/ubuntu  | 
 | 29 | +        env:  | 
 | 30 | +          GH_PAT: ${{ secrets.GH_PAT }}  | 
 | 31 | + | 
 | 32 | +  self-hosted-test:  | 
 | 33 | +    runs-on: self-hosted  | 
 | 34 | +    timeout-minutes: 720  # 12 hours    | 
 | 35 | +    defaults:  | 
 | 36 | +      run:  | 
 | 37 | +        shell: bash -leo pipefail {0}  | 
 | 38 | +    env:  | 
 | 39 | +      OE_LICENSE: ${{ github.workspace }}/oe_license.txt  | 
 | 40 | + | 
 | 41 | +    needs:  | 
 | 42 | +      - start-aws-runner  | 
 | 43 | +    steps:  | 
 | 44 | +      - uses: actions/checkout@v4  | 
 | 45 | + | 
 | 46 | +      - name: Print disk usage  | 
 | 47 | +        run: "df -h"  | 
 | 48 | + | 
 | 49 | +      - name: Print Docker details  | 
 | 50 | +        run: "docker version || true"  | 
 | 51 | + | 
 | 52 | +      - name: Check for nvidia-smi  | 
 | 53 | +        run: "nvidia-smi"  | 
 | 54 | + | 
 | 55 | +      - name: "Setup Micromamba"  | 
 | 56 | +        uses: mamba-org/setup-micromamba@v1  | 
 | 57 | +        with:  | 
 | 58 | +          environment-file: devtools/conda-envs/test_env.yaml  | 
 | 59 | +          environment-name: openfe_env  | 
 | 60 | + | 
 | 61 | +      - name: "Check if OpenMM can get a GPU"  | 
 | 62 | +        run: python -m openmm.testInstallation  | 
 | 63 | + | 
 | 64 | +      - name: "Install"  | 
 | 65 | +        run: python -m pip install --no-deps -e .  | 
 | 66 | + | 
 | 67 | +      - name: "Environment Information"  | 
 | 68 | +        run: |  | 
 | 69 | +          micromamba info  | 
 | 70 | +          micromamba list  | 
 | 71 | +          pip list  | 
 | 72 | +
  | 
 | 73 | +      - name: Test OE License & Write License to File  | 
 | 74 | +        env:  | 
 | 75 | +          OE_LICENSE_TEXT: ${{ secrets.OE_LICENSE }}  | 
 | 76 | +        run: |  | 
 | 77 | +          echo "${OE_LICENSE_TEXT}" > ${OE_LICENSE}  | 
 | 78 | +          python -c "import openeye; assert openeye.oechem.OEChemIsLicensed(), 'OpenEye license checks failed!'"  | 
 | 79 | +
  | 
 | 80 | +      - name: "Run tests"  | 
 | 81 | +        run: |  | 
 | 82 | +          pytest -n 4 -v --durations=10 --cov=openmmtools --cov-report=term  | 
 | 83 | +
  | 
 | 84 | +  stop-aws-runner:  | 
 | 85 | +    runs-on: ubuntu-latest  | 
 | 86 | +    permissions:  | 
 | 87 | +        id-token: write  | 
 | 88 | +        contents: read  | 
 | 89 | +    needs:  | 
 | 90 | +      - start-aws-runner  | 
 | 91 | +      - self-hosted-test  | 
 | 92 | +    if: ${{ always() }}  | 
 | 93 | +    steps:  | 
 | 94 | +      - name: Configure AWS credentials  | 
 | 95 | +        uses: aws-actions/configure-aws-credentials@v4  | 
 | 96 | +        with:  | 
 | 97 | +          role-to-assume: arn:aws:iam::009563297724:role/gha-runner-omsf  | 
 | 98 | +          aws-region: us-east-1  | 
 | 99 | +      - name: Stop instances  | 
 | 100 | +        uses: omsf-eco-infra/gha-runner@v0.2.0  | 
 | 101 | +        with:  | 
 | 102 | +          provider: "aws"  | 
 | 103 | +          action: "stop"  | 
 | 104 | +          instance_mapping: ${{ needs.start-aws-runner.outputs.mapping }}  | 
 | 105 | +          aws_region_name: us-east-1  | 
 | 106 | +        env:  | 
 | 107 | +          GH_PAT: ${{ secrets.GH_PAT }}  | 
0 commit comments