Skip to content

Commit

Permalink
small test
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Aug 18, 2022
1 parent 844d209 commit 88ac8ea
Showing 1 changed file with 143 additions and 136 deletions.
279 changes: 143 additions & 136 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,91 +11,91 @@ on:
- fix/nightly

jobs:
assert_test_runner:
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/[email protected]
- name: Run test runner
uses: mathiasvr/command-output@v1
id: tests
with:
run: |
yarn build
yarn test-storybook:ci
- name: Get prerelease version of Storybook
if: ${{ failure() }}
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: ${{ failure() }}
id: slack
uses: slackapi/[email protected]
with:
channel-id: '${{ secrets.SLACK_CHANNEL_ID }}'
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":storybook: :runner: [Test Runner] The Nightly check has failed :alert:",
"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 }}
# assert_test_runner:
# 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/[email protected]
# - name: Run test runner
# uses: mathiasvr/command-output@v1
# id: tests
# with:
# run: |
# yarn build
# yarn test-storybook:ci

# - name: Get prerelease version of Storybook
# if: ${{ failure() }}
# 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: ${{ failure() }}
# id: slack
# uses: slackapi/[email protected]
# with:
# channel-id: '${{ secrets.SLACK_CHANNEL_ID }}'
# payload: |
# {
# "blocks": [
# {
# "type": "header",
# "text": {
# "type": "plain_text",
# "text": ":storybook: :runner: [Test Runner] The Nightly check has failed :alert:",
# "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 }}
assert_test_runner_failures:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -131,55 +131,62 @@ jobs:
yarn test-storybook:ci-failures
content=`cat ./test-results.json`
echo "::set-output name=results::$content"
- name: Get prerelease version of Storybook
if: ${{ always() && fromJson(steps.tests.outputs.results).numPassedTests > 0 }}
echo "test_results=$(cat ./test-results.json)" >> $GITHUB_ENV
- name: Print results
if: ${{ always() }}
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 if any test passes
if: ${{ always() && fromJson(steps.tests.outputs.results).numPassedTests > 0 }}
id: slack
uses: slackapi/[email protected]
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 }}
echo ${{ steps.tests.outputs }}
echo ${{ env.test_results }}
echo ${{ steps.tests.outputs }} >> $GITHUB_STEP_SUMMARY
# - name: Get prerelease version of Storybook
# if: ${{ always() && fromJson(steps.tests.outputs.results).numPassedTests > 0 }}
# 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 if any test passes
# if: ${{ always() && fromJson(steps.tests.outputs.results).numPassedTests > 0 }}
# id: slack
# uses: slackapi/[email protected]
# 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 88ac8ea

Please sign in to comment.