Fix: Refactor and update phpcs rules (#1269) #7
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: JavaScript Tests | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
# Runs the QUnit tests for ClassicPress. | |
# | |
# Performs the following steps: | |
# - Cancels all previous workflow runs for pull requests that have not completed. | |
# - Checks out the repository. | |
# - Installs NodeJS. | |
# - Sets up caching for NPM. | |
# - Logs debug information. | |
# - Installs NPM dependencies using install-changed to hash the `package.json` file. | |
# - Run the ClassicPress QUnit tests. | |
# - todo: Configure Slack notifications for failing tests. | |
test-js: | |
name: QUnit Tests | |
runs-on: ubuntu-22.04 | |
if: ${{ github.repository == 'ClassicPress/ClassicPress' || github.event_name == 'pull_request' }} | |
steps: | |
- name: Cancel previous runs of this workflow (pull requests only) | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: styfle/cancel-workflow-action@0.12.0 | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Read .nvmrc | |
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT | |
id: nvmrc | |
- name: Install NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '${{ steps.nvmrc.outputs.NVMRC }}' | |
- name: Cache NodeJS modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: Show debug information | |
run: | | |
set +e | |
set -x | |
npm --version | |
node --version | |
curl --version | |
git --version | |
svn --version | |
php --version | |
phpunit --version | |
composer --version | |
grunt --version | |
mysql --version | |
- name: Install dependencies | |
run: npx install-changed --install-command="npm ci" | |
- name: Run QUnit tests | |
run: grunt qunit:compiled |