Skip to content

chore(deps): update all non-major dependencies with stable version (patch) #340

chore(deps): update all non-major dependencies with stable version (patch)

chore(deps): update all non-major dependencies with stable version (patch) #340

Workflow file for this run

name: Tests
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
branches:
- main
- alpha
- beta
# Allow calling manually from GitHub
workflow_dispatch:
# Allow workflow to be called by another workflow
workflow_call:
# Must define secrets here so that the calling workflow can pass in the NPM_TOKEN needed to install private packages.
secrets:
# Normally, this should not be passed as Percy should only run on PR
PERCY_TOKEN:
description: 'The PERCY_TOKEN passed from the caller workflow as it is not available within workflow_call.'
required: true
PREVENT_PERCY_TESTS:
description: 'Pass false to prevent the Percy visual regression tests from running.'
required: true
jobs:
test:
name: Run Component Tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Remove preview consumption comment
if: github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr_preview_consumption
delete: true
GITHUB_TOKEN: ${{ secrets.KONGPONENTS_BOT_PAT }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Stylelint
run: yarn stylelint
- name: Lint
run: yarn lint
- name: Build components and docs
run: yarn build:ci
- name: Publish Package Preview
id: package-preview
if: github.event_name == 'pull_request' && (github.actor != 'renovate[bot]' || contains(github.event.pull_request.labels.*.name, 'create preview package'))
run: |
git config user.email "konnectx-engineers+kongponents-bot@konghq.com"
git config user.name "Kong UI Bot"
preid="pr.${{ github.event.pull_request.number }}.$(git rev-parse --short ${{ github.event.pull_request.head.sha }})"
tag="pr-${{ github.event.pull_request.number }}"
echo "preid=${preid}"
git checkout ${{ github.head_ref }}
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN_PUBLIC_PUBLISH }}" > .npmrc
yarn version --prerelease --preid ${preid} --allow-branch ${{ github.head_ref }} --no-git-tag-version --yes --amend
package_version=$(jq -r ".version" package.json)
package=@kong/kongponents@"${package_version}"
npm show "${package}" >/dev/null 2>&1 && npm_show_status=0 || npm_show_status=1
if [ $npm_show_status -eq 0 ]; then
echo "Package ${package} is already published. Skipping publishing."
exit 0
fi
npm_instructions=""
pkg=$(npm publish --no-git-checks --access public --report-summary --tag "${tag}" | grep "+ "| sed 's/+ //')
if [[ -z "${pkg}" ]]; then
echo "Error publishing package"
exit -1
fi
npm_instructions="yarn add @$(echo ${pkg}|cut -d'@' -f2)@${tag}"
echo "npm_instructions<<EOF" >> $GITHUB_OUTPUT
echo -e "$npm_instructions" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Provide preview link info
if: ${{ steps.package-preview.outputs.npm_instructions != '' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr_preview_consumption
message: |
## ***Preview*** package from this PR in consuming application
In consuming application project install preview version of kongponents generated by this PR:
```
${{ steps.package-preview.outputs.npm_instructions }}
```
GITHUB_TOKEN: ${{ secrets.KONGPONENTS_BOT_PAT }}
- name: Run Cypress component tests
uses: cypress-io/github-action@v6
with:
install: false
command: yarn test
- name: Upload Cypress screenshots (on failure)
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
- name: Upload Cypress videos (always)
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-videos
path: cypress/videos
# This step will be skipped if being ran from the publish action with PREVENT_PERCY_TESTS: 'true'
- name: Trigger Percy visual regression test for docs
timeout-minutes: 5
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PREVENT_PERCY_TESTS: ${{ secrets.PREVENT_PERCY_TESTS }}
# TODO: Change branch as branch name changes
PERCY_TARGET_BRANCH: alpha
if: "${{ env.PREVENT_PERCY_TESTS != 'true' }}"
run: |
npx @percy/cli snapshot docs/.vitepress/dist/ --exclude "**/404.html"