Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
VicAlbr committed Aug 6, 2024
1 parent 8fe8b24 commit ed3afb5
Showing 1 changed file with 154 additions and 153 deletions.
307 changes: 154 additions & 153 deletions .github/workflows/test-ui-e2e-only-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,159 +57,160 @@ permissions:

jobs:
e2e-tests-linux:
name: "Desktop Tests E2E (Ubuntu)"
outputs:
status: ${{ steps.tests.outcome }}
env:
NODE_OPTIONS: "--max-old-space-size=7168"
INSTRUMENT_BUILD: true
FORCE_COLOR: 3
CI_OS: "ubuntu-latest"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
SPECULOS_IMAGE_TAG: ghcr.io/ledgerhq/speculos:0.9.5
ENABLE_BROADCAST_TEST: ${{ inputs.enable_send_test }}
runs-on: [ledger-live-4xlarge]
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3]
shardTotal: [3]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.sha }}

- name: Setup broadcast environment variables
id: set-env
run: |
day=$(date +%u)
if [ $day -eq 1 ] || "$ENABLE_BROADCAST_TEST" = "1" ; then
echo "ENABLE_TRANSACTION_BROADCAST=1" >> $GITHUB_ENV
else
echo "DISABLE_TRANSACTION_BROADCAST=1" >> $GITHUB_ENV
fi
- name: Setup caches
id: caches
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-caches@develop
with:
skip-turbo-cache: "false"
accountId: ${{ secrets.AWS_ACCOUNT_ID_PROD }}
roleName: ${{ secrets.AWS_CACHE_ROLE_NAME }}
region: ${{ secrets.AWS_CACHE_REGION }}
turbo-server-token: ${{ secrets.TURBOREPO_SERVER_TOKEN }}
- uses: LedgerHQ/ledger-live/tools/actions/composites/setup-test-desktop@develop
id: setup-test-desktop
with:
skip_ruby: true
install_playwright: true
turborepo-server-port: ${{ steps.caches.outputs.port }}
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.GH_BOT_APP_ID }}
private_key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
- name: Retrieving coin apps
uses: actions/checkout@v4
with:
ref: master
repository: LedgerHQ/coin-apps
token: ${{ steps.generate-token.outputs.token }}
path: coin-apps
- name: Pull docker image
run: docker pull ${{ env.SPECULOS_IMAGE_TAG }}
shell: bash
- name: Run playwright tests [Linux => xvfb-run]
id: tests
run: |
export SPECULOS_IMAGE_TAG=${{ env.SPECULOS_IMAGE_TAG }}
export COINAPPS=$PWD/coin-apps
export MOCK=0
if [ "${{ inputs.invert_filter }}" = true ]; then invert_filter="-invert"; fi
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- pnpm desktop test:playwright:speculos ${INPUTS_TEST_FILTER:+--grep$invert_filter} "${{ inputs.test_filter }}" --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
env:
INPUTS_TEST_FILTER: ${{ inputs.test_filter }}
SEED: ${{ secrets.SEED_QAA_B2C }}
XRAY: ${{ inputs.export_to_xray }}
TEST_EXECUTION: ${{ inputs.test_execution }}
PROJECT_KEY: B2CQA

- name: Upload Allure Results
if: ${{ !cancelled() }}
uses: actions/[email protected]
with:
retention-days: 1
name: allure-results-${{ matrix.shardIndex }}
path: "apps/ledger-live-desktop/allure-results"

- name: Upload Xray Results
if: ${{ !cancelled() && inputs.export_to_xray }}
uses: actions/[email protected]
with:
retention-days: 1
name: xray-reports-${{ matrix.shardIndex }}
path: apps/ledger-live-desktop/tests/artifacts/xray/xray-report.json

report-and-notify:
name: "Report and Notify"
runs-on: [ledger-live-medium]
needs: e2e-tests-linux
if: always()
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.sha }}

