Skip to content

feat(TextInput): ajout adornment (DS-1140) #3757

feat(TextInput): ajout adornment (DS-1140)

feat(TextInput): ajout adornment (DS-1140) #3757

Workflow file for this run

name: React
on:
pull_request: { }
push:
branches:
- master
tags:
- v*.*.*
- v*.*.*-alpha.*
- v*.*.*-beta.*
env:
WORKING_DIRECTORY: .
jobs:
pre_checks:
name: Pre-checks
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
cancel_others: true
do_not_skip: >-
[
"push",
"schedule",
"workflow_dispatch"
]
paths_ignore: >-
[
"icons-scripts/**",
"packages/kronos-crm-icons/**",
"packages/kronos-fna-icons/**"
]
setup:
name: Setup
runs-on: ubuntu-latest
needs:
- pre_checks
if: ${{ needs.pre_checks.outputs.should_skip != 'true' }}
outputs:
deploy: ${{ steps.versions.outputs.deploy }}
next-version: ${{ steps.versions.outputs.next-version }}
qualifier: ${{ steps.versions.outputs.qualifier }}
is-hotfix: ${{ steps.metadata.outputs.is-hotfix }}
is-pr: ${{ steps.versions.outputs.is-pr }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup asdf-vm
uses: equisoft-actions/with-asdf-vm@v2
- name: Fetch origin/master (for action-metadata commit check)
run: |
git fetch --no-tags --prune --depth=1000 origin +refs/heads/master:refs/remotes/origin/master '+refs/heads/release/*:refs/remotes/origin/release/*'
- name: Find application metadata
id: metadata
uses: equisoft-actions/nodejs-application-metadata@v1
with:
release-branch: master
hotfix-branch-prefix: release/
- name: Install NPM dependencies
uses: equisoft-actions/yarn-install@v1
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Find version details
id: versions
run: |
QUALIFIER=dev
NEXT_VERSION=0.0.0
DEPLOY=false
IS_PR=false
if [[ $GITHUB_REF == refs/tags/v*.*.* ]]; then
NEXT_VERSION=${GITHUB_REF#refs/tags/v}
DEPLOY=true
if [[ $NEXT_VERSION == *-*.* ]]; then
QUALIFIER=$(echo "${NEXT_VERSION}" | sed -n 's/.*-\(.*\)\..*/\1/p')
else
QUALIFIER=latest
fi
elif [[ $GITHUB_REF == refs/heads/* ]]; then
BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}" | sed -r 's#/+#-#g')
if [ "master" = "${BRANCH_NAME}" ]; then
QUALIFIER=snapshot
DEPLOY=true
else
QUALIFIER="branch-${BRANCH_NAME}"
fi
latest=$(curl -sS https://registry.npmjs.org/@equisoft/design-elements-react | jq -r '."dist-tags".latest')
NEXT_VERSION="$(npx semver -i "${latest}")-${QUALIFIER}.$(date -u "+%Y%m%d%H%M%S")"
elif [[ $GITHUB_REF == refs/pull/* ]]; then
IS_PR=true
QUALIFIER=pr-${{ github.event.pull_request.number }}
fi
echo "next-version=${NEXT_VERSION}" >> $GITHUB_OUTPUT
echo "qualifier=${QUALIFIER}" >> $GITHUB_OUTPUT
echo "deploy=${DEPLOY}" >> $GITHUB_OUTPUT
echo "is-pr=${IS_PR}" >> $GITHUB_OUTPUT
react_eslint:
name: 'React: ESLint'
runs-on: ubuntu-latest
needs:
- setup
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup asdf-vm
uses: equisoft-actions/with-asdf-vm@v2
- name: Install NPM dependencies
uses: equisoft-actions/yarn-install@v1
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Run ESLint
uses: equisoft-actions/yarn-eslint@v2
with:
report-name: react-eslint.sarif
working-directory: packages/react
react_stylelint:
name: 'React: Stylelint'
runs-on: ubuntu-latest
needs:
- setup
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup asdf-vm
uses: equisoft-actions/with-asdf-vm@v2
- name: Install NPM dependencies
uses: equisoft-actions/yarn-install@v1
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Run Stylelint
uses: equisoft-actions/yarn-stylelint@v1
with:
report-name: react-stylelint.sarif
working-directory: packages/react
- name: Create annotations
if: "!cancelled()"
uses: equisoft-actions/sarif-annotator@v1
with:
level: warning
sarif-path: packages/react/build/stylelint/report.sarif
title: Stylelint results
react_unit_tests:
name: "React: Unit tests"
runs-on: ubuntu-latest
needs:
- setup
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup asdf-vm
uses: equisoft-actions/with-asdf-vm@v2
- name: Install NPM dependencies
uses: equisoft-actions/yarn-install@v1
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
# Tests
- name: Unit tests
uses: equisoft-actions/yarn-jest@v1
with:
working-directory: ./packages/react
- name: Upload test coverage results
uses: actions/upload-artifact@v4
if: ${{ success() || failure() }}
with:
name: react-test-coverage.clover.xml
path: packages/react/build/jest/coverage/clover.xml
if-no-files-found: error
react_compile:
name: "React: Compile"
runs-on: ubuntu-latest
needs:
- setup
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup asdf-vm
uses: equisoft-actions/with-asdf-vm@v2
- name: Install NPM dependencies
uses: equisoft-actions/yarn-install@v1
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
# Compile
- name: Update package version
env:
VERSION: ${{ needs.setup.outputs.next-version }}
run: |
contents="$(jq ".version = \"${VERSION}\"" ./packages/react/package.json)" && echo "${contents}" > ./packages/react/package.json
- name: Compile
working-directory: ./packages/react
run: yarn build
- name: Store react package
uses: actions/upload-artifact@v4
with:
name: react_dist
path: packages/react/dist/
retention-days: 1
if-no-files-found: error
react_deploy:
name: "React: Deploy"
runs-on: ubuntu-latest
environment: npm-deployment
needs:
- setup
- react_eslint
- react_stylelint
- react_unit_tests
- react_compile
if: ${{ needs.setup.outputs.deploy == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download
uses: actions/download-artifact@v4
with:
name: react_dist
path: packages/react/dist/
- name: Update package version
env:
VERSION: ${{ needs.setup.outputs.next-version }}
run: |
contents="$(jq ".version = \"${VERSION}\"" ./packages/react/package.json)" && echo "${contents}" > ./packages/react/package.json
- name: Publish to npmjs
working-directory: ./packages/react
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TAG: ${{ needs.setup.outputs.qualifier }}
run: |
echo -e "npmRegistries: \n //registry.yarnpkg.com:\n npmAlwaysAuth: true\n npmAuthToken: ${NPM_TOKEN}" >> ~/.yarnrc.yml
yarn npm publish --tag "${NPM_TAG}" --tolerate-republish
storybook_eslint:
name: "Storybook: ESLint"
runs-on: ubuntu-latest
needs:
- setup
- react_compile
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download React Dist
uses: actions/download-artifact@v4
with:
name: react_dist
path: packages/react/dist/
- name: Setup asdf-vm
uses: equisoft-actions/with-asdf-vm@v2
- name: Install NPM dependencies
uses: equisoft-actions/yarn-install@v1
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Run ESLint
uses: equisoft-actions/yarn-eslint@v2
with:
report-name: storybook-eslint.sarif
working-directory: packages/storybook
storybook_stylelint:
name: "Storybook: Stylelint"
runs-on: ubuntu-latest
needs:
- setup
- react_compile
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download React Dist
uses: actions/download-artifact@v4
with:
name: react_dist
path: packages/react/dist/
- name: Setup asdf-vm
uses: equisoft-actions/with-asdf-vm@v2
- name: Install NPM dependencies
uses: equisoft-actions/yarn-install@v1
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Run Stylelint
uses: equisoft-actions/yarn-stylelint@v1
with:
report-name: storybook-stylelint.sarif
working-directory: packages/storybook
- name: Create annotations
if: "!cancelled()"
uses: equisoft-actions/sarif-annotator@v1
with:
level: warning
sarif-path: packages/storybook/build/stylelint/report.sarif
title: Stylelint results
storybook_compile:
name: "Storybook: Compile"
runs-on: ubuntu-latest
needs:
- setup
- react_compile
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download React Dist
uses: actions/download-artifact@v4
with:
name: react_dist
path: packages/react/dist/
- name: Setup asdf-vm
uses: equisoft-actions/with-asdf-vm@v2
- name: Install NPM dependencies
uses: equisoft-actions/yarn-install@v1
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
# Compile
- name: Update package version
env:
VERSION: ${{ needs.setup.outputs.next-version }}
run: |
contents="$(jq ".version = \"${VERSION}\"" ./packages/react/package.json)" && echo "${contents}" > ./packages/react/package.json
contents="$(jq ".version = \"${VERSION}\"" ./packages/storybook/package.json)" && echo "${contents}" > ./packages/storybook/package.json
- name: Compile
working-directory: ./packages/storybook
run: yarn build
- name: Store storybook package
uses: actions/upload-artifact@v4
with:
name: storybook_dist
path: packages/storybook/dist/
retention-days: 1
if-no-files-found: error
storybook_deploy:
name: "Storybook: Deploy"
runs-on: ubuntu-latest
environment: github-pages
needs:
- setup
- react_deploy
- storybook_eslint
- storybook_stylelint
- storybook_compile
if: |
always() &&
!failure() &&
!cancelled() &&
(needs.setup.outputs.deploy == 'true' || needs.setup.outputs.is-pr == 'true') &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download
uses: actions/download-artifact@v4
with:
name: storybook_dist
path: packages/storybook/dist/
- name: Update package version
env:
VERSION: ${{ needs.setup.outputs.next-version }}
run: |
contents="$(jq ".version = \"${VERSION}\"" ./packages/react/package.json)" && echo "${contents}" > ./packages/react/package.json
contents="$(jq ".version = \"${VERSION}\"" ./packages/storybook/package.json)" && echo "${contents}" > ./packages/storybook/package.json
- name: Resolve documentation target
id: target
env:
QUALIFIER: ${{ needs.setup.outputs.qualifier }}
VERSION: ${{ needs.setup.outputs.next-version }}
run: |
if [ "${QUALIFIER}" == "snapshot" ]; then
echo "folder=${QUALIFIER}" >> $GITHUB_OUTPUT
echo "commit=docs(storybook): update snapshot to ${GITHUB_SHA}" >> $GITHUB_OUTPUT
elif [[ "${QUALIFIER}" = pr-* ]]; then
echo "folder=${QUALIFIER}" >> $GITHUB_OUTPUT
echo "commit=docs(storybook): update pull request ${QUALIFIER} to ${GITHUB_SHA}" >> $GITHUB_OUTPUT
else
echo "folder=${VERSION}" >> $GITHUB_OUTPUT
echo "commit=docs(storybook): add v${VERSION}" >> $GITHUB_OUTPUT
fi
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
commit-message: ${{ steps.target.outputs.commit }}
folder: packages/storybook/dist/
git-config-email: na-qc@equisoft.com
git-config-name: kronostechnologies-build
target-folder: ${{ steps.target.outputs.folder }}
token: ${{ secrets.GH_REPO_TOKEN }}
- name: Update latest
if: ${{ needs.setup.outputs.qualifier == 'latest' && needs.setup.outputs.is-hotfix != 'true' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
commit-message: "docs: update latest doc to ${{ needs.setup.outputs.next-version }}"
folder: packages/storybook/dist/
git-config-email: na-qc@equisoft.com
git-config-name: kronostechnologies-build
target-folder: latest
token: ${{ secrets.GH_REPO_TOKEN }}
- name: Generate summary
id: summary
continue-on-error: true
run: |
url="https://ds.equisoft.io/${{ steps.target.outputs.folder }}/"
body="Storybook for this build: <${url}>"
echo "body=${body}" >> $GITHUB_OUTPUT
echo "${body}" >> $GITHUB_STEP_SUMMARY
- name: Comment the summary on the PR
if: ${{ needs.setup.outputs.is-pr == 'true' }}
continue-on-error: true
uses: actions/github-script@v7
with:
script: |
const pr = {
issue_number: '${{ github.event.pull_request.number }}',
owner: 'kronostechnologies',
repo: 'design-elements',
};
github.rest.issues.listComments(pr).then(comments => {
const commentBody = '${{ steps.summary.outputs.body }}';
const comment = comments.data.find(comment => comment.body.includes(commentBody));
if (!comment) {
github.rest.issues.createComment({
...pr,
body: commentBody
});
}
});
webapp_eslint:
name: 'Webapp: ESLint'
runs-on: ubuntu-latest
needs:
- setup
- react_compile
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup asdf-vm
uses: equisoft-actions/with-asdf-vm@v2
- name: Install NPM dependencies
uses: equisoft-actions/yarn-install@v1
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Download React Dist
uses: actions/download-artifact@v4
with:
name: react_dist
path: packages/react/dist/
- name: Run ESLint
uses: equisoft-actions/yarn-eslint@v2
with:
report-name: webapp-eslint.sarif
working-directory: packages/webapp
webapp_stylelint:
name: 'Webapp: Stylelint'
runs-on: ubuntu-latest
needs:
- setup
- react_compile
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup asdf-vm
uses: equisoft-actions/with-asdf-vm@v2
- name: Install NPM dependencies
uses: equisoft-actions/yarn-install@v1
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Download React Dist
uses: actions/download-artifact@v4
with:
name: react_dist
path: packages/react/dist/
- name: Run Stylelint
uses: equisoft-actions/yarn-stylelint@v1
with:
report-name: webapp-stylelint.sarif
working-directory: packages/webapp
- name: Create annotations
if: "!cancelled()"
uses: equisoft-actions/sarif-annotator@v1
with:
level: warning
sarif-path: packages/webapp/build/stylelint/report.sarif
title: Stylelint results
webapp_deploy:
name: "Webapp: Deploy"
runs-on: ubuntu-latest
environment: github-pages
needs:
- setup
- webapp_eslint
- webapp_stylelint
- storybook_deploy
if: |
always() &&
!failure() &&
!cancelled() &&
(needs.setup.outputs.deploy == 'true' || needs.setup.outputs.is-pr == 'true') &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download React Dist
uses: actions/download-artifact@v4
with:
name: react_dist
path: packages/react/dist/
- name: Setup asdf-vm
uses: equisoft-actions/with-asdf-vm@v2
- name: Install NPM dependencies
uses: equisoft-actions/yarn-install@v1
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Update package version
env:
VERSION: ${{ needs.setup.outputs.next-version }}
run: |
contents="$(jq ".version = \"${VERSION}\"" ./packages/react/package.json)" && echo "${contents}" > ./packages/react/package.json
contents="$(jq ".version = \"${VERSION}\"" ./packages/storybook/package.json)" && echo "${contents}" > ./packages/storybook/package.json
contents="$(jq ".version = \"${VERSION}\"" ./packages/webapp/package.json)" && echo "${contents}" > ./packages/webapp/package.json
- name: Resolve target
id: target
env:
QUALIFIER: ${{ needs.setup.outputs.qualifier }}
VERSION: ${{ needs.setup.outputs.next-version }}
run: |
if [ "${QUALIFIER}" == "snapshot" ]; then
echo "folder=${QUALIFIER}" >> $GITHUB_OUTPUT
echo "commit=docs(webapp): update snapshot to ${GITHUB_SHA}" >> $GITHUB_OUTPUT
elif [[ "${QUALIFIER}" = pr-* ]]; then
echo "folder=${QUALIFIER}" >> $GITHUB_OUTPUT
echo "commit=docs(webapp): update pull request ${QUALIFIER} to ${GITHUB_SHA}" >> $GITHUB_OUTPUT
else
echo "folder=${VERSION}" >> $GITHUB_OUTPUT
echo "commit=docs(webapp): add v${VERSION}" >> $GITHUB_OUTPUT
fi
- name: Compile
env:
APP_CONFIG_VERSION: ${{ needs.setup.outputs.next-version }}
APP_CONFIG_PUBLIC_PATH: /${{ steps.target.outputs.folder }}/webapp/
shell: bash
working-directory: ./packages/webapp
run: |
yarn build:production
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
commit-message: ${{ steps.target.outputs.commit }}
folder: packages/webapp/dist/
git-config-email: na-qc@equisoft.com
git-config-name: kronostechnologies-build
target-folder: ${{ steps.target.outputs.folder }}/webapp
token: ${{ secrets.GH_REPO_TOKEN }}
- name: Update latest
if: ${{ needs.setup.outputs.qualifier == 'latest' && needs.setup.outputs.is-hotfix != 'true' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
commit-message: "docs(webapp): update latest doc to ${{ needs.setup.outputs.next-version }}"
folder: packages/webapp/dist/
git-config-email: na-qc@equisoft.com
git-config-name: kronostechnologies-build
target-folder: latest/webapp
token: ${{ secrets.GH_REPO_TOKEN }}
- name: Generate summary
id: summary
continue-on-error: true
run: |
url="https://ds.equisoft.io/${{ steps.target.outputs.folder }}/webapp/"
body="Webapp for this build: <${url}>"
echo "body=${body}" >> $GITHUB_OUTPUT
echo "${body}" >> $GITHUB_STEP_SUMMARY
- name: Comment the summary on the PR
if: ${{ needs.setup.outputs.is-pr == 'true' }}
continue-on-error: true
uses: actions/github-script@v7
with:
script: |
const pr = {
issue_number: '${{ github.event.pull_request.number }}',
owner: 'kronostechnologies',
repo: 'design-elements',
};
github.rest.issues.listComments(pr).then(comments => {
const commentBody = '${{ steps.summary.outputs.body }}';
const comment = comments.data.find(comment => comment.body.includes(commentBody));
if (!comment) {
github.rest.issues.createComment({
...pr,
body: commentBody
});
}
});
notify:
name: Notify
runs-on: ubuntu-latest
needs:
- setup
- react_eslint
- react_stylelint
- react_unit_tests
- react_compile
- storybook_eslint
- storybook_stylelint
- storybook_compile
- storybook_deploy
- webapp_deploy
if: always() && needs.setup.outputs.deploy == 'true'
steps:
- name: Post workflow status
uses: equisoft-actions/notify-workflow-status@v2
with:
needs: ${{ toJSON(needs) }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ github.event.repository.custom_properties.ci_slack_channel }}