chore: 整理 third-party Dark Reader 目录并移除本地说明文件跟踪
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
name: Create binary for release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
retention_days:
|
||||
description: 'Retention duration (in days)'
|
||||
required: true
|
||||
default: '1'
|
||||
node_version:
|
||||
description: 'NodeJS version'
|
||||
required: true
|
||||
default: '22.x'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node_version || '22.x' }}
|
||||
cache: npm
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build the extension
|
||||
run: npm run release
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: |
|
||||
build/release/darkreader-*
|
||||
|
||||
- name: Upload built artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: build/release/darkreader-*
|
||||
retention-days: ${{ inputs.retention_days }}
|
||||
@@ -0,0 +1,123 @@
|
||||
name: Run browser tests
|
||||
|
||||
on:
|
||||
# Runs for pushes, pull requests, and manual triggers.
|
||||
# (Dooes not run when only some config is changed.)
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'src/config/*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
paths-ignore:
|
||||
- 'src/config/**'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
test_results_retention_days:
|
||||
description: 'Test results retention (in days)'
|
||||
required: true
|
||||
default: '7'
|
||||
node_version:
|
||||
description: 'NodeJS version'
|
||||
required: true
|
||||
default: '22.x'
|
||||
|
||||
jobs:
|
||||
test-browser:
|
||||
name: Run browser tests
|
||||
timeout-minutes: 10
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
|
||||
# Extended support releases
|
||||
- channel: esr
|
||||
firefox: latest-esr
|
||||
|
||||
# Stable releases
|
||||
- channel: stable
|
||||
chrome: stable
|
||||
firefox: latest
|
||||
coverage: true
|
||||
|
||||
# Beta releases
|
||||
- channel: beta
|
||||
chrome: beta
|
||||
firefox: latest-beta
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Chrome
|
||||
if: ${{ matrix.chrome }}
|
||||
uses: browser-actions/setup-chrome@latest
|
||||
with:
|
||||
chrome-version: ${{ matrix.chrome }}
|
||||
|
||||
- name: Configure Karma with path to Chrome executable
|
||||
if: ${{ matrix.chrome }}
|
||||
run: |
|
||||
chrome --version
|
||||
{ echo CHROME_BIN="$(which chrome)"; echo CHROME_TEST=1; } | tee -a "$GITHUB_ENV"
|
||||
|
||||
- name: Install Firefox
|
||||
if: ${{ matrix.firefox }}
|
||||
uses: browser-actions/setup-firefox@latest
|
||||
with:
|
||||
firefox-version: ${{ matrix.firefox }}
|
||||
- name: Configure Karma with path to Firefox executable
|
||||
if: ${{ matrix.firefox }}
|
||||
run: |
|
||||
firefox --version
|
||||
{ echo FIREFOX_BIN="$(which firefox)"; echo FIREFOX_TEST=1; } | tee -a "$GITHUB_ENV"
|
||||
|
||||
- name: Node setup
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node_version || '22.x' }}
|
||||
cache: npm
|
||||
|
||||
- name: Install NPM dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Deps
|
||||
run: cat package-lock.json
|
||||
|
||||
- name: Run injection tests
|
||||
run: npm run test:inject -- --ci --json --outputFile=test-results-inject.json
|
||||
|
||||
- name: Run browser tests on Chromium MV2 build
|
||||
if: ${{ matrix.chrome }}
|
||||
uses: coactions/setup-xvfb@v1
|
||||
with:
|
||||
run: npm run test:chrome -- --json --outputFile=test-results-chrome.json
|
||||
|
||||
- name: Run browser tests on Chromium MV3 build
|
||||
if: ${{ matrix.chrome }}
|
||||
uses: coactions/setup-xvfb@v1
|
||||
with:
|
||||
run: npm run test:chrome-mv3 -- --json --outputFile=test-results-chrome-mv3.json
|
||||
|
||||
- name: Run browser tests on Firefox MV2 build
|
||||
if: ${{ matrix.firefox }}
|
||||
uses: coactions/setup-xvfb@v1
|
||||
with:
|
||||
run: npm run test:firefox -- --json --outputFile=test-results-firefox-mv2.json
|
||||
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-results-chrome-${{ matrix.chrome }}-firefox-${{ matrix.firefox }}-coverage-${{ matrix.coverage }}
|
||||
path: test-results-*
|
||||
retention-days: ${{ inputs.test_results_retention_days }}
|
||||
@@ -0,0 +1,57 @@
|
||||
name: Run code tests on Pull Request or Push
|
||||
|
||||
on:
|
||||
# Runs for pushes and pull requests,
|
||||
# but don't run these when only some config is changed.
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'src/config/*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
paths-ignore:
|
||||
- 'src/config/**'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
node_version:
|
||||
description: 'NodeJS version'
|
||||
required: true
|
||||
default: '22.x'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Run tests
|
||||
timeout-minutes: 5
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Clone repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Node setup
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node_version || '22.x' }}
|
||||
cache: npm
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Deps
|
||||
run: cat package-lock.json
|
||||
|
||||
- name: Lint code for code-style errors
|
||||
run: npm run lint
|
||||
|
||||
- name: Check for compatibility issues
|
||||
run: npm run lint:bundle
|
||||
|
||||
- name: Check NPM dependencies
|
||||
run: node tests/dependencies.js
|
||||
@@ -0,0 +1,53 @@
|
||||
name: Unit tests on Pull Request or Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
test_results_retention_days:
|
||||
description: 'Test results retention (in days)'
|
||||
required: true
|
||||
default: '7'
|
||||
node_version:
|
||||
description: 'NodeJS version'
|
||||
required: true
|
||||
default: '22.x'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Run tests
|
||||
timeout-minutes: 2
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Clone repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Node setup
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node_version || '22.x' }}
|
||||
cache: npm
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run test against code
|
||||
run: npm run test:unit -- --json --outputFile=test-results-unit.json
|
||||
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-results-unit
|
||||
path: test-results-unit.json
|
||||
retention-days: ${{ inputs.test_results_retention_days }}
|
||||
Reference in New Issue
Block a user