Skip to content

Commit

Permalink
move actions and reusable workflows in this project
Browse files Browse the repository at this point in the history
  • Loading branch information
valpinkman committed May 17, 2022
1 parent a41da9b commit 88492c8
Show file tree
Hide file tree
Showing 55 changed files with 1,273 additions and 24 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ jobs:
./tools/g++-5.4/install.sh
- name: install dependencies
run: pnpm i --frozen-lockfile
- uses: ledgerhq/actions/packages/get-package-infos@main
- uses: ledgerhq/ledger-live/tools/actions/get-package-infos@monorepo-setup
id: version
with:
path: ${{ github.workspace }}/apps/ledger-live-desktop
- name: set beta name
uses: ledgerhq/actions/packages/change-product-name@main
uses: ledgerhq/ledger-live/tools/actions/change-product-name@monorepo-setup
with:
path: ${{ github.workspace }}/apps/ledger-live-desktop
# - name: make local version pr
Expand All @@ -78,7 +78,7 @@ jobs:
- name: build the app
run: |
pnpm turbo run build-ci --since=origin/${{ github.event.pull_request.base.ref }} --scope=live-desktop --include-dependencies --no-deps
# - uses: ledgerhq/actions/packages/get-package-infos@main
# - uses: ledgerhq/ledger-live/tools/actions/get-package-infos@main
# id: post-version
# with:
# path: ${{ github.workspace }}
Expand Down Expand Up @@ -132,12 +132,12 @@ jobs:
git config user.name "Team Live"
- name: install dependencies
run: pnpm i --frozen-lockfile --unsafe-perm
- uses: ledgerhq/actions/packages/get-package-infos@main
- uses: ledgerhq/ledger-live/tools/actions/get-package-infos@monorepo-setup
id: version
with:
path: ${{ github.workspace }}/apps/ledger-live-desktop
- name: set beta name
uses: ledgerhq/actions/packages/change-product-name@main
uses: ledgerhq/ledger-live/tools/actions/change-product-name@monorepo-setup
with:
path: ${{ github.workspace }}/apps/ledger-live-desktop
# - name: make local version pr
Expand Down Expand Up @@ -198,12 +198,12 @@ jobs:
git config user.name "Team Live"
- name: install dependencies
run: pnpm i --frozen-lockfile
- uses: ledgerhq/actions/packages/get-package-infos@main
- uses: ledgerhq/ledger-live/tools/actions/get-package-infos@monorepo-setup
id: version
with:
path: ${{ github.workspace }}/apps/ledger-live-desktop
- name: set beta name
uses: ledgerhq/actions/packages/change-product-name@main
uses: ledgerhq/ledger-live/tools/actions/change-product-name@monorepo-setup
with:
path: ${{ github.workspace }}/apps/ledger-live-desktop
# - name: make local version pr
Expand All @@ -221,7 +221,7 @@ jobs:
CSC_IDENTITY_AUTO_DISCOVERY: false
run: |
pnpm turbo run build-ci --since=origin/${{ github.event.pull_request.base.ref }} --scope=live-desktop --include-dependencies --no-deps
# - uses: ledgerhq/actions/packages/get-package-infos@main
# - uses: ledgerhq/ledger-live/tools/actions/get-package-infos@main
# id: post-version
# with:
# path: ${{ github.workspace }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
with:
path: ${{ github.workspace }}/apps/ledger-live-mobile
- name: set beta name
uses: ledgerhq/actions/packages/change-product-name@main
uses: ledgerhq/ledger-live/tools/actions/change-product-name@monorepo-setup
with:
path: ${{ github.workspace }}/apps/ledger-live-mobile
# - name: Get short SHA
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/start-linux-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Start self-hosted EC2 runner (Linux)
on:
workflow_call:
inputs:
instance-type:
description: name of runner to use
required: false
type: string
default: t3.medium
# c5.4xlarge
secrets:
CI_BOT_TOKEN:
required: true
outputs:
label:
description: name of runner to use
value: ${{ jobs.start-runner.outputs.label }}
ec2-instance-id:
description: ec2 instance id
value: ${{ jobs.start-runner.outputs.ec2-instance-id }}
env:
AWS_REGION: eu-west-1

jobs:
start-runner:
name: start self-hosted EC2 runner
runs-on: [ledger-live, linux]
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: skyzh/ec2-github-runner@ba2298a67875dfdd29a88fafbc1ba27f4f94af39
with:
mode: start
github-token: ${{ secrets.CI_BOT_TOKEN }}
ec2-image-id: ${{ steps.get-ami-id.outputs.ami-id }}
ec2-instance-type: ${{ inputs.instance-type }}
subnet-id: subnet-0eeb962bb7d9d96ef # production-shared-private-eu-west-1a
security-group-id: sg-010daba499648d1e7 # infra-gha-runner-sg
aws-resource-tags: > # optional, requires additional permissions
[
{"Key": "Name", "Value": "ec2-github-runner"},
{"Key": "GitHubRepository", "Value": "${{ github.repository }}"}
]
- 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
31 changes: 31 additions & 0 deletions .github/workflows/stop-linux-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Stop self-hosted EC2 runner (Linux)
on:
workflow_call:
secrets:
CI_BOT_TOKEN:
required: true
inputs:
label:
description: name of runner to use
required: true
type: string
ec2-instance-id:
description: ec2 instance id
required: true
type: string
env:
AWS_REGION: eu-west-1

