Skip to content

fix: move job to steps due to mq issue #1

fix: move job to steps due to mq issue

fix: move job to steps due to mq issue #1

name: Verify Library
on:
workflow_call:
inputs:
NODE_VERSION:
default: '18.x'
required: false
type: string
TIMEOUT:
default: 15
required: false
type: number
ENABLE_BUILDING:
default: true
required: false
type: boolean
ENABLE_TESTING:
default: true
required: false
type: boolean
ENABLE_COVERAGE:
default: true
required: false
type: boolean
ENABLE_TYPES_CHECK:
default: false
required: false
type: boolean
ENABLE_FORMAT_CHECK:
default: false
required: false
type: boolean
ENABLE_SIZE_LIMIT_CHECK:
default: false
required: false
type: boolean
ENABLE_VISUAL_TESTING:
default: false
required: false
type: boolean
ENABLE_PLAYWRIGHT:
default: false
required: false
type: boolean
IS_MONOREPO:
default: false
required: false
type: boolean
ENABLE_SLACK_NOTIFICATION:
default: true
required: false
type: boolean
SLACK_NOTIFICATION_SECRET:
default: 'SLACK_WEBHOOK_PLATFORM_PROD'
required: false
type: string
PACKAGE_MANAGER:
default: yarn-berry
required: false
type: string
description: 'Deprecated - Will be removed in a future version'
secrets:
NPM_READ_TOKEN:
required: true
# Note: Due to some github actions limitations all the slack webhook secrets that could be used by the libraries need to be added here with required: false
SLACK_WEBHOOK_CORE_NON_PROD:
required: false
SLACK_WEBHOOK_PLATFORM_PROD:
required: false
SLACK_WEBHOOK_PLATFORM_SERVICES_NONPROD:
required: false
SLACK_WEBHOOK_UI_WG:
required: false
# Secret needed when ENABLE_VISUAL_TESTING = true:
# - CI_SERVICE_ACCOUNT
# - PERCY_TOKEN
CI_SERVICE_ACCOUNT:
required: false
PERCY_TOKEN:
required: false
env:
NODE_VERSION: ${{ inputs.NODE_VERSION }}
jobs:
verify:
name: verify
runs-on: ubuntu-latest
timeout-minutes: ${{ inputs.TIMEOUT }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Configure NPM auth token
run: |
yarn config set npmAuthToken ${{ secrets.NPM_READ_TOKEN }}
- name: Configure Package Manager
run: |
echo Configuring NPM_TOKEN globally for .npmrc
npm config set '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_READ_TOKEN }}
npm whoami
- name: Install dependencies with Yarn-Berry
run: yarn install --immutable
- name: Verify lint
run: yarn lint
- name: Check types
if: inputs.ENABLE_TYPES_CHECK
## TODO: Ensure all libraries with types check enabled implement types command according to their needs
run: yarn types:check
- name: Check formatting
if: inputs.ENABLE_FORMAT_CHECK
## TODO: Ensure all libraries with format check enabled implement format:check command according to their needs
run: yarn format:check
- name: Test
if: inputs.ENABLE_TESTING && inputs.ENABLE_COVERAGE == false
run: yarn test
- name: Test
if: inputs.ENABLE_TESTING && inputs.ENABLE_COVERAGE
run: yarn test:cov
- name: Upload coverage to Coveralls
if: inputs.ENABLE_TESTING && inputs.ENABLE_COVERAGE
uses: coverallsapp/github-action@v2.2.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build app
if: inputs.ENABLE_BUILDING
run: yarn build
# TODO: Check with team if pantry is ready to switch to andresz1/size-limit-action
#
# TODO: [PLAT-2557] Skipped until size limit settings are in main (since it runs main size check for diff comment)
# - name: Check build size
# if: inputs.ENABLE_SIZE_LIMIT_CHECK
# uses: andresz1/size-limit-action@v1.7.0
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# skip_step: install
# script: yarn size --json
#
# TODO: [PLAT-2557] Replace with andresz1/size-limit-action once size-limit settings are in main (needed for diff)
- name: Size Check
if: inputs.ENABLE_SIZE_LIMIT_CHECK
run: yarn size:check
- name: Auth Cloud SDK
if: inputs.ENABLE_VISUAL_TESTING || inputs.ENABLE_PLAYWRIGHT
uses: google-github-actions/auth@v1
with:
project_id: 'reside-stage'
credentials_json: '${{ secrets.CI_SERVICE_ACCOUNT }}'
- name: Set up Cloud SDK
if: inputs.ENABLE_VISUAL_TESTING || inputs.ENABLE_PLAYWRIGHT
uses: google-github-actions/setup-gcloud@v1
- name: Run Playwright integration tests and upload preview
if: inputs.ENABLE_PLAYWRIGHT
uses: reside-eng/workflow-templates-library/.github/actions/playwright@v1
id: playwright
with:
service-account: ${{ secrets.CI_SERVICE_ACCOUNT }}
- name: Run Storybook and upload preview
if: inputs.ENABLE_VISUAL_TESTING
uses: reside-eng/workflow-templates-library/.github/actions/storybook@v1
id: storybook
with:
percy-token: ${{ secrets.PERCY_TOKEN }}
- name: Comment preview links
if: inputs.ENABLE_VISUAL_TESTING || inputs.ENABLE_PLAYWRIGHT
uses: reside-eng/workflow-templates-library/.github/actions/previews-comment@v1
with:
storybook-preview-url: ${{ steps.storybook.outputs.preview-url }}
playwright-preview-url: ${{ steps.playwright.outputs.preview-url }}
- name: Get workflow conclusion
if: inputs.ENABLE_SLACK_NOTIFICATION
- uses: technote-space/workflow-conclusion-action@v3.0.3
- name: Send Slack notification
if: inputs.ENABLE_SLACK_NOTIFICATION
- uses: reside-eng/workflow-status-notification-action@v1.2.3
with:
current-status: ${{ env.WORKFLOW_CONCLUSION }}
slack-webhook: ${{ secrets[ inputs.SLACK_NOTIFICATION_SECRET ] }}
github-token: ${{ secrets.GITHUB_TOKEN }}