Skip to content

Commit

Permalink
Fix stylelint-config-recommended-less failures due to pnpm workspace (
Browse files Browse the repository at this point in the history
#37)

* Fix `stylelint-config-recommended-less` failures due to pnpm workspace

* use overrides

* fix

* add feedback

* add feedback

* wip

* wip

* wip

* wip

* wip

* restore other tests

* readme

* fix

* Update data/ecosystem.yml

Co-authored-by: Masafumi Koba <[email protected]>

* update-workflows

---------

Co-authored-by: Masafumi Koba <[email protected]>
  • Loading branch information
romainmenke and ybiquitous authored Sep 8, 2024
1 parent 16f0239 commit 3c2b864
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
with:
package: '@shopify/stylelint-plugin'
stylelint-version: stylelint@latest
install-command: yarn
list-installed-versions-command: yarn list --pattern stylelint
test-command: NODE_OPTIONS="--experimental-vm-modules --no-warnings" npx jest
--runInBand
install-command: yarn
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
with:
package: '@shopify/stylelint-plugin'
stylelint-version: stylelint/stylelint
install-command: yarn
list-installed-versions-command: yarn list --pattern stylelint
test-command: NODE_OPTIONS="--experimental-vm-modules --no-warnings" npx jest
--runInBand
install-command: yarn

This file was deleted.

This file was deleted.

6 changes: 6 additions & 0 deletions .github/workflows/test-package-stylelint-less-d99.latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ jobs:
with:
package: stylelint-less
stylelint-version: stylelint@latest
set-overrides-command: npm pkg set pnpm.overrides.stylelint
stylelint-version-override: latest
install-command: pnpm install --no-frozen-lockfile
list-installed-versions-command: pnpm list --long --json stylelint
build-command: pnpm -r build
test-command: pnpm -r test
6 changes: 6 additions & 0 deletions .github/workflows/test-package-stylelint-less-d99.next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ jobs:
with:
package: stylelint-less
stylelint-version: stylelint/stylelint
set-overrides-command: npm pkg set pnpm.overrides.stylelint
stylelint-version-override: github:stylelint/stylelint
install-command: pnpm install --no-frozen-lockfile
list-installed-versions-command: pnpm list --long --json stylelint
build-command: pnpm -r build
test-command: pnpm -r test
52 changes: 44 additions & 8 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,28 @@ on:
type: string
description: The Stylelint version to test
required: true
test-command:
stylelint-version-override:
type: string
description: The test command to run
default: 'npm test'
description: The Stylelint version override
set-overrides-command:
type: string
description: The command to set dependency overrides
install-command:
type: string
description: The install command to run
default: 'npm install --no-audit'
list-installed-versions-command:
type: string
description: The list dependencies command to run
default: 'npm list stylelint'
build-command:
type: string
description: The build command to run
default: 'npm run build --if-present'
test-command:
type: string
description: The test command to run
default: 'npm test'

jobs:
test:
Expand Down Expand Up @@ -67,8 +81,20 @@ jobs:
npm install --global yarn
echo "yarn: $(yarn --version)"
- name: Set dependency overrides
env:
SET_OVERRIDES_COMMAND: ${{ inputs.set-overrides-command }}
STYLELINT_VERSION_OVERRIDE: ${{ inputs.stylelint-version-override }}
if: ${{ inputs.set-overrides-command }}
run: |
if ! eval "$SET_OVERRIDES_COMMAND=$STYLELINT_VERSION_OVERRIDE"; then
echo "::error ::Setting dependency overrides failed."
exit 1
fi
npm pkg get;
- name: Install dependencies
id: install-dependencies
working-directory: ${{ steps.repo-info.outputs.directory }}
env:
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
Expand All @@ -80,8 +106,8 @@ jobs:
fi
- name: Install Stylelint ${{ inputs.stylelint-version }}
id: install-stylelint
working-directory: ${{ steps.repo-info.outputs.directory }}
if: ${{ ! inputs.set-overrides-command }}
env:
STYLELINT_VERSION: ${{ inputs.stylelint-version }}
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
Expand All @@ -91,19 +117,29 @@ jobs:
exit 1
fi
- name: List installed Stylelint versions
working-directory: ${{ steps.repo-info.outputs.directory }}
env:
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
LIST_INSTALLED_VERSIONS_COMMAND: ${{ inputs.list-installed-versions-command }}
run: |
if ! eval "$LIST_INSTALLED_VERSIONS_COMMAND"; then
echo "::error ::Listing dependencies failed."
# `npm list` has a non-zero exit code when overriding dependencies
fi
- name: Run build
id: build
working-directory: ${{ steps.repo-info.outputs.directory }}
env:
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
BUILD_COMMAND: ${{ inputs.build-command }}
run: |
if ! npm run build --if-present; then
if ! eval "$BUILD_COMMAND"; then
echo "::error ::The build failed. Visit ${PACKAGE_URL}"
exit 1
fi
- name: Run test
id: test
working-directory: ${{ steps.repo-info.outputs.directory }}
env:
PACKAGE_URL: ${{ steps.repo-info.outputs.url }}
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ To see test results, click the status badge for the relevant package in the list
| [![stylelint-config-rational-order](https://img.shields.io/npm/v/stylelint-config-rational-order.svg)](https://www.npmjs.com/package/stylelint-config-rational-order) | [![latest](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-rational-order-966.latest.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-rational-order-966.latest.yml) | [![next](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-rational-order-966.next.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-rational-order-966.next.yml) |
| [![stylelint-config-recess-order](https://img.shields.io/npm/v/stylelint-config-recess-order.svg)](https://www.npmjs.com/package/stylelint-config-recess-order) | [![latest](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recess-order-9f7.latest.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recess-order-9f7.latest.yml) | [![next](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recess-order-9f7.next.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recess-order-9f7.next.yml) |
| [![stylelint-config-recommended](https://img.shields.io/npm/v/stylelint-config-recommended.svg)](https://www.npmjs.com/package/stylelint-config-recommended) | [![latest](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-64e.latest.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-64e.latest.yml) | [![next](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-64e.next.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-64e.next.yml) |
| [![stylelint-config-recommended-less](https://img.shields.io/npm/v/stylelint-config-recommended-less.svg)](https://www.npmjs.com/package/stylelint-config-recommended-less) | [![latest](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-less-00b.latest.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-less-00b.latest.yml) | [![next](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-less-00b.next.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-less-00b.next.yml) |
| [![stylelint-config-recommended-scss](https://img.shields.io/npm/v/stylelint-config-recommended-scss.svg)](https://www.npmjs.com/package/stylelint-config-recommended-scss) | [![latest](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-scss-362.latest.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-scss-362.latest.yml) | [![next](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-scss-362.next.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-scss-362.next.yml) |
| [![stylelint-config-recommended-vue](https://img.shields.io/npm/v/stylelint-config-recommended-vue.svg)](https://www.npmjs.com/package/stylelint-config-recommended-vue) | [![latest](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-vue-162.latest.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-vue-162.latest.yml) | [![next](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-vue-162.next.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-recommended-vue-162.next.yml) |
| [![stylelint-config-sass-guidelines](https://img.shields.io/npm/v/stylelint-config-sass-guidelines.svg)](https://www.npmjs.com/package/stylelint-config-sass-guidelines) | [![latest](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-sass-guidelines-324.latest.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-sass-guidelines-324.latest.yml) | [![next](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-sass-guidelines-324.next.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-config-sass-guidelines-324.next.yml) |
Expand Down Expand Up @@ -65,7 +64,7 @@ To see test results, click the status badge for the relevant package in the list
| [![stylelint-use-nesting](https://img.shields.io/npm/v/stylelint-use-nesting.svg)](https://www.npmjs.com/package/stylelint-use-nesting) | [![latest](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-use-nesting-54f.latest.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-use-nesting-54f.latest.yml) | [![next](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-use-nesting-54f.next.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-use-nesting-54f.next.yml) |
| [![stylelint-value-no-unknown-custom-properties](https://img.shields.io/npm/v/stylelint-value-no-unknown-custom-properties.svg)](https://www.npmjs.com/package/stylelint-value-no-unknown-custom-properties) | [![latest](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-value-no-unknown-custom-properties-2f3.latest.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-value-no-unknown-custom-properties-2f3.latest.yml) | [![next](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-value-no-unknown-custom-properties-2f3.next.yml/badge.svg)](https://github.com/stylelint/stylelint-ecosystem-tester/actions/workflows/test-package-stylelint-value-no-unknown-custom-properties-2f3.next.yml) |

Total 50 packages
Total 49 packages

<!-- END:PACKAGES -->

Expand Down
13 changes: 11 additions & 2 deletions data/ecosystem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ packages:
'@shopify/stylelint-plugin',
{
install-command: 'yarn',
list-installed-versions-command: 'yarn list --pattern stylelint',
test-command: 'NODE_OPTIONS="--experimental-vm-modules --no-warnings" npx jest --runInBand',
},
]
Expand All @@ -22,7 +23,6 @@ packages:
- 'stylelint-config-rational-order'
- 'stylelint-config-recess-order'
- 'stylelint-config-recommended'
- 'stylelint-config-recommended-less'
- 'stylelint-config-recommended-scss'
- 'stylelint-config-recommended-vue'
- 'stylelint-config-sass-guidelines'
Expand All @@ -39,7 +39,16 @@ packages:
- 'stylelint-declaration-strict-value'
- 'stylelint-formatter-pretty'
- 'stylelint-high-performance-animation'
- 'stylelint-less'
- [
'stylelint-less',
{
set-overrides-command: 'npm pkg set pnpm.overrides.stylelint',
install-command: 'pnpm install --no-frozen-lockfile',
list-installed-versions-command: 'pnpm list --long --json stylelint',
build-command: 'pnpm -r build',
test-command: 'pnpm -r test',
},
]
- 'stylelint-media-use-custom-media'
- 'stylelint-no-unsupported-browser-features'
- 'stylelint-order'
Expand Down
21 changes: 19 additions & 2 deletions scripts/update-workflows.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function generateWorkflow({
pkg,
config,
stylelintVersion,
stylelintVersionOverride,
template,
workflowFilePath,
workflowName,
Expand All @@ -35,14 +36,28 @@ function generateWorkflow({
workflow.jobs.test.with.package = pkg;
workflow.jobs.test.with['stylelint-version'] = stylelintVersion;

if (config['test-command']) {
workflow.jobs.test.with['test-command'] = config['test-command'];
if (config['set-overrides-command']) {
workflow.jobs.test.with['set-overrides-command'] = config['set-overrides-command'];
workflow.jobs.test.with['stylelint-version-override'] = stylelintVersionOverride;
}

if (config['install-command']) {
workflow.jobs.test.with['install-command'] = config['install-command'];
}

if (config['list-installed-versions-command']) {
workflow.jobs.test.with['list-installed-versions-command'] =
config['list-installed-versions-command'];
}

if (config['build-command']) {
workflow.jobs.test.with['build-command'] = config['build-command'];
}

if (config['test-command']) {
workflow.jobs.test.with['test-command'] = config['test-command'];
}

return workflow;
}

Expand Down Expand Up @@ -78,6 +93,7 @@ ecosystemData.packages.forEach((packageConfig, index) => {
pkg,
config,
stylelintVersion: 'stylelint@latest',
stylelintVersionOverride: 'latest',
template: workflowTemplateContent,
workflowFilePath: latestStylelintWorkflowFilePath,
workflowName: pkg,
Expand All @@ -95,6 +111,7 @@ ecosystemData.packages.forEach((packageConfig, index) => {
pkg,
config,
stylelintVersion: 'stylelint/stylelint',
stylelintVersionOverride: 'github:stylelint/stylelint',
template: workflowTemplateContent,
workflowFilePath: nextStylelintWorkflowFilePath,
workflowName: pkg,
Expand Down

0 comments on commit 3c2b864

Please sign in to comment.