- name: Download Allure Results
uses: actions/[email protected]
with:
path: "apps/ledger-live-desktop/allure-results"
pattern: allure-results-*
merge-multiple: true

- name: Publish report on Allure Server
id: allure-server
if: ${{ !cancelled() }}
uses: LedgerHQ/[email protected]
with:
allure-server-url: "https://ledger-live.allure.green.ledgerlabs.net"
build-name: ${{ github.workflow }}
build-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
username: ${{ vars.ALLURE_USERNAME }}
password: ${{ secrets.ALLURE_LEDGER_LIVE_PASSWORD }}
path: ${{ github.ref_name }}/linux
allure-results: "apps/ledger-live-desktop/allure-results"

- name: Write Allure report in summary
if: ${{ !cancelled() }}
shell: bash
run: echo "::notice title=Allure report URL::${{ steps.allure-server.outputs.report-url }}"

- name: Get summary
if: ${{ !cancelled() }}
shell: bash
run: |
cd apps/ledger-live-desktop
allure generate
cd allure-report/widgets
passedTests=$(jq '.statistic.passed' summary.json)
failedTests=$(jq '.statistic.failed' summary.json)
brokenTests=$(jq '.statistic.broken' summary.json)
skippedTests=$(jq '.statistic.skipped' summary.json)
totalTests=$(jq '.statistic.total' summary.json)
echo "TEST_RESULT=$passedTests passed, $failedTests failed, $brokenTests broken, $skippedTests skipped, $totalTests total" >> $GITHUB_ENV
- name: Get status color
if: ${{ !cancelled() }}
shell: bash
run: >
if ${{ needs.e2e-tests-linux.outputs.status == 'success' }};
then echo "STATUS_COLOR=#33FF39" >> $GITHUB_ENV;
elif ${{ needs.e2e-tests-linux.outputs.status == 'failure' }};
then echo "STATUS_COLOR=#FF333C" >> $GITHUB_ENV;
else echo "STATUS_COLOR=#F3FF33" >> $GITHUB_ENV;
fi
name: "Desktop Tests E2E (Ubuntu)"
outputs:
status1: ${{ steps.tests1.outcome }}
status2: ${{ steps.tests2.outcome }}
status3: ${{ steps.tests3.outcome }}
env:
NODE_OPTIONS: "--max-old-space-size=7168"
INSTRUMENT_BUILD: true
FORCE_COLOR: 3
CI_OS: "ubuntu-latest"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
SPECULOS_IMAGE_TAG: ghcr.io/ledgerhq/speculos:0.9.5
ENABLE_BROADCAST_TEST: ${{ inputs.enable_send_test }}
runs-on: [ledger-live-4xlarge]
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3]
shardTotal: [3]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.sha }}

- name: Setup broadcast environment variables
id: set-env
run: |
day=$(date +%u)
if [ $day -eq 1 ] || "$ENABLE_BROADCAST_TEST" = "1" ; then
echo "ENABLE_TRANSACTION_BROADCAST=1" >> $GITHUB_ENV
else
echo "DISABLE_TRANSACTION_BROADCAST=1" >> $GITHUB_ENV
fi
- name: Setup caches
id: caches
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-caches@develop
with:
skip-turbo-cache: "false"
accountId: ${{ secrets.AWS_ACCOUNT_ID_PROD }}
roleName: ${{ secrets.AWS_CACHE_ROLE_NAME }}
region: ${{ secrets.AWS_CACHE_REGION }}
turbo-server-token: ${{ secrets.TURBOREPO_SERVER_TOKEN }}
- uses: LedgerHQ/ledger-live/tools/actions/composites/setup-test-desktop@develop
id: setup-test-desktop
with:
skip_ruby: true
install_playwright: true
turborepo-server-port: ${{ steps.caches.outputs.port }}
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.GH_BOT_APP_ID }}
private_key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
- name: Retrieving coin apps
uses: actions/checkout@v4
with:
ref: master
repository: LedgerHQ/coin-apps
token: ${{ steps.generate-token.outputs.token }}
path: coin-apps
- name: Pull docker image
run: docker pull ${{ env.SPECULOS_IMAGE_TAG }}
shell: bash
- name: Run playwright tests [Linux => xvfb-run]
id: tests${{ matrix.shardIndex }}
run: |
export SPECULOS_IMAGE_TAG=${{ env.SPECULOS_IMAGE_TAG }}
export COINAPPS=$PWD/coin-apps
export MOCK=0
if [ "${{ inputs.invert_filter }}" = true ]; then invert_filter="-invert"; fi
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- pnpm desktop test:playwright:speculos ${INPUTS_TEST_FILTER:+--grep$invert_filter} "${{ inputs.test_filter }}" --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
env:
INPUTS_TEST_FILTER: ${{ inputs.test_filter }}
SEED: ${{ secrets.SEED_QAA_B2C }}
XRAY: ${{ inputs.export_to_xray }}
TEST_EXECUTION: ${{ inputs.test_execution }}
PROJECT_KEY: B2CQA