jobs:
stop-runner:
name: stop self-hosted EC2 runner
runs-on: [ledger-live, linux]
if: ${{ always() }}
steps:
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.CI_BOT_TOKEN }}
label: ${{ inputs.label }}
ec2-instance-id: ${{ inputs.ec2-instance-id }}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
# run: xvfb-run --auto-servernum -- yarn playwright
# - name: upload diffs to imgur
# if: always()
# uses: ledgerhq/actions/packages/upload-images@main
# uses: ledgerhq/ledger-live/tools/actions/upload-images@main
# id: imgur
# with:
# path: tests/artifacts/test-results
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
# run: yarn playwright
# - name: upload diffs to imgur
# if: always()
# uses: ledgerhq/actions/packages/upload-images@main
# uses: ledgerhq/ledger-live/tools/actions/upload-images@main
# id: imgur
# with:
# path: tests/artifacts/test-results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
fs.writeFileSync(`./images.json`, JSON.stringify(result, null, 2));
- name: prepare comment body
id: comment-body
uses: ledgerhq/actions/packages/prepare-comment@main
uses: ledgerhq/ledger-live/tools/actions/prepare-comment@monorepo-setup
with:
images: images.json
lintoutput: lint.txt
Expand Down
8 changes: 4 additions & 4 deletions apps/ledger-live-desktop/.github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ jobs:
run: xvfb-run --auto-servernum -- yarn playwright
- name: upload diffs to imgur
if: always()
uses: ledgerhq/actions/packages/upload-images@main
uses: ledgerhq/ledger-live/tools/actions/upload-images@monorepo-setup
id: imgur
with:
path: tests/artifacts/test-results
Expand Down Expand Up @@ -238,7 +238,7 @@ jobs:
run: xvfb-run --auto-servernum -- yarn playwright
- name: upload diffs to imgur
if: always()
uses: ledgerhq/actions/packages/upload-images@main
uses: ledgerhq/ledger-live/tools/actions/upload-images@monorepo-setup
id: imgur
with:
path: tests/artifacts/test-results
Expand Down Expand Up @@ -298,7 +298,7 @@ jobs:
run: yarn playwright
- name: upload diffs to imgur
if: always()
uses: ledgerhq/actions/packages/upload-images@main
uses: ledgerhq/ledger-live/tools/actions/upload-images@monorepo-setup
id: imgur
with:
path: tests/artifacts/test-results
Expand Down Expand Up @@ -349,7 +349,7 @@ jobs:
# run: yarn playwright
# - name: upload diffs to imgur
# if: always()
# uses: ledgerhq/actions/packages/upload-images@main
# uses: ledgerhq/ledger-live/tools/actions/upload-images@main
# id: imgur
# with:
# path: tests/artifacts/test-results
Expand Down
4 changes: 2 additions & 2 deletions apps/ledger-live-mobile/.github/workflows/bundle-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
- uses: ledgerhq/actions/[email protected]
id: version
- name: set beta name
uses: ledgerhq/actions/packages/change-product-name@main
uses: ledgerhq/ledger-live/tools/actions/change-product-name@monorepo-setup
with:
path: ${{ github.workspace }}
- name: Get short SHA
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
- uses: ledgerhq/actions/[email protected]
id: version
- name: set beta name
uses: ledgerhq/actions/packages/change-product-name@main
uses: ledgerhq/ledger-live/tools/actions/change-product-name@monorepo-setup
with:
path: ${{ github.workspace }}
- name: Get short SHA
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"clean": "git clean -fdX",
"build": "pnpm run:turbo -- run build --ignore=apps/* --ignore=apps\\* --no-deps",
"build:apps": "pnpm run:turbo -- run build-ci --include-dependencies --no-deps",
"build:actions": "pnpm run:turbo -- run build --scope=@actions/* --no-deps",
"build:desktop": "pnpm run:turbo -- run build-ci --scope=live-desktop --include-dependencies --no-deps",
"build:mobile": "pnpm run:turbo -- run build-ci --scope=live-mobile --include-dependencies --no-deps",
"test": "pnpm run:turbo -- run build test --include-dependencies --no-deps --ignore=apps/* --ignore=apps\\*",
Expand All @@ -24,6 +25,7 @@
"ui:native": "pnpm --filter native-ui",
"ui:icons": "pnpm --filter icons-ui",
"ui:shared": "pnpm --filter shared-ui",
"actions": "pnpm --filter @actions/*",
"run:turbo": "x-run node_modules/turbo/bin/turbo"
},
"pnpm": {
Expand All @@ -38,4 +40,4 @@
}
}
}
}
}
Loading

0 comments on commit 88492c8

Please sign in to comment.