Skip to content

test: fix cascading worker crash test failures (#866) #1585

test: fix cascading worker crash test failures (#866)

test: fix cascading worker crash test failures (#866) #1585

Workflow file for this run

name: Testing
on:
push:
branches:
- main
- v1.*
- v2
pull_request:
branches:
- '**'
jobs:
lint:
uses: stylelint/.github/.github/workflows/call-lint.yml@60889da59f384526b8185d2aa85b35620aa6bcc0 # 0.6.0
permissions:
contents: read
test:
name: Test for Stylelint ${{ matrix.stylelint }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
stylelint: ['14', '15', '16', '17']
timeout-minutes: 30
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Dev Drive (Windows)
if: runner.os == 'Windows'
id: devdrive
uses: samypr100/setup-dev-drive@30f0f98ae5636b2b6501e181dfb3631b9974818d # v4.0.0
with:
drive-size: 3GB
drive-format: ReFS
drive-type: Fixed
workspace-copy: true
native-dev-drive: true
- name: Resolve workspace path
id: workspace
shell: bash
run: |
workspace_path="${DEV_DRIVE_WORKSPACE:-$GITHUB_WORKSPACE}"
echo "path=${workspace_path}" >> "$GITHUB_OUTPUT"
link_path="$PWD/workspace-link"
rm -rf "$link_path"
if [ "$RUNNER_OS" = "Windows" ]; then
link_path_win="$(pwd -W)/workspace-link"
link_path_win="${link_path_win//\//\\}"
workspace_path_win="${workspace_path//\//\\}"
MSYS2_ARG_CONV_EXCL='*' cmd /c "mklink /D "${link_path_win}" "${workspace_path_win}""
else
ln -s "$workspace_path" "$link_path"
fi
link_path="workspace-link"
echo "linkpath=${link_path}" >> "$GITHUB_OUTPUT"
echo "Determined workspace path: $workspace_path"
echo "Created workspace link at: $link_path"
- name: Hash package-lock
id: pkglock-hash
shell: bash
run: |
hash=$(sha256sum "${{ steps.workspace.outputs.linkpath }}/package-lock.json" | cut -d' ' -f1)
echo "Computed package-lock hash: $hash"
echo "hash=${hash}" >> "$GITHUB_OUTPUT"
- name: Set up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version-file: ${{ steps.workspace.outputs.linkpath }}/.nvmrc
package-manager-cache: false
- name: Install dependencies
working-directory: ${{ steps.workspace.outputs.path }}
env:
NPM_CONFIG_CACHE: ${{ steps.workspace.outputs.path }}/.npm-cache
NPM_CONFIG_PREFER_OFFLINE: true
run: npm ci
- name: Install Stylelint ${{ matrix.stylelint }}
working-directory: ${{ steps.workspace.outputs.path }}
env:
NPM_CONFIG_CACHE: ${{ steps.workspace.outputs.path }}/.npm-cache
NPM_CONFIG_PREFER_OFFLINE: true
run: node --run switch-stylelint ${{ matrix.stylelint }}
- uses: google/wireit@f21db1f3a6a4db31f42787a958cf2a18308effed # setup-github-actions-caching/v2.0.3
- name: Run unit tests
working-directory: ${{ steps.workspace.outputs.path }}
run: node --run test:unit -- -- --coverage
- name: Build and bundle
working-directory: ${{ steps.workspace.outputs.path }}
run: node --run build-bundle
- name: Run integration tests
working-directory: ${{ steps.workspace.outputs.path }}
run: node --run test:integration -- -- --coverage
- name: Get VS Code binary cache key
id: vscode-cache-key
shell: bash
working-directory: ${{ steps.workspace.outputs.path }}
run: |
if command -v shasum >/dev/null 2>&1; then
sum=$(cat package.json | grep 'vscode["\\/]' | shasum -a 256 | cut -d' ' -f1)
else
sum=$(cat package.json | grep 'vscode["\\/]' | sha256sum | cut -d' ' -f1)
fi
cachekey="${{ runner.os }}-vscode-${sum}"
echo "Computed VS Code cache key: $cachekey"
echo "cachekey=${cachekey}" >> $GITHUB_OUTPUT
- name: Cache VS Code binaries
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
id: vscode-cache
with:
path: ${{ steps.workspace.outputs.path }}/.vscode-test
key: ${{ steps.vscode-cache-key.outputs.cachekey }}
- name: Run end-to-end tests (Linux)
if: ${{ runner.os == 'Linux' }}
working-directory: ${{ steps.workspace.outputs.path }}
run: xvfb-run -a node --run test:e2e -- --silent
- name: Run end-to-end tests (non-Linux)
if: ${{ runner.os != 'Linux' }}
working-directory: ${{ steps.workspace.outputs.path }}
run: node --run test:e2e -- --silent
test-node-versions:
runs-on: ubuntu-slim
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Check out
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version-file: .nvmrc
cache: npm
- name: Test Node.js versions
run: node --run test:node-versions