-
Notifications
You must be signed in to change notification settings - Fork 4
Add missing tests #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: PHPUnit Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ trunk, develop ] | ||
|
|
||
| jobs: | ||
| phpunit: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '8.3' | ||
| tools: composer | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
|
Comment on lines
+13
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pin all GitHub Actions to full commit SHAs. Using floating tags ( Suggested hardening- - uses: actions/checkout@v4
+ - uses: actions/checkout@<full_commit_sha>
- uses: shivammathur/setup-php@v2
+ uses: shivammathur/setup-php@<full_commit_sha>
- uses: actions/setup-node@v4
+ uses: actions/setup-node@<full_commit_sha>🧰 Tools🪛 zizmor (1.25.2)[warning] 13-13: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 13-13: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 16-16: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 22-22: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
| node-version: '20' | ||
| cache: 'npm' | ||
|
|
||
| # Dev dependencies required: test:php runs vendor/bin/phpunit. | ||
| - name: Install Composer dependencies | ||
| run: composer install --no-progress --prefer-dist | ||
|
|
||
| - name: Install npm dependencies | ||
| run: npm ci --force | ||
|
|
||
| # Build so register_block_type finds build/blocks; phpunit.xml.dist sets | ||
| # convertWarningsToExceptions, so a missing build dir would fail activation. | ||
| - name: Build plugin assets | ||
| run: npm run build | ||
|
|
||
| - name: Start wp-env | ||
| run: npx wp-env start | ||
|
|
||
| - name: Run PHPUnit tests | ||
| run: npm run test:php | ||
|
|
||
| - name: Stop wp-env | ||
| if: always() | ||
| run: npx wp-env stop | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disable persisted checkout credentials.
actions/checkoutshould setpersist-credentials: falseso the job token is not left in local git config for subsequent steps.Suggested hardening
📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.25.2)
[warning] 13-13: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 13-13: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents
Source: Linters/SAST tools