|
| 1 | +name: Run Swap Functional tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + app_build_artifact: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + exchange_build_artifact: |
| 10 | + required: false |
| 11 | + default: '' |
| 12 | + description: 'If not provided, the workflow will build the Exchange app.' |
| 13 | + type: string |
| 14 | + ethereum_build_artifact: |
| 15 | + required: false |
| 16 | + default: '' |
| 17 | + description: 'If not provided, the workflow will build the Ethereum app.' |
| 18 | + type: string |
| 19 | + regenerate_snapshots: |
| 20 | + required: false |
| 21 | + default: false |
| 22 | + type: boolean |
| 23 | + swap_test_dir: |
| 24 | + required: true |
| 25 | + description: 'The directory where the swap tests are located.' |
| 26 | + type: string |
| 27 | + |
| 28 | + |
| 29 | +jobs: |
| 30 | + build_exchange: |
| 31 | + name: Build Exchange app using the reusable workflow |
| 32 | + if: ${{ inputs.exchange_build_artifact == '' }} |
| 33 | + uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1 |
| 34 | + with: |
| 35 | + app_repository: 'LedgerHQ/app-exchange' |
| 36 | + app_branch_name: 'develop' |
| 37 | + upload_app_binaries_artifact: "app_exchange_binaries" |
| 38 | + use_case: 'use_test_keys' |
| 39 | + |
| 40 | + build_ethereum: |
| 41 | + name: Build Ethereum app using the reusable workflow |
| 42 | + if: ${{ inputs.ethereum_build_artifact == '' }} |
| 43 | + uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1 |
| 44 | + with: |
| 45 | + app_repository: 'LedgerHQ/app-ethereum' |
| 46 | + app_branch_name: 'develop' |
| 47 | + upload_app_binaries_artifact: "app_ethereum_binaries" |
| 48 | + upload_as_lib_artifact: "ethereum_" |
| 49 | + use_case: 'use_test_keys' |
| 50 | + |
| 51 | + get_artifacts_names: |
| 52 | + name: Retrieve artifact names |
| 53 | + needs: [build_exchange, build_ethereum] |
| 54 | + if: ${{ always() }} |
| 55 | + outputs: |
| 56 | + exchange_build_artifact: ${{ steps.get_exchange_binaries.outputs.exchange_build_artifact }} |
| 57 | + ethereum_build_artifact: ${{ steps.get_ethereum_binaries.outputs.ethereum_build_artifact }} |
| 58 | + runs-on: ubuntu-latest |
| 59 | + steps: |
| 60 | + - name: Get Exchange binaries artifact name |
| 61 | + id: get_exchange_binaries |
| 62 | + run: | |
| 63 | + if [ "${{ needs.build_exchange.result }}" = "skipped" ]; then |
| 64 | + echo "exchange_build_artifact=${{ inputs.exchange_build_artifact }}" >> "$GITHUB_OUTPUT" |
| 65 | + elif [ "${{ needs.build_exchange.result }}" = "success" ]; then |
| 66 | + echo "exchange_build_artifact=app_exchange_binaries" >> "$GITHUB_OUTPUT" |
| 67 | + else |
| 68 | + echo "Not able to retrieve Exchange binaries artifact name" >&2 |
| 69 | + exit 1 |
| 70 | + fi |
| 71 | + - name: Get Ethereum binaries artifact name |
| 72 | + id: get_ethereum_binaries |
| 73 | + run: | |
| 74 | + if [ "${{ needs.build_ethereum.result }}" = "skipped" ]; then |
| 75 | + echo "ethereum_build_artifact=${{ inputs.ethereum_build_artifact }}" >> "$GITHUB_OUTPUT" |
| 76 | + elif [ "${{ needs.build_ethereum.result }}" = "success" ]; then |
| 77 | + echo "ethereum_build_artifact=app_ethereum_binaries" >> "$GITHUB_OUTPUT" |
| 78 | + else |
| 79 | + echo "Not able to retrieve Ethereum binaries artifact name" >&2 |
| 80 | + exit 1 |
| 81 | + fi |
| 82 | + - name: Show artifact names |
| 83 | + run: | |
| 84 | + echo "Exchange build artifact: ${{ steps.get_exchange_binaries.outputs.exchange_build_artifact }}" |
| 85 | + echo "Ethereum build artifact: ${{ steps.get_ethereum_binaries.outputs.ethereum_build_artifact }}" |
| 86 | +
|
| 87 | + get_dir_names: |
| 88 | + name: Build artifact destination directories |
| 89 | + runs-on: ubuntu-latest |
| 90 | + outputs: |
| 91 | + swap_test_dir: ${{ steps.get_swap_test_dir.outputs.swap_test_dir }} |
| 92 | + main_app_dir: ${{ steps.get_swap_test_dir.outputs.main_app_dir }} |
| 93 | + steps: |
| 94 | + - name: Get swap test directory |
| 95 | + id: get_swap_test_dir |
| 96 | + run: | |
| 97 | + echo "swap_test_dir=${{ inputs.swap_test_dir }}" >> "$GITHUB_OUTPUT" |
| 98 | + echo "main_app_dir=${{ inputs.swap_test_dir }}/main_app/exchange/build" >> "$GITHUB_OUTPUT" |
| 99 | + - name: Show swap test directory |
| 100 | + run: | |
| 101 | + echo "Swap test directory: ${{ steps.get_swap_test_dir.outputs.swap_test_dir }}" |
| 102 | + echo "Main app directory: ${{ steps.get_swap_test_dir.outputs.main_app_dir }}" |
| 103 | +
|
| 104 | +
|
| 105 | + # This job runs the swap functional tests using the reusable workflow |
| 106 | + ragger_tests_swap: |
| 107 | + name: Run swap ragger tests using the reusable workflow |
| 108 | + needs: [get_artifacts_names, get_dir_names] |
| 109 | + uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1 |
| 110 | + with: |
| 111 | + download_app_binaries_artifact: ${{ inputs.app_build_artifact }} |
| 112 | + additional_app_binaries_artifact: ${{ needs.get_artifacts_names.outputs.exchange_build_artifact }} |
| 113 | + additional_app_binaries_artifact_dir: ${{ needs.get_dir_names.outputs.main_app_dir }} |
| 114 | + lib_binaries_artifact: ${{ needs.get_artifacts_names.outputs.ethereum_build_artifact }} |
| 115 | + test_dir: ${{ needs.get_dir_names.outputs.swap_test_dir }} |
| 116 | + regenerate_snapshots: ${{ inputs.regenerate_snapshots }} |
0 commit comments