name: RUN_CRITICAL_TESTS # Only trigger, when the build workflow succeeded on: workflow_run: workflows: [TEST-ENV-DEPLOYMENT] types: [completed] jobs: cypress-run-critical: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v1 - name: Get API_URI id: api_uri # Search for API_URI in PR description and use default if not defined env: pull_request_body: ${{ github.event.pull_request.body }} prefix: API_URI= pattern: (http|https)://[a-zA-Z0-9.-]+/graphql/? fallback_uri: ${{ secrets.CYPRESS_API_URI }} run: | echo "::set-output name=custom_api_uri::$(echo $pull_request_body | grep -Eo "$prefix$pattern" | sed s/$prefix// | head -n 1 | { read custom_uri; if [ -z "$custom_uri" ]; then echo "$fallback_uri"; else echo "$custom_uri"; fi })" - name: Get base_URL id: base_URL run: | echo "::set-output name=base_URL::https://$(echo ${GITHUB_HEAD_REF}).dashboard.saleor.rocks" - name: Setup Node uses: actions/setup-node@v1 with: node-version: 14 - name: Cache node modules uses: actions/cache@v2 env: cache-name: cache-node-modules with: path: ~/.npm key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-qa-${{ env.cache-name }}- ${{ runner.os }}-qa- ${{ runner.os }}- - name: Install Dependencies if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm install - name: Cypress run critical uses: cypress-io/github-action@v2 env: API_URI: ${{ steps.api_uri.outputs.custom_api_uri }} APP_MOUNT_URI: ${{ secrets.APP_MOUNT_URI }} CYPRESS_baseUrl: ${{ steps.base_URL.outputs.base_URL }} CYPRESS_USER_NAME: ${{ secrets.CYPRESS_USER_NAME }} CYPRESS_SECOND_USER_NAME: ${{ secrets.CYPRESS_SECOND_USER_NAME }} CYPRESS_USER_PASSWORD: ${{ secrets.CYPRESS_USER_PASSWORD }} CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} with: command: npm run cy:run:critical wait-on: ${{ steps.base_URL.outputs.base_URL }} - uses: actions/upload-artifact@v1 with: name: cypress-videos path: cypress/videos