Add initial docs for the analysis-report package #11680
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: TestJS | |
on: | |
# Run on relevant pushes to select branches and on all relevant pull requests. | |
push: | |
branches: | |
- main | |
- trunk | |
- 'release/**' | |
- 'hotfix/[0-9]+.[0-9]+*' | |
- 'feature/**' | |
paths: | |
- '**.js' # Includes Gruntfile.js. | |
- '.browserslistrc' | |
- '.eslintignore' | |
- '.eslintrc' | |
- '.nvmrc' | |
- '.yarnrc' | |
- 'lerna.json' | |
- 'package.json' | |
- 'yarn.lock' | |
- '.github/workflows/jstest.yml' | |
- '.yarn/**' | |
- 'apps/**' | |
- 'config/grunt/**' | |
- 'packages/**' | |
pull_request: | |
paths: | |
- '**.js' # Includes Gruntfile.js. | |
- '.browserslistrc' | |
- '.eslintignore' | |
- '.eslintrc' | |
- '.nvmrc' | |
- '.yarnrc' | |
- 'lerna.json' | |
- 'package.json' | |
- 'yarn.lock' | |
- '.github/workflows/jstest.yml' | |
- '.yarn/**' | |
- 'apps/**' | |
- 'config/grunt/**' | |
- 'packages/**' | |
# Allow manually triggering the workflow. | |
workflow_dispatch: | |
# Cancels all previous workflow runs for the same branch that have not yet completed. | |
concurrency: | |
# The concurrency group contains the workflow name and the branch name. | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
######################################################################################### | |
# For packages in this job, the full test suite is always run. | |
######################################################################################### | |
yarn-test-full: | |
runs-on: ubuntu-latest | |
strategy: | |
# As these packages are all unique, don't stop the workflow when the test run of one package fails. | |
fail-fast: false | |
matrix: | |
package: | |
- 'analysis-report' | |
- 'browserslist-config' | |
- 'components' | |
- 'feature-flag' | |
- 'helpers' | |
- 'js' | |
- 'replacement-variable-editor' | |
- 'search-metadata-previews' | |
- 'social-metadata-forms' | |
- 'social-metadata-previews' | |
name: "TestJS - ${{ matrix.package }} (full)" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# The ubuntu images come with Node, npm and yarn pre-installed. | |
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md | |
# This action also handles the caching of the Yarn dependencies. | |
# https://github.com/actions/setup-node | |
- name: Set up node and enable caching of dependencies | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: './.nvmrc' | |
cache: 'yarn' | |
- name: Yarn install | |
run: yarn install | |
- name: Show debug info | |
run: | | |
npm --version | |
node --version | |
yarn --version | |
grunt --version | |
yarn run jest --version | |
- name: Build all packages | |
run: yarn run build --ignore "@yoast/wordpress-seo" | |
- name: Show Jest version | |
run: yarn run jest --version | |
working-directory: packages/${{ matrix.package }} | |
- name: Show Config | |
run: yarn test --showConfig | |
working-directory: packages/${{ matrix.package }} | |
- name: Run Javascript tests | |
run: yarn test --ci --coverage | |
working-directory: packages/${{ matrix.package }} | |
- name: Upload coverage results to Coveralls | |
uses: coverallsapp/github-action@v2 | |
env: | |
COVERALLS_SERVICE_NUMBER: ${{ github.sha }} # Connect all builds together. | |
with: | |
flag-name: package-${{ matrix.package }} | |
parallel: true | |
######################################################################################### | |
# For packages in this job, PRs will only run the tests related to changed files | |
# to make the build faster. | |
# For merges and pushes to select branches, the full test suite is still run. | |
# Packages should (only) be moved to this job if the full test run is exceedingly slow. | |
######################################################################################### | |
yarn-test-onlyChanged: | |
runs-on: ubuntu-latest | |
strategy: | |
# As these packages are all unique, don't stop the workflow when the test run of one package fails. | |
fail-fast: false | |
matrix: | |
include: | |
- package: 'yoastseo' | |
needs_premium_config: true | |
name: "TestJS - ${{ matrix.package }}${{ github.event_name == 'pull_request' && ' (onlyChanged)' || ' (full)' }}" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Checks for changes | |
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # dorny/[email protected] | |
id: changes | |
with: | |
filters: | | |
src: | |
- 'packages/${{ matrix.package }}/**' | |
# For pull requests, only run the full tests when touching this package. | |
- name: Checks if tests should be run | |
id: checks-run | |
run: | | |
echo "should=${{ github.event_name != 'pull_request' || steps.changes.outputs.src == 'true' }}" >> "$GITHUB_OUTPUT" | |
# Check out the premium config repo ahead of running the tests to prevent issues with permissions. | |
- name: Checkout premium configuration | |
if: ${{ steps.checks-run.outputs.should == 'true' && matrix.needs_premium_config == true }} | |
uses: actions/checkout@v4 | |
with: | |
repository: Yoast/YoastSEO.js-premium-configuration | |
path: packages/yoastseo/premium-configuration | |
fetch-depth: 0 | |
token: ${{ secrets.YOASTBOT_CI_PAT_DIST }} | |
# The ubuntu images come with Node, npm and yarn pre-installed. | |
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md | |
# This action also handles the caching of the Yarn dependencies. | |
# https://github.com/actions/setup-node | |
- name: Set up node and enable caching of dependencies | |
if: ${{ steps.checks-run.outputs.should == 'true' }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: './.nvmrc' | |
cache: 'yarn' | |
- name: Yarn install | |
if: ${{ steps.checks-run.outputs.should == 'true' }} | |
run: yarn install | |
- name: Show debug info | |
if: ${{ steps.checks-run.outputs.should == 'true' }} | |
run: | | |
npm --version | |
node --version | |
yarn --version | |
grunt --version | |
yarn run jest --version | |
- name: Build all packages | |
if: ${{ steps.checks-run.outputs.should == 'true' }} | |
run: yarn run build --ignore "@yoast/wordpress-seo" | |
- name: Show Jest version | |
if: ${{ steps.checks-run.outputs.should == 'true' }} | |
run: yarn run jest --version | |
working-directory: packages/${{ matrix.package }} | |
- name: Show Config | |
if: ${{ steps.checks-run.outputs.should == 'true' }} | |
run: yarn test --showConfig | |
working-directory: packages/${{ matrix.package }} | |
- name: Run Javascript tests | |
if: ${{ steps.checks-run.outputs.should == 'true' }} | |
run: yarn test --ci --coverage | |
working-directory: packages/${{ matrix.package }} | |
- name: Upload coverage results to Coveralls | |
if: ${{ steps.checks-run.outputs.should == 'true' }} | |
uses: coverallsapp/github-action@v2 | |
env: | |
COVERALLS_SERVICE_NUMBER: ${{ github.sha }} # Connect all builds together. | |
with: | |
flag-name: package-${{ matrix.package }} | |
parallel: true |