Skip to content

Commit

Permalink
wip: use repo dir for clone
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrebb committed Jan 16, 2024
1 parent a220279 commit 0ca85d1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/actions/setup-base/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ 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:
Expand All @@ -21,8 +26,22 @@ runs:
limit-access-to-actor: true
detached: ${{ inputs.DEBUG_DETACHED }}

- name: Print tmate session
if: ${{ inputs.DEBUG_ENABLED }}
shell: bash
run: |
- name: Checkout to workspace
shell: bash
run: |
git clone -b ${{ github.event.pull_request.head.sha || github.head_ref || github.ref_name || github.ref }} https://github.com/${{ github.repository }}.git .
ls -las
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 }}
- name: Set workspace root
id: workspace_root
shell: bash
run: |
WORKSPACE_ROOT=$GITHUB_WORKSPACE/repo
echo "WORKSPACE_ROOT=$WORKSPACE_ROOT" | tee -a $GITHUB_OUTPUT
8 changes: 8 additions & 0 deletions .github/workflows/backstop-sanity-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ jobs:
- name: "𓋏 Run `npm run sanity-test`"
continue-on-error: true
shell: bash
working-directory: ${{ steps.base.outputs.WORKSPACE_ROOT }}
run: |
npm run sanity-test
- name: "Validate Puppeteer Report"
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) \
Expand All @@ -74,6 +76,7 @@ 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))
Expand All @@ -89,6 +92,7 @@ jobs:
- name: "Report Validation Outcome"
shell: bash
working-directory: ${{ steps.base.outputs.WORKSPACE_ROOT }}
run: |
if [[ "$PUPPETEER_TEST_RESULT" != "" ]]; then
exit 1
Expand Down Expand Up @@ -120,6 +124,7 @@ jobs:
- 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
Expand All @@ -128,6 +133,7 @@ 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) \
Expand All @@ -146,6 +152,7 @@ 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))
Expand All @@ -161,6 +168,7 @@ jobs:
- name: "Report Validation Outcome"
shell: bash
working-directory: ${{ steps.base.outputs.WORKSPACE_ROOT }}
run: |
if [[ "$PLAYWRIGHT_TEST_RESULT" != "" ]]; then
exit 1
Expand Down

0 comments on commit 0ca85d1

Please sign in to comment.