Skip to content

@Libraries • Tests triggered by live-github-bot[bot] on ref renovate/expo-monorepo #18350

@Libraries • Tests triggered by live-github-bot[bot] on ref renovate/expo-monorepo

@Libraries • Tests triggered by live-github-bot[bot] on ref renovate/expo-monorepo #18350

Workflow file for this run

name: "@Libraries • Tests"
run-name: "@Libraries • Tests 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:
since_branch:
description: The branch that turborepo will check when diffing.
default: "develop"
ref:
description: the branch which triggered this workflow
required: false
login:
description: The GitHub username that triggered the workflow
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name != 'develop' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
test-docs:
name: "Test Docs"
runs-on: ubuntu-latest
outputs:
fail: ${{ steps.diff.outputs.diff }}
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.since_branch }}
- name: Setup the toolchain
uses: ./tools/actions/composites/setup-toolchain
- name: Install dependencies
run: pnpm i --filter="!./apps/**"
- name: run doc
run: pnpm doc:ljs
- name: get diff
id: diff
run: |
diff=$(git diff --exit-code > /dev/null && echo 0 || echo 1)
echo "diff=$diff" >> $GITHUB_OUTPUT
exit $diff
test-common-tools:
name: "Test common-tools"
env:
NODE_OPTIONS: "--max-old-space-size=7168"
FORCE_COLOR: 3
outputs:
fail: ${{ steps.diff.outputs.diff }}
runs-on: ubuntu-latest
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.since_branch }}
- name: Setup the toolchain
uses: ./tools/actions/composites/setup-toolchain
- name: Install dependencies
run: pnpm i -F "live-common-tools..." -F "ledger-live"
- name: build common-tools
run: pnpm turbo run build --filter="live-common-tools"
test-cli:
name: "Test CLI"
env:
NODE_OPTIONS: "--max-old-space-size=7168"
FORCE_COLOR: 3
outputs:
fail: ${{ steps.diff.outputs.diff }}
test-fail: ${{ steps.test.outcome }}
runs-on: ubuntu-latest
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.since_branch }}
- name: Setup the toolchain
uses: ./tools/actions/composites/setup-toolchain
- name: Install dependencies
run: pnpm i
- name: build cli
run: pnpm build:cli
- name: test cli
id: test
run: pnpm test --filter="live-cli"
- name: get diff
id: diff
run: |
diff=$(git diff --exit-code > /dev/null && echo 0 || echo 1)
echo "diff=$diff" >> $GITHUB_OUTPUT
exit $diff
test-libraries:
name: "Test Libraries"
env:
NODE_OPTIONS: "--max-old-space-size=7168"
FORCE_COLOR: 3
CI_OS: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
# Commenting because of random node-gyp failures on windows…
# See:
# * https://github.com/serialport/node-serialport/issues/2322
# - windows-latest
runs-on: ${{ matrix.os }}
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.since_branch }}
fetch-depth: 0
- name: Setup the toolchain
uses: ./tools/actions/composites/setup-toolchain
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- name: TurboRepo local caching server
id: turborepo-cache-server
uses: ./tools/actions/turborepo-s3-cache
with:
server-token: "yolo"
cleanup-cache-folder: "true"
aws-access-key: ${{ secrets.AWS_S3_CACHE_ACCESS_KEY }}
aws-secret-key: ${{ secrets.AWS_S3_CACHE_SECRET_KEY }}
- name: Install dependencies
run: pnpm i --filter="!./apps/**"
- name: Build and Test affected libraries
id: test-libs
run: pnpm run test --continue --filter="!./apps/**" --filter="!./tools/**" --filter="!live-common-tools" --filter="!ledger-live...[${{ inputs.since_branch && format('origin/{0}', inputs.since_branch) || 'HEAD^1' }}]" --api="http://127.0.0.1:${{ steps.turborepo-cache-server.outputs.port }}" --token="yolo" --team="foo"
shell: bash
- name: (On Failure) Upload live-common snapshots and source
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ format('live-common-src-{0}', matrix.os) }}
path: |
libs/ledger-live-common/src
- name: (On Failure) Upload react-ui test results
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ format('react-ui-test-results-{0}', matrix.os) }}
path: |
libs/ui/tests/react.spec.js-snapshots/
libs/ui/test-results/
- uses: actions/github-script@v6
if: always()
with:
script: |
const fs = require("fs");
fs.writeFileSync("summary-${{ matrix.os }}.txt", "${{ steps.test-libs.outcome }}", "utf-8");
- uses: actions/upload-artifact@v3
if: always()
with:
name: outputs
path: ${{ github.workspace }}/summary-${{ matrix.os }}.txt
report:
needs: [test-cli, test-docs, test-libraries, test-common-tools]
if: always() && !cancelled() && github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: outputs
- uses: actions/github-script@v6
name: build summary
with:
script: |
const fs = require("fs");
const resultLinux = fs.readFileSync("${{ github.workspace }}/summary-ubuntu-latest.txt", "utf-8");
const resultMacos = fs.readFileSync("${{ github.workspace }}/summary-macos-latest.txt", "utf-8");
const statuses = {
doc: {
pass: ${{ needs.test-docs.outputs.fail != '1' }},
status: "${{ needs.test-docs.result }}",
},
cli: {
pass: ${{ needs.test-cli.outputs.test-fail == 'success' && needs.test-cli.outputs.fail != '1' }},
status: "${{ needs.test-docs.result }}",
},
libraries: {
pass: ${{ needs.test-libraries.result == 'success' }},
status: "${{ needs.test-libraries.result }}",
},
libs: {
mac: {
pass: resultMacos == 'success',
status: resultMacos,
},
linux: {
pass: resultLinux == 'success',
status: resultLinux,
}
}
};
const libsOk = Object.values(statuses.libs).every(os => os.pass);
const summary = `### Test documentation files
${statuses.doc.pass ? "Documentation files are fine" : "Documentation files are outdated"}
- ${statuses.doc.pass ? "✅" : "❌"} **Test documentation files** ended with status \`${statuses.doc.status}\`
### Test CLI
${statuses.cli.pass ? "CLI tests are successful" : "CLI tests did not end successfully"}
- ${statuses.cli.pass ? "✅" : "❌"} **CLI tests** ended with status \`${statuses.cli.status}\`
### Test Libraries
${libsOk ? "All tests are fine" : "Some tests failed"}
| Linux (🤖) | macOS (🍏) |
| :--: | :--: |
| ${statuses.libs.linux.pass ? "✅" : "❌"} (${statuses.libs.linux.status}) | ${statuses.libs.mac.pass ? "✅" : "❌"} (${statuses.libs.mac.status}) |
`;
const actions = [];
if (${{ needs.test-docs.outputs.fail == '1' }}) {
actions.push({
// 20 chars max
label: "Regen. Doc Files",
// 20 chars max
identifier: "regen_doc",
// 40 chars max
description: "Will regenerate doc files for ljs",
});
}
const output = {
summary,
actions
};
fs.writeFileSync("summary.json", JSON.stringify(output), "utf-8");
- uses: actions/upload-artifact@v3
name: Upload output
with:
path: ${{ github.workspace }}/summary.json
name: summary.json