chore(deps): Bump the minor-patch-updates group across 1 directory with 24 updates #7
Workflow file for this run
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: Test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
# Also run when Dependabot creates PRs | |
pull_request_target: | |
branches: [main] | |
jobs: | |
test: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
# Important for security when using pull_request_target | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
# Full git history for Dependabot PRs | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci | |
- name: Type check | |
id: typecheck | |
continue-on-error: true | |
run: npm run check | |
- name: Lint | |
id: lint | |
continue-on-error: true | |
run: npm run lint | |
- name: Build | |
id: build | |
continue-on-error: true | |
run: npm run build | |
- name: Run unit tests | |
id: unit-tests | |
continue-on-error: true | |
run: npm run test:unit | |
- name: Install Playwright browsers | |
run: npx playwright install --with-deps chromium | |
- name: Run integration tests | |
id: integration-tests | |
continue-on-error: true | |
run: npm run test:integration | |
- name: Start preview server and test endpoints | |
id: preview | |
continue-on-error: true | |
run: | | |
npm run preview & | |
sleep 5 | |
# Basic health check | |
curl -f http://localhost:4173/ | |
# Test API endpoints | |
curl -f http://localhost:4173/api/weather | |
- name: Comment on PR | |
if: github.event_name == 'pull_request_target' && always() | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
// Store step outcomes | |
const outcomes = { | |
typecheck: '${{ steps.typecheck.outcome }}', | |
lint: '${{ steps.lint.outcome }}', | |
build: '${{ steps.build.outcome }}', | |
unitTests: '${{ steps.unit-tests.outcome }}', | |
integrationTests: '${{ steps.integration-tests.outcome }}', | |
preview: '${{ steps.preview.outcome }}' | |
}; | |
// Convert outcome to emoji | |
const getEmoji = (outcome) => { | |
switch(outcome) { | |
case 'success': return '✅'; | |
case 'failure': return '❌'; | |
case 'skipped': return '⏭️'; | |
default: return '❓'; | |
} | |
}; | |
// Check if any tests failed | |
const hasFailures = Object.values(outcomes).includes('failure'); | |
const header = hasFailures ? '## Test Results ❌' : '## Test Results ✅'; | |
const message = `${header}\n\n` + | |
'Build and test run completed.\n\n' + | |
'Details:\n' + | |
`- Type checking: ${getEmoji(outcomes.typecheck)}\n` + | |
`- Linting: ${getEmoji(outcomes.lint)}\n` + | |
`- Build: ${getEmoji(outcomes.build)}\n` + | |
`- Unit tests: ${getEmoji(outcomes.unitTests)}\n` + | |
`- Integration tests: ${getEmoji(outcomes.integrationTests)}\n` + | |
`- Preview: ${getEmoji(outcomes.preview)}\n\n` + | |
(hasFailures ? '⚠️ Some checks failed. Please review the workflow logs for details.\n\n' : '') + | |
'Full results available in workflow artifacts.'; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: message | |
}); | |
# Make the workflow fail if any tests failed | |
- name: Check for test failures | |
if: always() | |
run: | | |
if [[ "${{ steps.typecheck.outcome }}" == "failure" ]] || \ | |
[[ "${{ steps.lint.outcome }}" == "failure" ]] || \ | |
[[ "${{ steps.build.outcome }}" == "failure" ]] || \ | |
[[ "${{ steps.unit-tests.outcome }}" == "failure" ]] || \ | |
[[ "${{ steps.integration-tests.outcome }}" == "failure" ]] || \ | |
[[ "${{ steps.preview.outcome }}" == "failure" ]]; then | |
echo "Some tests failed!" | |
exit 1 | |
fi |