- name: Upload Allure Results
if: ${{ !cancelled() }}
uses: actions/[email protected]
with:
retention-days: 1
name: allure-results-${{ matrix.shardIndex }}
path: "apps/ledger-live-desktop/allure-results"

- name: Upload Xray Results
if: ${{ !cancelled() && inputs.export_to_xray }}
uses: actions/[email protected]
with:
retention-days: 1
name: xray-reports-${{ matrix.shardIndex }}
path: apps/ledger-live-desktop/tests/artifacts/xray/xray-report.json

report-and-notify:
name: "Report and Notify"
runs-on: [ledger-live-medium]
needs: e2e-tests-linux
if: always()
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.sha }}

- name: Download Allure Results
uses: actions/[email protected]
with:
path: "apps/ledger-live-desktop/allure-results"
pattern: allure-results-*
merge-multiple: true

- name: Publish report on Allure Server
id: allure-server
if: ${{ !cancelled() }}
uses: LedgerHQ/[email protected]
with:
allure-server-url: "https://ledger-live.allure.green.ledgerlabs.net"
build-name: ${{ github.workflow }}
build-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
username: ${{ vars.ALLURE_USERNAME }}
password: ${{ secrets.ALLURE_LEDGER_LIVE_PASSWORD }}
path: ${{ github.ref_name }}/linux
allure-results: "apps/ledger-live-desktop/allure-results"

- name: Write Allure report in summary
if: ${{ !cancelled() }}
shell: bash
run: echo "::notice title=Allure report URL::${{ steps.allure-server.outputs.report-url }}"

- name: Get summary
if: ${{ !cancelled() }}
shell: bash
run: |
cd apps/ledger-live-desktop
allure generate
cd allure-report/widgets
passedTests=$(jq '.statistic.passed' summary.json)
failedTests=$(jq '.statistic.failed' summary.json)
brokenTests=$(jq '.statistic.broken' summary.json)
skippedTests=$(jq '.statistic.skipped' summary.json)
totalTests=$(jq '.statistic.total' summary.json)
echo "TEST_RESULT=$passedTests passed, $failedTests failed, $brokenTests broken, $skippedTests skipped, $totalTests total" >> $GITHUB_ENV
- name: Get status color
if: ${{ !cancelled() }}
shell: bash
run: |
if [[ "${{ needs.e2e-tests-linux.outputs.status1 }}" == "failure" || "${{ needs.e2e-tests-linux.outputs.status2 }}" == "failure" || "${{ needs.e2e-tests-linux.outputs.status3 }}" == "failure" ]]; then
echo "STATUS_COLOR=#FF333C" >> $GITHUB_ENV
else
echo "STATUS_COLOR=#33FF39" >> $GITHUB_ENV
fi
- uses: actions/github-script@v6
if: ${{ !cancelled() }}
Expand Down

0 comments on commit ed3afb5

Please sign in to comment.