Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 1 addition & 50 deletions .github/workflows/arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,7 @@ name: arm flow
on: [workflow_call, workflow_dispatch]

jobs:
start-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2.6.1
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
# Ubuntu 22.04 region AMI for ARM
ec2-image-id: ami-062b37d89f25c958f
ec2-instance-type: t4g.medium
subnet-id: ${{ secrets.AWS_EC2_SUBNET_ID }}
security-group-id: ${{ secrets.AWS_EC2_SG_ID }}
ec2-volume-size: 30

arm:
needs: start-runner # required to start the main job when the runner is ready
uses: ./.github/workflows/task-unit-test.yml
with:
env: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner

stop-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- arm # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2.6.1
with:
mode: stop
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
env: ubuntu-22.04-arm
25 changes: 25 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,36 @@ jobs:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Prepare EC2 owner tag
id: ec2-tags
# Keep the original workflow actor as owner, including on reruns.
env:
OWNER_HANDLE: ${{ github.actor }}
shell: python
run: |
import os
import re

# Allow only lowercase ASCII letters, digits, and underscores.
owner = os.environ["OWNER_HANDLE"].lower()
owner = re.sub(r"[^a-z0-9_]", "_", owner)
# Collapse repeated separators, cap at 63 characters, and trim edges.
owner = re.sub(r"_+", "_", owner)[:63].strip("_")
if not owner:
raise SystemExit("Cannot derive an EC2 owner tag from github.actor")

with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output:
output.write(f"owner={owner}\n")
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
aws-resource-tags: >-
[
{"Key": "team", "Value": "ai_and_search"},
{"Key": "owner", "Value": "${{ steps.ec2-tags.outputs.owner }}"}
]
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
# Ubuntu 22.04 128GB Storage AMI
ec2-image-id: ami-0ba430d4b7b64de57
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,36 @@ jobs:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Prepare EC2 owner tag
id: ec2-tags
# Keep the original workflow actor as owner, including on reruns.
env:
OWNER_HANDLE: ${{ github.actor }}
shell: python
run: |
import os
import re

# Allow only lowercase ASCII letters, digits, and underscores.
owner = os.environ["OWNER_HANDLE"].lower()
owner = re.sub(r"[^a-z0-9_]", "_", owner)
# Collapse repeated separators, cap at 63 characters, and trim edges.
owner = re.sub(r"_+", "_", owner)[:63].strip("_")
if not owner:
raise SystemExit("Cannot derive an EC2 owner tag from github.actor")

with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output:
output.write(f"owner={owner}\n")
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2.6.1
with:
mode: start
aws-resource-tags: >-
[
{"Key": "team", "Value": "ai_and_search"},
{"Key": "owner", "Value": "${{ steps.ec2-tags.outputs.owner }}"}
]
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
# Ubuntu 20.04 AMI
ec2-image-id: ami-0f4feb99425e13b50
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/event-merge-to-queue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ jobs:
uses: ./.github/workflows/macos.yml
arm:
uses: ./.github/workflows/arm.yml
secrets: inherit

coverage:
uses: ./.github/workflows/coverage.yml
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/event-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
uses: ./.github/workflows/macos.yml
arm:
uses: ./.github/workflows/arm.yml
secrets: inherit
coverage:
uses: ./.github/workflows/coverage.yml
secrets: inherit
Expand Down
Loading