v2.x Pull Request #5928
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull Request | |
run-name: v2.x Pull Request | |
on: | |
pull_request: | |
branches: | |
- v2.x | |
env: | |
DOCUMENTATION_PUBLISH_REPO: ${{ github.repository_owner }}/${{ github.repository_owner }}.github.io | |
DOCUMENTATION_PUBLISH_BRANCH: v2.x | |
DOCUMENTATION_PUBLISH_FOLDER: uikit/pr-${{ github.event.number }} | |
DOCUMENTATION_PUBLISH_MESSAGE: "docs: storybook for PR ${{ github.event.number }} of ${{ github.repository }}" | |
DOCUMENTATION_URL: https://${{ github.repository_owner }}.github.io/uikit/pr-${{ github.event.number }}/ | |
PR_URL: https://github.com/${{ github.repository }}/pull/${{ github.event.number }} | |
RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }} | |
APPLITOOLS_BATCH_ID: ${{ github.event.pull_request.head.sha }} | |
APPLITOOLS_SERVER_URL: "https://eyesapi.applitools.com" | |
jobs: | |
Static-Checks: | |
name: Licenses, Lint, Jest | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- name: Install | |
run: npm ci | |
- name: Bootstrap | |
run: npm run bootstrap | |
- name: Build | |
run: npm run build | |
- name: License Check | |
run: npm run license-check | |
- name: Lint | |
run: npm run lint | |
- name: Test | |
run: npm run test | |
Build-Storybook: | |
name: Build Storybook | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- name: Install | |
run: npm ci | |
- name: Bootstrap | |
run: npm run bootstrap | |
- name: Build Storybook | |
run: npm run build-documentation | |
- name: Archive Storybook | |
uses: actions/upload-artifact@v2 | |
with: | |
name: storybook-v2 | |
path: ${{ github.workspace }}/dist | |
- name: Clean Folders | |
if: always() | |
run: rm -rf ${{ github.workspace }}/dist | |
Applitools: | |
name: Applitools Storybook Visual Testing | |
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' | |
needs: [Build-Storybook] | |
runs-on: ubuntu-latest | |
services: | |
storybook: | |
image: nginx | |
ports: | |
- 9001:80 | |
volumes: | |
- ${{ github.workspace }}/dist:/usr/share/nginx/html | |
options: >- | |
--name storybook | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- name: Fetch Storybook | |
uses: actions/download-artifact@v2 | |
with: | |
name: storybook-v2 | |
path: ${{ github.workspace }}/dist | |
- name: Restart nginx | |
uses: docker://docker | |
with: | |
args: docker restart storybook | |
- name: Install automation/Applitools | |
run: | | |
cd ${{ github.workspace }}/automation/applitools | |
npm ci | |
- name: Run Applitools Storybook Visual Testing | |
env: | |
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }} | |
APPLITOOLS_BATCH_ID: ${{ github.event.pull_request.head.sha }} | |
run: | | |
cd ${{ github.workspace }}/automation/applitools | |
npx eyes-storybook -u http://localhost:9001 > applitools-logs.txt | |
- name: Archive Logs | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: applitools-logs | |
path: ${{ github.workspace }}/automation/applitools/applitools-logs.txt | |
- name: Clean Folders | |
if: always() | |
run: rm -rf ${{ github.workspace }}/dist | |
Applitools-Complete: | |
name: Applitools complete API call | |
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' && always() | |
needs: [Applitools] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify Applitools Finish | |
run: | | |
curl -X POST \ | |
https://eyesapi.applitools.com/api/externals/github/servers/github.com/commit/${{env.APPLITOOLS_BATCH_ID}}/complete?apiKey=${{env.APPLITOOLS_API_KEY}} \ | |
-H "accept:*/*" \ | |
Github-Deployment: | |
name: Github Deployment | |
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' | |
needs: [Build-Storybook] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Start Documentation Deployment | |
uses: bobheadxi/[email protected] | |
id: deployment | |
with: | |
step: start | |
token: ${{ secrets.GITHUB_TOKEN }} | |
env: ${{env.DOCUMENTATION_PUBLISH_FOLDER}} | |
ref: refs/pull/${{ github.event.number }}/head | |
desc: ${{env.DOCUMENTATION_PUBLISH_MESSAGE}} | |
- name: Checkout Documentation Repository | |
uses: actions/checkout@v2 | |
with: | |
repository: ${{ env.DOCUMENTATION_PUBLISH_REPO }} | |
ref: ${{ env.DOCUMENTATION_PUBLISH_BRANCH }} | |
token: ${{ secrets.ORG_GHPAGES_DEPLOY_KEY }} | |
path: gh-docs | |
fetch-depth: 1 | |
- name: Remove Previous Documentation | |
run: rm -rf ${{ github.workspace }}/gh-docs/${DOCUMENTATION_PUBLISH_FOLDER}/* | |
- name: Fetch Storybook | |
uses: actions/download-artifact@v2 | |
with: | |
name: storybook-v2 | |
path: ${{ github.workspace }}/gh-docs/${{env.DOCUMENTATION_PUBLISH_FOLDER}} | |
- name: Push Documentation | |
run: | | |
cd ${{ github.workspace }}/gh-docs | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add -A ${DOCUMENTATION_PUBLISH_FOLDER} | |
git commit -m "${DOCUMENTATION_PUBLISH_MESSAGE}" | |
git push | |
- name: Cleanup Folder | |
if: always() | |
run: rm -rf ${{ github.workspace }}/gh-docs | |
- name: Update Deployment Status | |
uses: bobheadxi/[email protected] | |
if: always() | |
with: | |
step: finish | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: ${{ job.status }} | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | |
env_url: ${{env.DOCUMENTATION_URL}} | |
A11Y-Tests: | |
name: Accessibility Tests | |
needs: [Build-Storybook] | |
runs-on: ubuntu-latest | |
services: | |
storybook: | |
image: nginx | |
ports: | |
- 9001:80 | |
volumes: | |
- ${{ github.workspace }}/dist:/usr/share/nginx/html | |
options: >- | |
--name storybook | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- name: Fetch Storybook | |
uses: actions/download-artifact@v2 | |
with: | |
name: storybook-v2 | |
path: ${{ github.workspace }}/dist | |
- name: Restart nginx | |
uses: docker://docker | |
with: | |
args: docker restart storybook | |
- name: Install automation/pa11y | |
run: | | |
cd ${{ github.workspace }}/automation/pa11y | |
npm ci | |
- name: Test A11Y | |
run: | | |
cd ${{ github.workspace }}/automation/pa11y | |
STORYBOOK_URL=http://localhost:9001 npm run pa11y-ci | |
- name: Clean Folders | |
if: always() | |
run: rm -rf ${{ github.workspace }}/dist | |
Playwright: | |
name: Playwright test | |
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' | |
needs: [Build-Storybook] | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
services: | |
storybook: | |
image: nginx | |
ports: | |
- 9001:80 | |
volumes: | |
- ${{ github.workspace }}/dist:/usr/share/nginx/html | |
options: >- | |
--name storybook | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- name: Fetch Storybook | |
uses: actions/download-artifact@v2 | |
with: | |
name: storybook-v2 | |
path: ${{ github.workspace }}/dist | |
- name: Restart nginx | |
uses: docker://docker | |
with: | |
args: docker restart storybook | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npm run test:e2e | |
env: | |
PLAYWRIGHT_TEST_BASE_URL: http://storybook | |
- uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
Robot: | |
name: Test Robot | |
needs: [Build-Storybook] | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
container: | |
image: joaoeg/docker-robot-framework:0.1 | |
options: --shm-size=6g -u 1001 | |
env: | |
BROWSER: chrome | |
ROBOT_TESTS_DIR: ./automation/robot/storybook | |
ROBOT_REPORTS_DIR: ./reports | |
ROBOT_THREADS: 4 | |
ROBOT_OPTIONS: "--variable STORYBOOK_URL:http://storybook --variable BROWSER:chrome --exclude bug-chrome --exclude bug-chrome-webdriver --exclude issue --exclude issue-chrome --exclude bug-infrastructure --exclude bug-infrastructure-chrome" | |
services: | |
storybook: | |
image: nginx | |
volumes: | |
- ${{ github.workspace }}/dist:/usr/share/nginx/html | |
options: >- | |
--name storybook | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Fetch Storybook | |
uses: actions/download-artifact@v2 | |
with: | |
name: storybook-v2 | |
path: ${{ github.workspace }}/dist | |
- name: Restart nginx | |
uses: docker://docker | |
with: | |
args: docker restart storybook | |
- name: Run Robot | |
run: ./.github/robot-docker/run-tests-in-virtual-screen-with-rerun.sh | |
- name: Save Reports | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: chrome-reports | |
path: ${{ github.workspace }}/reports | |
- name: Clean Folders | |
if: always() | |
run: | | |
rm -rf ${{ github.workspace }}/dist | |
rm -rf ${{ github.workspace }}/reports | |
Cleanup: | |
name: Cleanup test artifacts | |
if: always() | |
needs: [Github-Deployment, Applitools, A11Y-Tests, Robot] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: geekyeggo/delete-artifact@v1 | |
with: | |
name: | | |
storybook-v2 | |
storybook | |
Notify-End: | |
name: Notify End | |
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' && always() | |
needs: [Static-Checks, Github-Deployment, Applitools, A11Y-Tests, Robot, Playwright] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: technote-space/workflow-conclusion-action@v1 | |
- name: generate conclusion color | |
id: conclusion_color | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
if("${{ env.WORKFLOW_CONCLUSION }}" === "success") core.exportVariable("COLOR", "#63A621") | |
else if("${{ env.WORKFLOW_CONCLUSION }}" === "failure") core.exportVariable("COLOR", "#C62828") | |
else if("${{ env.WORKFLOW_CONCLUSION }}" === "neutral") core.exportVariable("COLOR", "#BCBCBC") | |
else if("${{ env.WORKFLOW_CONCLUSION }}" === "cancelled") core.exportVariable("COLOR", "#FFD00A") | |
else if("${{ env.WORKFLOW_CONCLUSION }}" === "timed_out") core.exportVariable("COLOR", "#FFD00A") | |
- name: Notify | |
uses: hbfernandes/[email protected] | |
env: | |
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} | |
CONCLUSION: ${{ env.WORKFLOW_CONCLUSION }} | |
DOCUMENTATION: ${{ env.DOCUMENTATION_URL }} | |
with: | |
args: | | |
{ | |
"channel": "ui-kit-eng-ci", | |
"attachments": [ | |
{ | |
"mrkdwn_in": ["text"], | |
"color": "${{env.COLOR}}", | |
"title": "${{ github.workflow }} (#${{github.event.number}}) build finished - ${{ env.CONCLUSION }}", | |
"title_link": "${{ env.RUN_URL }}", | |
"text": "${{env.PR_URL}}\n Storybook published: ${{env.DOCUMENTATION}}", | |
"footer": "by ${{github.actor}}", | |
"footer_icon": "https://github.com/${{github.actor}}.png?size=20" | |
} | |
] | |
} |