Skip to content

Commit

Permalink
add failure test to nightly check
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Aug 18, 2022
1 parent 8ce1905 commit 604ca98
Showing 1 changed file with 90 additions and 4 deletions.
94 changes: 90 additions & 4 deletions .github/workflows/nightly.yml
Expand Up @@ -3,15 +3,15 @@ name: Nightly checks
# runs every day at midnight
on:
schedule:
- cron: "0 0 * * *"
- cron: '0 0 * * *'
workflow_dispatch:
# To test fixes on push rather than wait for the scheduling
push:
branches:
- fix/nightly

jobs:
test_storybook_prerelease:
assert_test_runner:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -37,7 +37,6 @@ jobs:
- name: Fix local @storybook/csf version
run: |
yarn add @storybook/csf@0.0.2--canary.4566f4d.1
- name: Run test runner
uses: mathiasvr/command-output@v1
id: tests
Expand All @@ -57,7 +56,7 @@ jobs:
id: slack
uses: slackapi/slack-github-action@v1.19.0
with:
channel-id: "${{ secrets.SLACK_CHANNEL_ID }}"
channel-id: '${{ secrets.SLACK_CHANNEL_ID }}'
payload: |
{
"blocks": [
Expand Down Expand Up @@ -97,3 +96,90 @@ jobs:
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
assert_test_runner_failures:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Get current version of Storybook
run: |
echo "prev_sb_version=$(yarn list @storybook/react --depth=0 2> /dev/null | grep @storybook/react | awk -F'@' '{print $3}')" >> $GITHUB_ENV
echo "prev_sb_csf_version=$(yarn list @storybook/csf --depth=0 2> /dev/null | grep @storybook/csf | awk -F'@' '{print $3}')" >> $GITHUB_ENV
- name: Upgrade to storybook@future
run: |
npx storybook@future upgrade --prerelease --yes
# TODO: This should not be necessary once @storybook/csf is properly updated
- name: Fix local @storybook/csf version
run: |
yarn add @storybook/csf@0.0.2--canary.4566f4d.1
- name: Run test runner and expect failure
uses: mathiasvr/command-output@v1
id: tests
with:
run: |
yarn build
yarn test-storybook:ci
env:
TEST_FAILURES: true

- name: Get prerelease version of Storybook
if: ${{ success() }}
run: |
echo "sb_version=$(yarn list @storybook/react --depth=0 2> /dev/null | grep @storybook/react | awk -F'@' '{print $3}')" >> $GITHUB_ENV
echo "sb_csf_version=$(yarn list @storybook/csf --depth=0 2> /dev/null | grep @storybook/csf | awk -F'@' '{print $3}')" >> $GITHUB_ENV
- name: Report incoming errors
if: ${{ success() }}
id: slack
uses: slackapi/slack-github-action@v1.19.0
with:
channel-id: '${{ secrets.SLACK_CHANNEL_ID }}'
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":storybook: :runner: [Test Runner] The Nightly check for **failures** has passed :thinking_face:",
"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*@storybook/react version:*\n${{ env.prev_sb_version }} >> ${{ env.sb_version }}"
},
{
"type": "mrkdwn",
"text": "*@storybook/csf version:*\n${{ env.prev_sb_csf_version }} >> ${{ env.sb_csf_version }}"
}
],
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "View failure",
"emoji": true
},
"value": "view_failure",
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_id": "button-action"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

0 comments on commit 604ca98

Please sign in to comment.