Add unit test to test for CSS syntax errors #141 #993
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
# @Author: Roni Laukkarinen | |
# @Date: 2023-02-15 17:39:37 | |
# @Last Modified by: Roni Laukkarinen | |
# @Last Modified time: 2023-03-03 20:01:10 | |
name: CSS | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: Test styles | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Read .nvmrc | |
run: echo ::set-output name=NVMRC::$(cat .nvmrc) | |
id: nvm | |
- name: Setup node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '${{ steps.nvm.outputs.NVMRC }}' | |
- name: Install stylelint packages | |
run: | | |
npm install --global \ | |
stylelint@^15.2.0 \ | |
stylelint-config-standard@^30.0.1 \ | |
stylelint-order@^6.0.3 \ | |
@ronilaukkarinen/stylelint-a11y@^1.2.7 \ | |
@ronilaukkarinen/stylelint-declaration-strict-value@^1.9.2 \ | |
@ronilaukkarinen/stylelint-value-no-unknown-custom-properties@^4.0.1 \ | |
postcss@8.4.21 \ | |
postcss-cli@^10.1.0 | |
- name: Run stylelint | |
run: | | |
npx stylelint *.css --max-warnings 0 --config .stylelintrc | |
- name: Validate CSS syntax | |
run: | | |
for file in *.css; do | |
echo "Validating $file" | |
npx postcss "$file" --parser postcss-safe-parser | |
done |