Skip to content

Commit 9cf864d

Browse files
author
Luke Bowerman
authored
chore: Enable image-snapshots generation via Github Actions CI (#1831)
1 parent fe129ec commit 9cf864d

File tree

322 files changed

+40
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+40
-13
lines changed

.github/pull_request_template.md

Lines changed: 0 additions & 1 deletion

.github/workflows/canary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
- name: Create canary release
3636
run: |
37-
yarn lerna version prerelease --conventional-commits --no-git-tag-version --no-push --preid canary --yes --exact
37+
yarn lerna version prerelease --conventional-commits --preid canary --yes --exact
3838
git config --local user.email "[email protected]"
3939
git config --local user.name "GitHub Action"
4040
git commit -am "chore: Publish"

.github/workflows/ci.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: "Lint: ESLint + Prettier, Stylelint, Typescript"
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v1
15+
- uses: actions/checkout@v2
1616
- uses: c-hive/gha-yarn-cache@v1
1717
- run: yarn install
1818
- run: yarn prebuild
@@ -28,7 +28,7 @@ jobs:
2828
name: "Tests: Jest + RTL"
2929
runs-on: ubuntu-latest
3030
steps:
31-
- uses: actions/checkout@v1
31+
- uses: actions/checkout@v2
3232
- uses: c-hive/gha-yarn-cache@v1
3333
- run : yarn --silent
3434
- run: yarn test
@@ -41,7 +41,7 @@ jobs:
4141
name: "Build: ES & Typescript"
4242
runs-on: ubuntu-latest
4343
steps:
44-
- uses: actions/checkout@v1
44+
- uses: actions/checkout@v2
4545
- uses: c-hive/gha-yarn-cache@v1
4646
- run : yarn --silent
4747
- run: yarn build
@@ -50,7 +50,7 @@ jobs:
5050
runs-on: ubuntu-latest
5151
if: github.event.pull_request.draft == false
5252
steps:
53-
- uses: actions/checkout@v1
53+
- uses: actions/checkout@v2
5454
- uses: c-hive/gha-yarn-cache@v1
5555
- run : yarn --silent
5656
- run: yarn prebuild
@@ -60,17 +60,36 @@ jobs:
6060
runs-on: ubuntu-latest
6161
if: github.event.pull_request.draft == false
6262
steps:
63-
- uses: actions/checkout@v1
63+
- uses: actions/checkout@v2
6464
- uses: c-hive/gha-yarn-cache@v1
6565
- run : yarn --silent
6666
- run: yarn prebuild
6767
- run: yarn workspace storybook build
6868
image-snapshots:
6969
name: "Image Snapshots"
70-
if: false # Disabled until snapshot issues can be resolved
7170
runs-on: ubuntu-latest
71+
if: github.event.pull_request.draft == false
7272
steps:
73-
- uses: actions/checkout@v1
73+
- uses: actions/checkout@v2
74+
with:
75+
ref: ${{ github.event.pull_request.head.ref }}
7476
- uses: c-hive/gha-yarn-cache@v1
7577
- run : yarn --silent
7678
- run: yarn test:image-snapshots
79+
id: snapshots
80+
# If snapshots failed, build fresh ones and open a PR to help out our friends
81+
- name: Fresh snapshots
82+
if: ${{ always() && (steps.snapshots.outcome == 'failure') }}
83+
run: yarn test:image-snapshots-update
84+
id: snapshots-update
85+
- name: Create Pull Request
86+
if: ${{ always() && (steps.snapshots-update.outcome == 'success') }}
87+
uses: peter-evans/create-pull-request@v3
88+
with:
89+
commit-message: "chore: image-snapshot updates"
90+
branch: "${{ github.event.pull_request.head.ref }}-snapshot-updates"
91+
delete-branch: true
92+
title: "chore: snapshot-updates for \"${{ github.event.pull_request.title }}\""
93+
body: Image snapshot updates for the PR \"${{ github.event.pull_request.title }}\""
94+
labels: image-snapshots
95+
reviewers: "${{ github.payload.pull_request.sender.login }}"

README.md

Lines changed: 0 additions & 3 deletions

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,19 @@
4646
"lint-staged": "yarn exec lint-staged",
4747
"pretest": "yarn prebuild",
4848
"test": "yarn jest",
49+
4950
"storybook": "yarn workspace storybook develop",
5051
"storybook-docs": "yarn workspace storybook develop-docs",
5152
"storybook-workspaces-build": "yarn lerna run storybook-build --scope '@looker/*' --stream --parallel",
53+
5254
"storyshots-prep": "export storybookBuildMode=fast && yarn pretest && yarn storybook-workspaces-build",
5355
"pretest:image-snapshots": "yarn storyshots-prep",
5456
"test:image-snapshots": "yarn jest --config jest-image-snapshots.config.js",
55-
"test:image-snapshots-update": "rm -rf packages/*/snapshots && yarn test:image-snapshots",
57+
"test:image-snapshots-update": "rm -rf packages/*/snapshots && yarn jest -u --config jest-image-snapshots.config.js",
58+
5659
"pretest:a11y": "yarn storyshots-prep",
5760
"test:a11y": "yarn jest --config jest-a11y.config.js",
61+
5862
"website-canary": "./config/website-canary.sh",
5963
"website-latest": "./config/website-latest.sh"
6064
},

packages/components/.storybook/preview-head.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
padding: 0 !important; /* stylelint-disable-line declaration-no-important */
44
}
55
</style>
6+
<link rel="preconnect" href="https://fonts.gstatic.com">
7+
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500;600;700&family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap" rel="stylesheet">
-220 Bytes
-247 Bytes
-9 Bytes
-1 Bytes

0 commit comments

Comments
 (0)