|
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 }}-cpu-${{ 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
|
|
133 | 97 | labels: ${{ steps.meta-cpu.outputs.labels }}
|
134 | 98 | cache-from: type=registry,ref=registry.internal.huggingface.tech/api-inference/text-embeddings-inference:cache-cpu,mode=max
|
135 | 99 | cache-to: type=registry,ref=registry.internal.huggingface.tech/api-inference/text-embeddings-inference:cache-cpu,mode=max
|
136 |
| - |
137 |
| - stop-runner: |
138 |
| - name: Stop self-hosted EC2 runner |
139 |
| - needs: |
140 |
| - - start-runner |
141 |
| - - build-and-push-image |
142 |
| - runs-on: ubuntu-latest |
143 |
| - env: |
144 |
| - AWS_REGION: us-east-1 |
145 |
| - if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs |
146 |
| - steps: |
147 |
| - - name: Configure AWS credentials |
148 |
| - uses: aws-actions/configure-aws-credentials@v1 |
149 |
| - with: |
150 |
| - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
151 |
| - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
152 |
| - aws-region: ${{ env.AWS_REGION }} |
153 |
| - - name: Stop EC2 runner |
154 |
| - uses: philschmid/philschmid-ec2-github-runner@main |
155 |
| - with: |
156 |
| - mode: stop |
157 |
| - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} |
158 |
| - label: ${{ needs.start-runner.outputs.label }} |
159 |
| - ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} |
0 commit comments