|
| 1 | +name: BE App E2E tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + secrets: |
| 6 | + ALLURE_TOKEN: |
| 7 | + description: 'A token passed from the caller workflow' |
| 8 | + required: true |
| 9 | + inputs: |
| 10 | + environmentTags: |
| 11 | + type: string |
| 12 | + default: '' |
| 13 | + required: false |
| 14 | + targetUrl: |
| 15 | + type: string |
| 16 | + default: 'https://staging-scan-v2.zksync.dev/' |
| 17 | + required: true |
| 18 | + default_network_value_for_e2e: |
| 19 | + type: string |
| 20 | + default: '/?network=mainnet' |
| 21 | + required: true |
| 22 | + testnet_network_value_for_e2e: |
| 23 | + type: string |
| 24 | + default: '/?network=sepolia' |
| 25 | + required: true |
| 26 | + publish_to_allure: #Here we define the variable that can be overwritten by caller workflow |
| 27 | + type: boolean |
| 28 | + description: "Publish test results to allure" |
| 29 | + default: true |
| 30 | + required: false |
| 31 | + |
| 32 | +env: |
| 33 | + ALLURE_SEARCH_REQUEST: '[{"id":"name","type":"string","value":"#${{ github.run_number }}"}]' |
| 34 | + ALLURE_BASIC_TAGS: "${{ github.head_ref }}, #${{ github.run_number }}, ${{ github.event.pull_request.title }}" |
| 35 | + ALLURE_PROJECT_ID: ${{ vars.ALLURE_PROJECT_ID }} |
| 36 | + ALLURE_ENDPOINT: ${{ vars.ALLURE_ENDPOINT }} |
| 37 | + |
| 38 | +jobs: |
| 39 | + e2e: |
| 40 | + runs-on: [matterlabs-ci-runner] |
| 41 | + permissions: |
| 42 | + contents: read |
| 43 | + defaults: |
| 44 | + run: |
| 45 | + working-directory: ./packages/app |
| 46 | + strategy: |
| 47 | + fail-fast: false |
| 48 | + matrix: |
| 49 | + tags: [ |
| 50 | + "@artifactsSet1", |
| 51 | + "@artifactsSet2", |
| 52 | + "@artifactsSet3", |
| 53 | + "@artifactsSet4", |
| 54 | + "@redirectionSet1", |
| 55 | + "@redirectionSet2", |
| 56 | + "@redirectionSet3", |
| 57 | + "@copying", |
| 58 | + "@search", |
| 59 | + "@testnetSmokeSuite" |
| 60 | + ] |
| 61 | + |
| 62 | + name: '${{ matrix.tags }}' |
| 63 | + container: |
| 64 | + image: mcr.microsoft.com/playwright:v1.27.0-focal |
| 65 | + options: --user 1001 |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v3 |
| 68 | + with: |
| 69 | + fetch-depth: 0 |
| 70 | + |
| 71 | + - name: Setup Node.js |
| 72 | + uses: actions/setup-node@v3 |
| 73 | + with: |
| 74 | + node-version: '18' |
| 75 | + cache: 'npm' |
| 76 | + |
| 77 | +# - name: Cache node modules |
| 78 | +# id: cache-nodemodules |
| 79 | +# uses: actions/cache@v3 |
| 80 | +# env: |
| 81 | +# cache-name: cache-node-modules |
| 82 | +# # Workaround for bug https://github.com/typicode/husky/issues/991 |
| 83 | +# HUSKY: 0 |
| 84 | +# with: |
| 85 | +# path: node_modules |
| 86 | +# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| 87 | +# restore-keys: | |
| 88 | +# ${{ runner.os }}-build-${{ env.cache-name }}- |
| 89 | +# ${{ runner.os }}-build- |
| 90 | +# ${{ runner.os }}- |
| 91 | + |
| 92 | +# - name: Install dependencies |
| 93 | +# working-directory: ./ |
| 94 | +# if: steps.cache-nodemodules.outputs.cache-hit != 'true' |
| 95 | +# run: | |
| 96 | +# npm pkg delete scripts.prepare |
| 97 | +# npm ci |
| 98 | +# |
| 99 | +# - name: Download allurectl |
| 100 | +# run: wget https://github.com/allure-framework/allurectl/releases/latest/download/allurectl_linux_386 -O ./allurectl |
| 101 | +# |
| 102 | +# - name: Change permission for allurectl |
| 103 | +# run: chmod +x ./allurectl |
| 104 | +# |
| 105 | +# - name: Launch tests |
| 106 | +# env: |
| 107 | +# CI: 'true' |
| 108 | +# TARGET_ENV: ${{ inputs.targetUrl }} |
| 109 | +# run: | |
| 110 | +# echo "Run tests" |
| 111 | +# if [ "${{ matrix.tags }}" = "@testnetSmokeSuite" ]; then |
| 112 | +# echo "Run in testnetSmokeSuite only" |
| 113 | +# E2ENETWORK='${{ inputs.testnet_network_value_for_e2e }}' npx cucumber-js --tags "${{ matrix.tags }} ${{ inputs.environmentTags }} and not @mainnet" |
| 114 | +# else |
| 115 | +# echo "Run in mainnet" |
| 116 | +# E2ENETWORK='${{ inputs.default_network_value_for_e2e }}' npx cucumber-js --tags "${{ matrix.tags }} ${{ inputs.environmentTags }} and not @testnet" |
| 117 | +# fi |
| 118 | +# |
| 119 | +# - name: Save artifacts to Git |
| 120 | +# if: always() |
| 121 | +# uses: actions/upload-artifact@v3 |
| 122 | +# with: |
| 123 | +# name: allure-results |
| 124 | +# path: packages/app/allure-results |
| 125 | +# |
| 126 | +# - name: Upload test results to Allure reporter |
| 127 | +# if: always() |
| 128 | +# env: |
| 129 | +# ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }} |
| 130 | +# run: | |
| 131 | +# ./allurectl upload allure-results |
| 132 | +# echo "*Public report link: https://raw.githack.com/matter-labs/block-explorer/gh-pages/${{ github.run_number }}/index.html" |
| 133 | +# echo "*Public report link will be available when the 'Allure Report' job will be succesfully executed." |
| 134 | +# |
| 135 | +# - if: failure() |
| 136 | +# name: Save artifacts |
| 137 | +# uses: actions/upload-artifact@v3 |
| 138 | +# with: |
| 139 | +# name: portal_e2e_${{ github.run_number }}_artifacts |
| 140 | +# path: packages/app/tests/e2e/artifacts/* |
| 141 | +# |
| 142 | +# publish: |
| 143 | +# name: Allure Report |
| 144 | +# runs-on: ubuntu-latest |
| 145 | +# permissions: |
| 146 | +# contents: write |
| 147 | +# needs: e2e |
| 148 | +# if: always() |
| 149 | +# steps: |
| 150 | +# - uses: actions/checkout@v3 |
| 151 | +# |
| 152 | +# - uses: actions/download-artifact@v2 |
| 153 | +# with: |
| 154 | +# name: allure-results |
| 155 | +# path: packages/app/allure-results |
| 156 | +# |
| 157 | +# - name: Get Allure history |
| 158 | +# uses: actions/checkout@v3 |
| 159 | +# if: always() |
| 160 | +# continue-on-error: true |
| 161 | +# with: |
| 162 | +# ref: gh-pages |
| 163 | +# path: gh-pages |
| 164 | +# |
| 165 | +# - name: Allure Report action from marketplace |
| 166 | +# uses: simple-elf/allure-report-action@v1.7 |
| 167 | +# if: always() |
| 168 | +# id: allure-report |
| 169 | +# with: |
| 170 | +# allure_results: packages/app/allure-results |
| 171 | +# gh_pages: gh-pages |
| 172 | +# allure_report: allure-report |
| 173 | +# allure_history: allure-history |
| 174 | +# keep_reports: 10 |
| 175 | +# |
| 176 | +# - name: Deploy report to Github Pages |
| 177 | +# if: always() |
| 178 | +# uses: peaceiris/actions-gh-pages@v2 |
| 179 | +# env: |
| 180 | +# PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 181 | +# PUBLISH_BRANCH: gh-pages |
| 182 | +# PUBLISH_DIR: allure-history |
| 183 | +# |
| 184 | +# - name: Prepare a link |
| 185 | +# run: | |
| 186 | +# echo "BASE64_SEARCH_REQUEST=$(echo '${{ env.ALLURE_SEARCH_REQUEST }}' | base64)" >> $GITHUB_ENV |
| 187 | +# |
| 188 | +# - name: Publish Allure link to GIT Summary |
| 189 | +# run: | |
| 190 | +# LINK1="${{ vars.ALLURE_ENDPOINT }}project/${{ vars.ALLURE_PROJECT_ID }}/launches?search=${{ env.BASE64_SEARCH_REQUEST }}" |
| 191 | +# LINK2="https://raw.githack.com/matter-labs/block-explorer/gh-pages/${{ github.run_number }}/index.html" |
| 192 | +# echo "Allure [Private]($LINK1) and [Public]($LINK2) links:rocket: in git run #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY |
0 commit comments