Workflow file for this run
This file contains hidden or 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
| ## | ||
| # A reusable workflow that runs JavaScript tests. | ||
| ## | ||
| name: JavaScript tests | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| disable-apparmor: | ||
| description: 'Whether to disable AppArmor.' | ||
| required: false | ||
| type: 'boolean' | ||
| default: false | ||
| # Disable permissions for all available scopes by default. | ||
| # Any needed permissions should be configured at the job level. | ||
| permissions: {} | ||
| jobs: | ||
| # Runs the QUnit test suite. | ||
| # | ||
| # Performs the following steps: | ||
| # - Checks out the repository. | ||
| # - Sets up Node.js. | ||
| # - Logs debug information about the GitHub Action runner. | ||
| # - Installs npm dependencies. | ||
| # - Run the WordPress QUnit tests. | ||
| # - Ensures version-controlled files are not modified or deleted. | ||
| test-js: | ||
| name: Run QUnit tests | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: read | ||
| timeout-minutes: 20 | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} | ||
| persist-credentials: false | ||
| - name: Set up Node.js | ||
| <<<<<<< Updated upstream | ||
| <<<<<<< Updated upstream | ||
| uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | ||
| ======= | ||
| uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | ||
| >>>>>>> Stashed changes | ||
| ======= | ||
| uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | ||
| >>>>>>> Stashed changes | ||
| with: | ||
| node-version-file: '.nvmrc' | ||
| cache: npm | ||
| - name: Log debug information | ||
| run: | | ||
| npm --version | ||
| node --version | ||
| git --version | ||
| - name: Install npm Dependencies | ||
| run: npm ci | ||
| # Older branches using outdated versions of Puppeteer fail on newer versions of the `ubuntu-24` image. | ||
| # This disables AppArmor in order to work around those failures. | ||
| # | ||
| # See https://issues.chromium.org/issues/373753919 | ||
| # and https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md | ||
| - name: Disable AppArmor | ||
| if: ${{ inputs.disable-apparmor }} | ||
| run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns | ||
| - name: Run QUnit tests | ||
| run: npm run grunt qunit:compiled | ||
| - name: Ensure version-controlled files are not modified or deleted | ||
| run: git diff --exit-code | ||