|
21 | 21 | - 'main'
|
22 | 22 |
|
23 | 23 | jobs:
|
24 |
| - start-runner: |
25 |
| - name: Start self-hosted EC2 runner |
26 |
| - runs-on: ubuntu-latest |
27 |
| - env: |
28 |
| - AWS_REGION: us-east-1 |
29 |
| - EC2_AMI_ID: ami-03cfed9ea28f4b002 |
30 |
| - EC2_INSTANCE_TYPE: r5.8xlarge |
31 |
| - EC2_SUBNET_ID: subnet-931b34f5,subnet-ecb993cd,subnet-943dc2d8,subnet-45371f1a,subnet-ee93e0df,subnet-fddc3dfc |
32 |
| - EC2_SECURITY_GROUP: sg-030175c435ac141d6 |
33 |
| - outputs: |
34 |
| - label: ${{ steps.start-ec2-runner.outputs.label }} |
35 |
| - ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} |
36 |
| - steps: |
37 |
| - - name: Configure AWS credentials |
38 |
| - uses: aws-actions/configure-aws-credentials@v1 |
39 |
| - with: |
40 |
| - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
41 |
| - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
42 |
| - aws-region: ${{ env.AWS_REGION }} |
43 |
| - - name: Start EC2 runner |
44 |
| - id: start-ec2-runner |
45 |
| - uses: philschmid/philschmid-ec2-github-runner@main |
46 |
| - with: |
47 |
| - mode: start |
48 |
| - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} |
49 |
| - ec2-image-id: ${{ env.EC2_AMI_ID }} |
50 |
| - ec2-instance-type: ${{ env.EC2_INSTANCE_TYPE }} |
51 |
| - subnet-id: ${{ env.EC2_SUBNET_ID }} |
52 |
| - security-group-id: ${{ env.EC2_SECURITY_GROUP }} |
53 |
| - aws-resource-tags: > # optional, requires additional permissions |
54 |
| - [ |
55 |
| - {"Key": "Name", "Value": "ec2-tei-github-runner"}, |
56 |
| - {"Key": "GitHubRepository", "Value": "${{ github.repository }}"} |
57 |
| - ] |
58 |
| -
|
59 | 24 | build-and-push-image:
|
60 | 25 | concurrency:
|
61 | 26 | group: ${{ github.workflow }}-${{ github.job }}-75-${{ github.head_ref || github.run_id }}
|
62 | 27 | cancel-in-progress: true
|
63 |
| - needs: start-runner # required to start the main job when the runner is ready |
64 |
| - runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner |
| 28 | + runs-on: [self-hosted, intel-cpu, 32-cpu, tgi-ci] |
65 | 29 | permissions:
|
66 | 30 | contents: write
|
67 | 31 | packages: write
|
|
135 | 99 | labels: ${{ steps.meta-75.outputs.labels }}
|
136 | 100 | cache-from: type=registry,ref=registry.internal.huggingface.tech/api-inference/text-embeddings-inference:cache-75,mode=max
|
137 | 101 | cache-to: type=registry,ref=registry.internal.huggingface.tech/api-inference/text-embeddings-inference:cache-75,mode=max
|
138 |
| - |
139 |
| - stop-runner: |
140 |
| - name: Stop self-hosted EC2 runner |
141 |
| - needs: |
142 |
| - - start-runner |
143 |
| - - build-and-push-image |
144 |
| - runs-on: ubuntu-latest |
145 |
| - env: |
146 |
| - AWS_REGION: us-east-1 |
147 |
| - if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs |
148 |
| - steps: |
149 |
| - - name: Configure AWS credentials |
150 |
| - uses: aws-actions/configure-aws-credentials@v1 |
151 |
| - with: |
152 |
| - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
153 |
| - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
154 |
| - aws-region: ${{ env.AWS_REGION }} |
155 |
| - - name: Stop EC2 runner |
156 |
| - uses: philschmid/philschmid-ec2-github-runner@main |
157 |
| - with: |
158 |
| - mode: stop |
159 |
| - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} |
160 |
| - label: ${{ needs.start-runner.outputs.label }} |
161 |
| - ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} |
0 commit comments