mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Issue number: N/A
---------
<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->
<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->
## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->
GitHub actions allow screenshots to be updated either by updating all
the components or providing a component name.
If a component name is given, then the screenshots will only be updated
on `src/components/{component-name}`. This isn't ideal when wanting to
update a specific path.
## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->
- The script no longer strips out `ion-`. The developer needs to submit
a valid component name or valid path.
- The script no longer appends the value to `src/components/`
- The script will run all instances of a component if only the name is
given
- The script will run tests within a given path
## Does this introduce a breaking change?
- [ ] Yes
- [x] No
<!--
If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->
## Other information
<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
How to test:
1. Create a new branch based off this one
2. Make a style change
3. Push it to the new branch
4. Update the reference images using the new branch
5. This will show you all the options
Recommended to test:
- a component name (`chip`)
- a path (`src/components/chip/test/a11y`)
- a component that doesn't exist (`random-component`)
- no provided component, leave the first input blank
73 lines
3.2 KiB
YAML
73 lines
3.2 KiB
YAML
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
|
|
default: ''
|
|
|
|
jobs:
|
|
build-core:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/workflows/actions/build-core
|
|
|
|
test-core-screenshot:
|
|
strategy:
|
|
# This ensures that all screenshot shard
|
|
# failures are reported so the dev can
|
|
# review everything at once.
|
|
fail-fast: false
|
|
matrix:
|
|
# Divide the tests into n buckets
|
|
# and run those buckets in parallel.
|
|
# To increase the number of shards,
|
|
# add new items to the shard array
|
|
# and change the value of totalShards
|
|
# to be the length of the shard array.
|
|
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
|
|
totalShards: [20]
|
|
needs: [build-core]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/workflows/actions/test-core-screenshot
|
|
with:
|
|
shard: ${{ matrix.shard }}
|
|
totalShards: ${{ matrix.totalShards }}
|
|
update: true
|
|
component: ${{ inputs.component }}
|
|
|
|
update-reference-screenshots:
|
|
runs-on: ubuntu-latest
|
|
needs: [test-core-screenshot]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
# Normally, we could just push with the
|
|
# default GITHUB_TOKEN, but that will
|
|
# not cause the build workflow
|
|
# to re-run. We use Ionitron's
|
|
# Personal Access Token instead
|
|
# to allow for this build workflow
|
|
# to run when the screenshots are pushed.
|
|
with:
|
|
token: ${{ secrets.IONITRON_TOKEN }}
|
|
- uses: ./.github/workflows/actions/update-reference-screenshots
|