From 216522fcb820cc53075300dae9f125ebb2ac3bf2 Mon Sep 17 00:00:00 2001 From: Dan Grebb Date: Mon, 15 Jan 2024 20:06:08 -0500 Subject: [PATCH] wip: checkout in composite action --- .github/actions/setup-base/action.yml | 12 +++-------- .github/workflows/backstop-sanity-test.yml | 24 ---------------------- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/.github/actions/setup-base/action.yml b/.github/actions/setup-base/action.yml index 769063cff..32922ef0d 100644 --- a/.github/actions/setup-base/action.yml +++ b/.github/actions/setup-base/action.yml @@ -11,11 +11,6 @@ inputs: required: false default: "true" -outputs: - WORKSPACE_ROOT: - description: "Export the root workspace for all workflows." - value: ${{ steps.workspace_root.outputs.WORKSPACE_ROOT }} - runs: using: "composite" steps: @@ -26,9 +21,8 @@ runs: limit-access-to-actor: true detached: ${{ inputs.DEBUG_DETACHED }} - - name: Set workspace root - id: workspace_root + - name: Checkout to workspace shell: bash run: | - WORKSPACE_ROOT=$GITHUB_WORKSPACE - echo "WORKSPACE_ROOT=$WORKSPACE_ROOT" | tee -a $GITHUB_OUTPUT + git clone -b ${{ github.event.pull_request.head.sha || github.head_ref || github.ref_name || github.ref }} https://github.com/${{ github.repository }}.git . + ls ${{ steps.base.outputs.WORKSPACE_ROOT }} diff --git a/.github/workflows/backstop-sanity-test.yml b/.github/workflows/backstop-sanity-test.yml index 67831ef38..e95cab1e4 100644 --- a/.github/workflows/backstop-sanity-test.yml +++ b/.github/workflows/backstop-sanity-test.yml @@ -43,21 +43,12 @@ jobs: DEBUG_ENABLED: ${{ inputs.DEBUG_ENABLED }} DEBUG_DETACHED: ${{ inputs.DEBUG_DETACHED }} - - name: Checkout to workspace - shell: bash - run: | - rm -rf ${{ steps.base.outputs.WORKSPACE_ROOT }}/* - rm -rf ${{ steps.base.outputs.WORKSPACE_ROOT }}/*.* - git clone -b ${{ github.event.pull_request.head.sha || github.head_ref || github.ref_name || github.ref }} https://github.com/${{ github.repository }}.git ${{ steps.base.outputs.WORKSPACE_ROOT }} - ls ${{ steps.base.outputs.WORKSPACE_ROOT }} - - uses: ./.github/actions/setup-node id: node - name: "𓋏 Run `npm run sanity-test`" continue-on-error: true shell: bash - working-directory: ${{ steps.base.outputs.WORKSPACE_ROOT }} run: | npm run sanity-test @@ -65,7 +56,6 @@ jobs: id: validate-puppeteer continue-on-error: true shell: bash - working-directory: ${{ steps.base.outputs.WORKSPACE_ROOT }} run: | set +e PUPPETEER_TEST_RESULT=$(diff -c <(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end)' test/__fixtures__/sanity-test.json) \ @@ -84,7 +74,6 @@ jobs: id: diff continue-on-error: true shell: bash - working-directory: ${{ steps.base.outputs.WORKSPACE_ROOT }} run: | set +e FULL_TEST_DIFF=$(diff <(jq -S '.tests[]' test/__fixtures__/sanity-test.json) <(jq -S '.tests[]' test/configs/backstop_data/bitmaps_test/**/report.json)) @@ -100,7 +89,6 @@ jobs: - name: "Report Validation Outcome" shell: bash - working-directory: ${{ steps.base.outputs.WORKSPACE_ROOT }} run: | if [[ "$PUPPETEER_TEST_RESULT" != "" ]]; then exit 1 @@ -126,21 +114,12 @@ jobs: DEBUG_ENABLED: ${{ inputs.DEBUG_ENABLED }} DEBUG_DETACHED: ${{ inputs.DEBUG_DETACHED }} - - name: Checkout to workspace - shell: bash - run: | - rm -rf ${{ steps.base.outputs.WORKSPACE_ROOT }}/* - rm -rf ${{ steps.base.outputs.WORKSPACE_ROOT }}/*.* - git clone -b ${{ github.event.pull_request.head.sha || github.head_ref || github.ref_name || github.ref }} https://github.com/${{ github.repository }}.git ${{ steps.base.outputs.WORKSPACE_ROOT }} - ls ${{ steps.base.outputs.WORKSPACE_ROOT }} - - uses: ./.github/actions/setup-node id: node - name: "🎭 Run `npm run sanity-test-playwright`" continue-on-error: true shell: bash - working-directory: ${{ steps.base.outputs.WORKSPACE_ROOT }} run: | npx playwright install --with-deps npm run sanity-test-playwright @@ -149,7 +128,6 @@ jobs: id: validate-playwright continue-on-error: true shell: bash - working-directory: ${{ steps.base.outputs.WORKSPACE_ROOT }} run: | set +e PLAYWRIGHT_TEST_RESULT=$(diff -c <(jq 'walk(if type == "object" then with_entries(.value |= if type == "object" or type == "array" then . else "" end) else . end)' test/__fixtures__/sanity-test-playwright.json) \ @@ -168,7 +146,6 @@ jobs: id: diff continue-on-error: true shell: bash - working-directory: ${{ steps.base.outputs.WORKSPACE_ROOT }} run: | set +e FULL_TEST_DIFF=$(diff <(jq -S '.tests[]' test/__fixtures__/sanity-test-playwright.json) <(jq -S '.tests[]' test/configs/backstop_data/bitmaps_test/**/report.json)) @@ -184,7 +161,6 @@ jobs: - name: "Report Validation Outcome" shell: bash - working-directory: ${{ steps.base.outputs.WORKSPACE_ROOT }} run: | if [[ "$PLAYWRIGHT_TEST_RESULT" != "" ]]; then exit 1