Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
LL-8243 deploy hosted runners (#1546)
Browse files Browse the repository at this point in the history
* LL-8243 deploy hosted runners

* use new ami

* use GITHUB_TOKEN

* revert use of GITHUB_TOKEN

* fix tokens

* test runners

* rerun

* remove resizing on second job

* parallelize jobs

* remove cache action

* removing last cache actions

Co-authored-by: Gaëtan Renaudeau <[email protected]>
  • Loading branch information
valpinkman and gre authored Dec 2, 2021
1 parent 73fd68f commit 98dbaf9
Show file tree
Hide file tree
Showing 5 changed files with 328 additions and 68 deletions.
63 changes: 53 additions & 10 deletions .github/workflows/bot2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,45 @@ on:
- bots-staging

jobs:
start-runner:
name: start self-hosted EC2 runner
runs-on: [ledger-live-common]
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: get latest LLD runner AMI id
id: get-ami-id
run: |
echo "::set-output name=ami-id::$(aws ec2 describe-images --filters 'Name=name,Values=ledger-live-runner' --query 'Images[*].ImageId' --output text)"
- name: start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.CI_BOT_TOKEN }}
ec2-image-id: ${{ steps.get-ami-id.outputs.ami-id }}
ec2-instance-type: c5.4xlarge
subnet-id: subnet-03b7b4dff904e0142 # production-shared-private-eu-west-1a
security-group-id: sg-010daba499648d1e7 # infra-gha-runner-sg
- name: get volume-id
id: get-volume-id
run: |
echo "::set-output name=volume-id::$(aws ec2 describe-instances --instance-ids ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs.VolumeId' --output text)"
- name: resize rootfs
env:
VOLUME_ID: ${{ steps.get-volume-id.outputs.volume-id }}
run: |
aws ec2 modify-volume --size 30 --volume-id $VOLUME_ID
run-bot:
runs-on: ubuntu-latest
runs-on: ${{ needs.start-runner.outputs.label }}
needs: [start-runner]
steps:
- name: prepare runner
run: |
sudo growpart /dev/nvme0n1 1
sudo resize2fs /dev/nvme0n1p1
- uses: actions/checkout@v2
- name: Retrieving coin apps
uses: actions/checkout@v2
Expand All @@ -18,19 +54,12 @@ jobs:
- uses: actions/setup-node@master
with:
node-version: 14.x
- name: install yarn
run: npm i -g yarn
- name: pull docker image
run: docker pull ghcr.io/ledgerhq/speculos
- name: Install linux deps
run: sudo apt-get install -y libusb-1.0-0-dev jq
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
yarn global add yalc
Expand Down Expand Up @@ -59,3 +88,17 @@ jobs:
with:
name: bot-tests.txt
path: bot-tests.txt

stop-runner:
name: Stop self-hosted EC2 runner
needs: [start-runner, run-bot]
runs-on: [ledger-live-common]
if: always()
steps:
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.CI_BOT_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
63 changes: 53 additions & 10 deletions .github/workflows/bot3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,45 @@ on:
- bot-silicium

jobs:
start-runner:
name: start self-hosted EC2 runner
runs-on: [ledger-live-common]
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: get latest LLD runner AMI id
id: get-ami-id
run: |
echo "::set-output name=ami-id::$(aws ec2 describe-images --filters 'Name=name,Values=ledger-live-runner' --query 'Images[*].ImageId' --output text)"
- name: start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.CI_BOT_TOKEN }}
ec2-image-id: ${{ steps.get-ami-id.outputs.ami-id }}
ec2-instance-type: c5.4xlarge
subnet-id: subnet-03b7b4dff904e0142 # production-shared-private-eu-west-1a
security-group-id: sg-010daba499648d1e7 # infra-gha-runner-sg
- name: get volume-id
id: get-volume-id
run: |
echo "::set-output name=volume-id::$(aws ec2 describe-instances --instance-ids ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs.VolumeId' --output text)"
- name: resize rootfs
env:
VOLUME_ID: ${{ steps.get-volume-id.outputs.volume-id }}
run: |
aws ec2 modify-volume --size 30 --volume-id $VOLUME_ID
run-bot:
runs-on: ubuntu-latest
runs-on: ${{ needs.start-runner.outputs.label }}
needs: [start-runner]
steps:
- name: prepare runner
run: |
sudo growpart /dev/nvme0n1 1
sudo resize2fs /dev/nvme0n1p1
- uses: actions/checkout@v2
- name: Retrieving coin apps
uses: actions/checkout@v2
Expand All @@ -20,19 +56,12 @@ jobs:
- uses: actions/setup-node@master
with:
node-version: 14.x
- name: install yarn
run: npm i -g yarn
- name: pull docker image
run: docker pull ghcr.io/ledgerhq/speculos
- name: Install linux deps
run: sudo apt-get install -y libusb-1.0-0-dev jq
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
yarn global add yalc
Expand Down Expand Up @@ -60,3 +89,17 @@ jobs:
with:
name: bot-tests.txt
path: bot-tests.txt

