* feat: deploy RSSHub to Cloudflare Workers - Create Worker entry point (lib/worker.ts) with polyfills - Implement Worker-specific app configuration (lib/app.worker.tsx) - Add automatic .worker.ts resolution plugin for cleaner config - Simplify build configuration with only 3 essential shims - Enable static asset serving via Cloudflare Static Assets feature - Support dynamic route loading with proper module aliasing 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * feat(worker): add puppeteer and request-rewriter support - Add @cloudflare/puppeteer for Browser Rendering API support - Create puppeteer.worker.ts with Cloudflare Browser binding - Add request-rewriter Worker version with static browser headers - Add vm module shim to node-module.ts for JSDOM compatibility - Configure __dirname/__filename in tsdown for CommonJS compat - Update wrangler.toml with BROWSER binding configuration - Dynamically extract namespaces from foloAnalysisTop100 for routes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cache): restore synchronous initialization for tests The async initialization caused cache tests to fail because the cache module wasn't ready when tests ran. Restored synchronous imports while keeping Worker-specific no-op behavior. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test(worker): add automated Worker integration tests - Add miniflare for Worker environment simulation - Create lib/worker.worker.test.ts with integration tests - Test basic routes (/test/1, /, unknown routes) - Test RSS feed routes (hackernews, v2ex) - Test error handling for puppeteer routes without BROWSER binding - Add worker-test npm script 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor(worker): use test routes for Worker integration tests - Replace third-party routes (hackernews, v2ex, weibo) with /test/* routes - Remove miniflare dependency (wrangler includes it internally) - Simplify test setup using wrangler's unstable_dev API 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix(test): make header-generator test less flaky The header-generator library may return different platform values due to internal randomness. Update test to check for valid format instead of exact value. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix(test): exclude worker tests from vitest coverage run Worker tests require the dist-worker bundle to be built first, which is not part of the regular CI test workflow. These tests should be run separately using 'pnpm worker-test'. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test(worker): add automated Worker integration tests - Add worker-build step to CI workflow before running tests - Revert exclusion of worker tests from vitest coverage run - Worker tests now run as part of the regular test suite 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(worker): fix routes.js alias path in worker build config Change alias key from absolute path to relative import path to match how it's imported in lib/registry.ts. This fixes the worker build failing with "Could not resolve '../assets/build/routes.js'" error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * ci: trigger CI re-run 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(ci): build worker routes before worker-build The worker build requires routes-worker.js which is generated by running build:routes with WORKER_BUILD=true. This was missing in CI, causing the worker build to fail with "Could not resolve routes.js". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(test): increase timeout for Worker integration tests Worker tests need more time in CI environments. Increase individual test timeouts from default 10s to 30s for each test case. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
152 lines
6.4 KiB
YAML
152 lines
6.4 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches-ignore:
|
|
- 'dependabot/**'
|
|
paths:
|
|
- 'lib/**'
|
|
- 'package.json'
|
|
- 'pnpm-lock.yaml'
|
|
- '.github/workflows/test.yml'
|
|
pull_request: {}
|
|
|
|
permissions:
|
|
checks: write
|
|
|
|
jobs:
|
|
vitest:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
services:
|
|
redis:
|
|
image: redis
|
|
ports:
|
|
- 6379/tcp
|
|
options: --entrypoint redis-server
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node-version: [latest, lts/*, lts/-1]
|
|
name: Vitest on Node ${{ matrix.node-version }}
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
|
|
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'pnpm'
|
|
- name: Install dependencies (pnpm)
|
|
run: pnpm i
|
|
- name: Run postinstall script for dependencies
|
|
run: pnpm rb && pnpx rebrowser-puppeteer browsers install chrome
|
|
- name: Build routes
|
|
run: pnpm build
|
|
- name: Build worker routes
|
|
run: WORKER_BUILD=true pnpm build:routes
|
|
- name: Build worker
|
|
run: pnpm worker-build
|
|
- name: Test all and generate coverage
|
|
run: pnpm run vitest:coverage --reporter=github-actions
|
|
env:
|
|
REDIS_URL: redis://localhost:${{ job.services.redis.ports[6379] }}/
|
|
- name: Upload coverage to Codecov
|
|
if: ${{ matrix.node-version == 'lts/*' }}
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos as documented, but seems broken
|
|
|
|
puppeteer:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node-version: [latest, lts/*, lts/-1]
|
|
chromium:
|
|
- name: bundled Chromium
|
|
dependency: ''
|
|
environment: '{ "PUPPETEER_SKIP_DOWNLOAD": "0" }'
|
|
- name: Chromium from Ubuntu
|
|
dependency: chromium-browser
|
|
environment: '{ "PUPPETEER_SKIP_DOWNLOAD": "1" }'
|
|
- name: Chrome from Google
|
|
dependency: google-chrome-stable
|
|
environment: '{ "PUPPETEER_SKIP_DOWNLOAD": "1" }'
|
|
name: Vitest puppeteer on Node ${{ matrix.node-version }} with ${{ matrix.chromium.name }}
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
|
|
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'pnpm'
|
|
- name: Install dependencies (pnpm)
|
|
run: pnpm i
|
|
env: ${{ fromJSON(matrix.chromium.environment) }}
|
|
- name: Run postinstall script for dependencies
|
|
run: pnpm rb && pnpx rebrowser-puppeteer browsers install chrome
|
|
env: ${{ fromJSON(matrix.chromium.environment) }}
|
|
- name: Build routes
|
|
run: pnpm build
|
|
env: ${{ fromJSON(matrix.chromium.environment) }}
|
|
- name: Install Chromium
|
|
if: ${{ matrix.chromium.dependency != '' }}
|
|
# 'chromium-browser' from Ubuntu APT repo is a dummy package. Its version (85.0.4183.83) means
|
|
# nothing since it calls Snap (disgusting!) to install Chromium, which should be up-to-date.
|
|
# That's not really a problem since the Chromium-bundled Docker image is based on Debian bookworm,
|
|
# which provides up-to-date native packages.
|
|
run: |
|
|
set -eux
|
|
curl -s "https://dl.google.com/linux/linux_signing_key.pub" | gpg --dearmor |
|
|
sudo tee /etc/apt/trusted.gpg.d/google-chrome.gpg > /dev/null
|
|
echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" |
|
|
sudo tee /etc/apt/sources.list.d/google-chrome.list > /dev/null
|
|
sudo apt-get update
|
|
sudo apt-get install -yq --no-install-recommends ${{ matrix.chromium.dependency }}
|
|
- name: Test puppeteer
|
|
run: |
|
|
set -eux
|
|
export CHROMIUM_EXECUTABLE_PATH="$(which ${{ matrix.chromium.dependency }})"
|
|
pnpm run vitest puppeteer
|
|
env: ${{ fromJSON(matrix.chromium.environment) }}
|
|
|
|
all:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
permissions:
|
|
attestations: write
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node-version: [24, 22, 20]
|
|
name: Build radar and maintainer on Node ${{ matrix.node-version }}
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
|
|
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'pnpm'
|
|
- run: pnpm i
|
|
- name: Build radar and maintainer
|
|
run: npm run build
|
|
- name: Upload assets
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
with:
|
|
name: generated-assets-${{ matrix.node-version }}
|
|
path: assets/build/
|
|
|
|
automerge:
|
|
if: github.triggering_actor == 'dependabot[bot]' && github.event_name == 'pull_request'
|
|
needs: [vitest, puppeteer, all]
|
|
runs-on: ubuntu-slim
|
|
permissions:
|
|
pull-requests: write
|
|
contents: write
|
|
steps:
|
|
- uses: fastify/github-action-merge-dependabot@1b2ed42db8f9d81a46bac83adedfc03eb5149dff # v3.11.2
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
target: patch
|