@Desktop • Build App triggered by cng-ledger on ref feat/LIVE-7223 #19288
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "@Desktop • Build App" | |
run-name: "@Desktop • Build App triggered by ${{ github.event_name == 'workflow_dispatch' && inputs.login || github.actor }} ${{ format('on ref {0}', github.ref_name) }}" | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
- release | |
- hotfix | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: the branch which triggered this workflow | |
required: false | |
login: | |
description: The GitHub username that triggered the workflow | |
required: true | |
base_ref: | |
description: The base branch to merge the head into when checking out the code | |
required: false | |
draft: | |
description: true if the PR is in draft | |
required: false | |
default: "false" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name != 'develop' && github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build-desktop-app-linux: | |
name: "Build Ledger Live Desktop (Linux)" | |
runs-on: [ledger-live-4xlarge-linux] | |
env: | |
NODE_OPTIONS: "--max-old-space-size=7168" | |
steps: | |
- uses: LedgerHQ/ledger-live/tools/actions/composites/checkout-merge@develop | |
with: | |
ref: ${{ (github.event_name == 'workflow_dispatch' && (inputs.ref || github.ref_name)) || github.sha }} | |
base: ${{ inputs.base_ref }} | |
- name: Set git user | |
run: | | |
git config user.email "105061298+live-github-bot[bot]@users.noreply.github.com" | |
git config user.name "live-github-bot[bot]" | |
- name: Setup the toolchain | |
uses: ./tools/actions/composites/setup-toolchain | |
- uses: ./tools/actions/composites/setup-build-desktop | |
id: build-desktop | |
with: | |
os: linux | |
aws-access-key: ${{ secrets.AWS_S3_CACHE_ACCESS_KEY }} | |
aws-secret-key: ${{ secrets.AWS_S3_CACHE_SECRET_KEY }} | |
- name: Build the app | |
run: pnpm build:lld --api="http://127.0.0.1:${{ steps.build-desktop.outputs.port }}" --token="yolo" --team="foo" | |
- name: Upload linux app | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.build-desktop.outputs.version }}-linux-x86_64.AppImage | |
path: ${{ github.workspace }}/apps/ledger-live-desktop/dist/${{ steps.build-desktop.outputs.name }}-${{ steps.build-desktop.outputs.version }}-linux-x86_64.AppImage | |
build-desktop-app-windows: | |
name: "Build Ledger Live Desktop (Windows)" | |
runs-on: [ledger-live-4xlarge-windows-2022] | |
env: | |
NODE_OPTIONS: "--max-old-space-size=7168" | |
steps: | |
- uses: LedgerHQ/ledger-live/tools/actions/composites/checkout-merge@develop | |
with: | |
ref: ${{ (github.event_name == 'workflow_dispatch' && (inputs.ref || github.ref_name)) || github.sha }} | |
base: ${{ inputs.base_ref }} | |
- name: Set git user | |
run: | | |
git config user.email "105061298+live-github-bot[bot]@users.noreply.github.com" | |
git config user.name "live-github-bot[bot]" | |
- name: Setup the toolchain | |
uses: ./tools/actions/composites/setup-toolchain | |
with: | |
install_dotnet: true | |
- uses: ./tools/actions/composites/setup-build-desktop | |
id: build-desktop | |
with: | |
os: win | |
aws-access-key: ${{ secrets.AWS_S3_CACHE_ACCESS_KEY }} | |
aws-secret-key: ${{ secrets.AWS_S3_CACHE_SECRET_KEY }} | |
- name: Build the app | |
run: | | |
pnpm build:lld --api="http://127.0.0.1:${{ steps.build-desktop.outputs.port }}" --token="yolo" --team="foo" | |
shell: bash | |
- name: Upload windows | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.build-desktop.outputs.version }}-win-x64.exe | |
path: ${{ github.workspace }}/apps/ledger-live-desktop/dist/${{ steps.build-desktop.outputs.name }}-${{ steps.build-desktop.outputs.version }}-win-x64.exe | |
build-desktop-app-macos: | |
name: "Build Ledger Live Desktop (Mac OS X)" | |
runs-on: [m1, ARM64] | |
env: | |
NODE_OPTIONS: "--max-old-space-size=7168" | |
steps: | |
- uses: LedgerHQ/ledger-live/tools/actions/composites/checkout-merge@develop | |
with: | |
ref: ${{ (github.event_name == 'workflow_dispatch' && (inputs.ref || github.ref_name)) || github.sha }} | |
base: ${{ inputs.base_ref }} | |
persist-credentials: false | |
- name: Set git user | |
run: | | |
git config user.email "105061298+live-github-bot[bot]@users.noreply.github.com" | |
git config user.name "live-github-bot[bot]" | |
- name: Setup the toolchain | |
uses: ./tools/actions/composites/setup-toolchain | |
with: | |
pnpm_dest: ${{ runner.temp }}/setup-pnpm | |
- uses: ./tools/actions/composites/setup-build-desktop | |
id: build-desktop | |
with: | |
os: mac | |
aws-access-key: ${{ secrets.AWS_S3_CACHE_ACCESS_KEY }} | |
aws-secret-key: ${{ secrets.AWS_S3_CACHE_SECRET_KEY }} | |
- name: Build the app | |
run: | | |
pnpm build:lld --api="http://127.0.0.1:${{ steps.build-desktop.outputs.port }}" --token="yolo" --team="foo" | |
- name: Upload macOS app | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.build-desktop.outputs.version }}-mac.dmg | |
path: ${{ github.workspace }}/apps/ledger-live-desktop/dist/${{ steps.build-desktop.outputs.name }}-${{ steps.build-desktop.outputs.version }}-mac.dmg | |
report: | |
needs: [build-desktop-app-linux, build-desktop-app-macos, build-desktop-app-windows] | |
runs-on: ubuntu-latest | |
if: always() && !cancelled() && github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/github-script@v6 | |
name: build summary | |
with: | |
script: | | |
const fs = require("fs"); | |
const [ owner, repo ] = "${{ github.repository }}".split("/"); | |
const jobs = await github.paginate(github.rest.actions.listJobsForWorkflowRunAttempt, { | |
owner, | |
repo, | |
run_id: "${{ github.run_id }}", | |
attempt_number: "${{ github.run_attempt }}", | |
}); | |
const findJobUrl = os => | |
jobs.find(job => job.name == `Build Ledger Live Desktop (${os})`)?.html_url; | |
const statuses = [ | |
"${{ needs.build-desktop-app-macos.result }}", | |
"${{ needs.build-desktop-app-linux.result }}", | |
"${{ needs.build-desktop-app-windows.result }}", | |
]; | |
const keys = { | |
mac: { | |
symbol: "🍏", | |
name: "macOS", | |
jobUrl: findJobUrl("Mac OS X") | |
}, | |
windows: { | |
symbol: "🪟", | |
name: "Windows", | |
jobUrl: findJobUrl("Windows") | |
}, | |
linux: { | |
symbol: "🐧", | |
name: "Linux", | |
jobUrl: findJobUrl("Linux") | |
}, | |
}; | |
const report = { | |
mac: { | |
pass: ${{ needs.build-desktop-app-macos.result == 'success' }}, | |
status: "${{ needs.build-desktop-app-macos.result }}", | |
}, | |
linux: { | |
pass: ${{ needs.build-desktop-app-linux.result == 'success' }}, | |
status: "${{ needs.build-desktop-app-linux.result }}", | |
}, | |
windows: { | |
pass: ${{ needs.build-desktop-app-windows.result == 'success' }}, | |
status: "${{ needs.build-desktop-app-windows.result }}", | |
}, | |
}; | |
const isFailed = statuses.some(e => e === "failure"); | |
const isCancelled = statuses.some(e => e === "cancelled"); | |
let summary = ``; | |
summary += `|` | |
const reportKeys = Object.keys(report); | |
reportKeys.forEach((k) => { | |
summary += ` [${keys[k].symbol} ${keys[k].name}](${keys[k].jobUrl}) |`; | |
}); | |
summary += ` | |
|`; | |
for (let i = 0; i < reportKeys.length; i++) { | |
summary += ` :--: |`; | |
} | |
summary += ` | |
|`; | |
Object.entries(report).forEach(([os, values]) => { | |
summary += ` ${values.pass ? "✅" : "❌"} (${values.status}) |`; | |
}); | |
summary += ` | |
[⚙️ Summary](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}) | |
`; | |
const data = { | |
isFailed, | |
isCancelled, | |
summary, | |
} | |
fs.writeFileSync("summary.json", JSON.stringify(data), "utf-8"); | |
- uses: actions/upload-artifact@v3 | |
name: Upload output | |
with: | |
path: ${{ github.workspace }}/summary.json | |
name: summary.json |