chore: sync with main

This commit is contained in:
Liam DeBeasi
2024-03-19 14:24:51 -04:00
75 changed files with 1065 additions and 645 deletions

View File

@@ -21,33 +21,13 @@ runs:
name: ionic-core
path: ./core
filename: CoreBuild.zip
- name: Install Playwright Dependencies
run: npm install && npx playwright install && npx playwright install-deps
- name: Install Dependencies
run: npm install
shell: bash
working-directory: ./core
- id: clean-component-name
name: Clean Component Name
# Remove `ion-` prefix from the `component` variable if it exists.
run: |
echo "component=$(echo ${{ inputs.component }} | sed 's/ion-//g')" >> $GITHUB_OUTPUT
shell: bash
- id: set-test-file
name: Set Test File
# Screenshots can be updated for all components or specified component(s).
# If the `component` variable is set, then the test has the option to
# - run all the file paths that are in a component folder.
# -- For example: if the `component` value is "item", then the test will run all the file paths that are in the "src/components/item" folder.
# -- For example: if the `component` value is "item chip", then the test will run all the file paths that are in the "src/components/item" and "src/components/chip" folders.
run: |
if [ -n "${{ steps.clean-component-name.outputs.component }}" ]; then
echo "testFile=\$(echo '${{ steps.clean-component-name.outputs.component }}' | awk '{for(i=1;i<=NF;i++) \$i=\"src/components/\"\$i}1')" >> $GITHUB_OUTPUT
else
echo "testFile=$(echo '')" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Test
if: inputs.update != 'true'
run: npm run test.e2e ${{ steps.set-test-file.outputs.testFile }} -- --shard=${{ inputs.shard }}/${{ inputs.totalShards }}
run: npm run test.e2e.docker.ci ${{ inputs.component }} -- --shard=${{ inputs.shard }}/${{ inputs.totalShards }}
shell: bash
working-directory: ./core
- name: Test and Update
@@ -69,7 +49,7 @@ runs:
# which is why we not using the upload-archive
# composite step here.
run: |
npm run test.e2e ${{ steps.set-test-file.outputs.testFile }} -- --shard=${{ inputs.shard }}/${{ inputs.totalShards }} --update-snapshots
npm run test.e2e.docker.ci ${{ inputs.component }} -- --shard=${{ inputs.shard }}/${{ inputs.totalShards }} --update-snapshots
git add src/\*.png --force
mkdir updated-screenshots
cd ../ && rsync -R --progress $(git diff --name-only --cached) core/updated-screenshots

View File

@@ -25,12 +25,9 @@ runs:
# Configure user as Ionitron
# and push only the changed .png snapshots
# to the remote branch.
# Screenshots are in .gitignore
# Non-Linux screenshots are in .gitignore
# to prevent local screenshots from getting
# pushed to Git. As a result, we need --force
# here so that CI generated screenshots can
# get added to git. Screenshot ground truths
# should only be added via this CI process.
# pushed to Git.
run: |
git config user.name ionitron
git config user.email hi@ionicframework.com
@@ -38,7 +35,7 @@ runs:
# This adds an empty entry for new
# screenshot files so we can track them with
# git diff
git add src/\*.png --force -N
git add src/\*.png -N
if git diff --exit-code; then
echo -e "\033[1;31m⚠ Error: No new screenshots generated ⚠️\033[0m"
@@ -48,7 +45,7 @@ runs:
else
# This actually adds the contents
# of the screenshots (including new ones)
git add src/\*.png --force
git add src/\*.png
git commit -m "chore(): add updated snapshots"
git push
fi

View File

@@ -3,6 +3,20 @@ name: 'Update Reference Screenshots'
on:
workflow_dispatch:
inputs:
# Screenshots can be updated for all components or specified component(s).
# If the `component` variable is set, then the test has the option to
# - run all the instances of the specified component(s) in the `src/components` folder
# -- For example: if the `component` value is "item", then the following command will be: `npm run test.e2e item`
# - run the specified file path
# -- For example: if the `component` value is "src/components/item/test/basic", then the following command will be: `npm run test.e2e src/components/item/test/basic`
# - run multiple specified components based on the space-separated value
# -- For example: if the `component` value is "item basic", then the following command will be: `npm run test.e2e item basic`
# -- For example: if the `component` value is "src/components/item/test/basic src/components/item/test/a11y", then the following command will be: `npm run test.e2e src/components/item/test/basic src/components/item/test/a11y`
#
# If the `component` variable is not set, then the test will run all the instances of the components in the `src/components` folder.
# - For example: `npm run test.e2e`
#
# More common options can be found at the Playwright Command line page: https://playwright.dev/docs/test-cli
component:
description: 'What component(s) should be updated? (leave blank to update all or use a space-separated list for multiple components)'
required: false