on: workflow_call: inputs: projects: required: true type: string skip-cache: required: false type: boolean tags: required: false type: string jobs: e2e: strategy: matrix: project: ${{ fromJSON(inputs.projects) }} runs-on: self-hosted timeout-minutes: 30 steps: # Checks if skip cache was requested - name: Set skip-nx-cache flag if: ${{ inputs.skip-cache == true }} run: echo SKIP_CACHE="--skip-nx-cache" >> GITHUB_ENV # Checkout front ends - name: Checkout frontend mono repo uses: actions/checkout@v3 with: fetch-depth: 0 path: './frontend-monorepo' # Restore node_modules from cache if possible - name: Restore node_modules from cache uses: actions/cache@v3 with: path: | frontend-monorepo/node_modules /home/runner/.cache/Cypress key: node_modules_cypress-${{ hashFiles('frontend-monorepo/yarn.lock', 'frontend-monorepo/package.json') }} # Install frontend dependencies - name: Install root dependencies run: yarn install --frozen-lockfile working-directory: frontend-monorepo # Make sure that all Cypress binaries are installed properly - name: Install cypress bins run: yarn cypress install working-directory: frontend-monorepo ###### ## Setup Vegacapsule and Vega wallet ###### - name: Run Vegacapsule network and Vega wallet id: setup-vega uses: ./frontend-monorepo/.github/actions/run-vegacapsule ###### ## Run some tests ###### - name: Run Cypress tests run: yarn nx run ${{ matrix.project }}:e2e ${{ env.SKIP_CACHE }} --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome working-directory: frontend-monorepo env: CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }} CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPRESS_ETH_WALLET_MNEMONIC }} CYPRESS_VEGA_WALLET_API_TOKEN: ${{ steps.setup-vega.outputs.token }} CYPRESS_grepTags: ${{ inputs.tags }} ###### ## Upload logs ###### # Artifact path is not valid: /ganache-1/capsule-logscolletor.stderr-2022-12-22T10:20:30Z.log. Contains the following character: Colon : - name: Rename files to allow archive if: ${{ always() }} run: | while read -r file; do mv "${file}" "$(echo ${file} | sed 's|:|-|g')" done< <(find /home/runner/.vegacapsule/testnet/logs -type f) - uses: actions/upload-artifact@v3 if: ${{ always() }} with: name: logs-${{ matrix.project }} path: /home/runner/.vegacapsule/testnet/logs