stop-runner:
name: Stop self-hosted EC2 runner
needs: [start-runner, run-bot]
runs-on: [ledger-live-common]
if: always()
steps:
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.CI_BOT_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
63 changes: 53 additions & 10 deletions .github/workflows/bot4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,45 @@ on:
- bitcoin-js

jobs:
start-runner:
name: start self-hosted EC2 runner
runs-on: [ledger-live-common]
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: get latest LLD runner AMI id
id: get-ami-id
run: |
echo "::set-output name=ami-id::$(aws ec2 describe-images --filters 'Name=name,Values=ledger-live-runner' --query 'Images[*].ImageId' --output text)"
- name: start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.CI_BOT_TOKEN }}
ec2-image-id: ${{ steps.get-ami-id.outputs.ami-id }}
ec2-instance-type: c5.4xlarge
subnet-id: subnet-03b7b4dff904e0142 # production-shared-private-eu-west-1a
security-group-id: sg-010daba499648d1e7 # infra-gha-runner-sg
- name: get volume-id
id: get-volume-id
run: |
echo "::set-output name=volume-id::$(aws ec2 describe-instances --instance-ids ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs.VolumeId' --output text)"
- name: resize rootfs
env:
VOLUME_ID: ${{ steps.get-volume-id.outputs.volume-id }}
run: |
aws ec2 modify-volume --size 30 --volume-id $VOLUME_ID
run-bot:
runs-on: ubuntu-latest
needs: [start-runner]
runs-on: ${{ needs.start-runner.outputs.label }}
steps:
- name: prepare runner
run: |
sudo growpart /dev/nvme0n1 1
sudo resize2fs /dev/nvme0n1p1
- uses: actions/checkout@v2
- name: Retrieving coin apps
uses: actions/checkout@v2
Expand All @@ -18,19 +54,12 @@ jobs:
- uses: actions/setup-node@master
with:
node-version: 14.x
- name: install yarn
run: npm i -g yarn
- name: pull docker image
run: docker pull ghcr.io/ledgerhq/speculos
- name: Install linux deps
run: sudo apt-get install -y libusb-1.0-0-dev jq
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
yarn global add yalc
Expand Down Expand Up @@ -62,3 +91,17 @@ jobs:
with:
name: bot-tests.txt
path: bot-tests.txt

stop-runner:
name: Stop self-hosted EC2 runner
needs: [start-runner, run-bot]
runs-on: [ledger-live-common]
if: always()
steps:
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.CI_BOT_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
65 changes: 54 additions & 11 deletions .github/workflows/bot_taproot_testnet.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,48 @@
name: Bot 'Taproot'
on:
on:
schedule:
- cron: "0 6-18 * * 1-5"

jobs:
start-runner:
name: start self-hosted EC2 runner
runs-on: [ledger-live-common]
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: get latest LLD runner AMI id
id: get-ami-id
run: |
echo "::set-output name=ami-id::$(aws ec2 describe-images --filters 'Name=name,Values=ledger-live-runner' --query 'Images[*].ImageId' --output text)"
- name: start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.CI_BOT_TOKEN }}
ec2-image-id: ${{ steps.get-ami-id.outputs.ami-id }}
ec2-instance-type: c5.4xlarge
subnet-id: subnet-03b7b4dff904e0142 # production-shared-private-eu-west-1a
security-group-id: sg-010daba499648d1e7 # infra-gha-runner-sg
- name: get volume-id
id: get-volume-id
run: |
echo "::set-output name=volume-id::$(aws ec2 describe-instances --instance-ids ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs.VolumeId' --output text)"
- name: resize rootfs
env:
VOLUME_ID: ${{ steps.get-volume-id.outputs.volume-id }}
run: |
aws ec2 modify-volume --size 30 --volume-id $VOLUME_ID
run-bot:
runs-on: ubuntu-latest
runs-on: ${{ needs.start-runner.outputs.label }}
needs: [start-runner]
steps:
- name: prepare runner
run: |
sudo growpart /dev/nvme0n1 1
sudo resize2fs /dev/nvme0n1p1
- uses: actions/checkout@v2
- name: Retrieving coin apps
uses: actions/checkout@v2
Expand All @@ -17,19 +53,12 @@ jobs:
- uses: actions/setup-node@master
with:
node-version: 14.x
- name: install yarn
run: npm i -g yarn
- name: pull docker image
run: docker pull ghcr.io/ledgerhq/speculos
- name: Install linux deps
run: sudo apt-get install -y libusb-1.0-0-dev jq
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
yarn global add yalc
Expand Down Expand Up @@ -61,3 +90,17 @@ jobs:
with:
name: bot-tests.txt
path: bot-tests.txt

stop-runner:
name: Stop self-hosted EC2 runner
needs: [start-runner, run-bot]
runs-on: [ledger-live-common]
if: always()
steps:
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.CI_BOT_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
Loading

1 comment on commit 98dbaf9

@vercel
Copy link

@vercel vercel bot commented on 98dbaf9 Dec 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.