-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7818 from LedgerHQ/fix/restore-tests-ci
Restore missing workflows
- Loading branch information
Showing
5 changed files
with
366 additions
and
16 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: "CLI Tests" | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
inputs: | ||
ref: | ||
description: | | ||
If you run this manually, and want to run on a PR, the correct ref should be refs/pull/{PR_NUMBER}/merge to | ||
have the "normal" scenario involving checking out a merge commit between your branch and the base branch. | ||
If you want to run only on a branch or specific commit, you can use either the sha or the branch name instead (prefer the first verion for PRs). | ||
required: false | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
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-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref || github.sha }} | ||
- name: Setup the toolchain | ||
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-toolchain@develop | ||
id: toolchain | ||
with: | ||
accountId: ${{ secrets.AWS_ACCOUNT_ID_PROD }} | ||
roleName: ${{ secrets.AWS_CACHE_ROLE_NAME }} | ||
region: ${{ secrets.AWS_CACHE_REGION }} | ||
turbo-server-token: ${{ secrets.TURBOREPO_SERVER_TOKEN }} | ||
skip-turbo-cache: "false" | ||
- name: Install dependencies | ||
run: pnpm i -F "live-cli..." -F "ledger-live" | ||
- name: build cli | ||
run: pnpm build:cli --api="http://127.0.0.1:${{ steps.toolchain.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo" | ||
- name: lint cli | ||
run: pnpm lint --filter="live-cli" --api="http://127.0.0.1:${{ steps.toolchain.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo" -- --quiet | ||
- name: typecheck cli | ||
run: pnpm typecheck --filter="live-cli" --api="http://127.0.0.1:${{ steps.toolchain.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo" | ||
- name: test cli | ||
id: test | ||
run: pnpm run test --filter="live-cli" --api="http://127.0.0.1:${{ steps.toolchain.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo" | ||
- name: get diff | ||
id: diff | ||
run: | | ||
diff=$(git diff --exit-code > /dev/null && echo 0 || echo 1) | ||
echo "diff=$diff" >> $GITHUB_OUTPUT | ||
exit $diff | ||
report: | ||
needs: test-cli | ||
if: ${{ !cancelled() && github.event_name == 'workflow_dispatch' }} | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: outputs-* | ||
merge-multiple: true | ||
path: outputs | ||
- uses: actions/github-script@v6 | ||
name: build summary | ||
with: | ||
script: | | ||
const fs = require("fs"); | ||
const statuses = { | ||
cli: { | ||
pass: ${{ needs.test-cli.outputs.test-fail == 'success' && needs.test-cli.outputs.fail != '1' }}, | ||
status: "${{ needs.test-cli.result }}", | ||
} | ||
}; | ||
const summary = `### 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}\` | ||
`; | ||
const output = { | ||
summary | ||
}; | ||
fs.writeFileSync("summary-cli.json", JSON.stringify(output), "utf-8"); | ||
- uses: actions/upload-artifact@v4 | ||
name: Upload output | ||
with: | ||
path: ${{ github.workspace }}/summary-cli.json | ||
name: summary-cli.json |
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
Oops, something went wrong.