Skip to content

Commit

Permalink
wip: checkout in composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrebb committed Jan 16, 2024
1 parent 02d4707 commit 216522f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
12 changes: 3 additions & 9 deletions .github/actions/setup-base/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
24 changes: 0 additions & 24 deletions .github/workflows/backstop-sanity-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,19 @@ 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
- 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 @@ -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))
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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) \
Expand All @@ -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))
Expand All @@ -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
Expand Down

0 comments on commit 216522f

Please sign in to comment.