diff --git a/action.yml b/action.yml index b64773a..69758bc 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ -name: 'MeshMap-Snapshot' -description: 'Walks in application and takes a shot of your infrastructure using Meshery Extension MeshMap' +name: "MeshMap-Snapshot" +description: "Walks in application and takes a shot of your infrastructure using Meshery Extension MeshMap" author: Layer5 inputs: designID: @@ -64,7 +64,7 @@ runs: cluster_name: "kind-cluster" - run: echo ${{ steps.ping-playground.outputs.IS_PLAYGROUND_RUNNING }} shell: bash - - run: + - run: working-directory: action/cypress-action/ if: ${{ !steps.ping-playground.outputs.IS_PLAYGROUND_RUNNING }} shell: bash @@ -96,35 +96,16 @@ runs: - run: echo $APPLICATION_ID && echo ${{env.APPLICATION_ID}} shell: bash - name: Cypress run - uses: cypress-io/github-action@v4 - with: - working-directory: action/cypress-action - spec: cypress/e2e/e2e/**/* - browser: chrome - # record: true - env: - GITHUB_TOKEN: ${{ inputs.githubToken }} - CYPRESS_token: ${{ inputs.providerToken }} - CYPRESS_releasetag: ${{env.tag}} - CYPRESS_applicationId: ${{ env.APPLICATION_ID }} - # CYPRESS_RECORD_KEY: ${{ inputs.cypressRecordKey }} + uses: action/cypress-job #reference to cypress workflow - run: ls shell: bash - run: tree action/cypress-action/cypress/ -L 2me shell: bash - name: Upload Cypress artifacts - if: always() - uses: actions/upload-artifact@v3 - with: - name: cypress-ss - path: action/cypress-action/cypress/videos + uses: cypress-ss - name: Upload Cypress artifacts - if: always() - uses: actions/upload-artifact@v3 - with: - name: cypress-ss - path: action/cypress-action/cypress/screenshots - - run: echo "SCREENSHOT_NAME=$(ls)" >> $GITHUB_ENV # Assumption: There is only one screenshot in the download directory + uses: cypress-artifacts + - run: echo "SCREENSHOT_NAME=$(ls)" >> $GITHUB_ENV # Assumption: There is only one screenshot in the download directory working-directory: action/cypress-action/cypress/downloads shell: bash - run: mv "$SCREENSHOT_NAME" screenshot.png diff --git a/cypress-artifacts.yml b/cypress-artifacts.yml new file mode 100644 index 0000000..881b12e --- /dev/null +++ b/cypress-artifacts.yml @@ -0,0 +1,11 @@ +name: cypress-artifacts + +on: + pull_request_target: + types: [opened, synchronize, reopened] +jobs: + cypress-artifacts: + runs-on: ubuntu-latest + + steps: + diff --git a/cypress-ss.yml b/cypress-ss.yml new file mode 100644 index 0000000..4ed186a --- /dev/null +++ b/cypress-ss.yml @@ -0,0 +1,24 @@ +name: Cypress-ss + +on: + pull_request_target: + types: [opened, synchronize, reopened] + +jobs: + cypress-ss: + runs-on: ubuntu-latest + + steps: + - name: Upload Cypress artifacts + if: always() + uses: actions/upload-artifact@v3 + with: + name: cypress-ss + path: action/cypress-action/cypress/videos + + - name: Upload Cypress artifacts + if: always() + uses: actions/upload-artifact@v3 + with: + name: cypress-ss + path: action/cypress-action/cypress/screenshots \ No newline at end of file diff --git a/cypress.yml b/cypress.yml new file mode 100644 index 0000000..00042ee --- /dev/null +++ b/cypress.yml @@ -0,0 +1,28 @@ +name: Cypress Run Workflow + +on: + pull_request_target: + types: [opened, synchronize, reopened] +jobs: + cypress-job: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Cypress run + uses: cypress-io/github-action@v4 + with: + working-directory: action/cypress-action + spec: cypress/e2e/e2e/**/* + browser: chrome + # record: true + env: + GITHUB_TOKEN: ${{ inputs.githubToken }} + CYPRESS_token: ${{ inputs.providerToken }} + CYPRESS_releasetag: ${{env.tag}} + CYPRESS_applicationId: ${{ env.APPLICATION_ID }} + # CYPRESS_RECORD_KEY: ${{ inputs.cypressRecordKey }} + + \ No newline at end of file diff --git a/token-provider.sh b/token-provider.sh new file mode 100644 index 0000000..193d1a1 --- /dev/null +++ b/token-provider.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +PROVIDER_TOKEN=${{inputs.providerToken}} node node-file-upload/index.js > __fileResponse.txt + outputstr=$(head -n 1 __fileResponse.txt) + required_string="https" + echo $outputstr + + if [[ "$outputstr" == "$required_string"* ]]; then + echo "RESOURCE_URL=$outputstr" >> $GITHUB_ENV + else + echo "RESOURCE_URL=false" >> $GITHUB_ENV + fi \ No newline at end of file