ca4bfc33fd
- Remove unused imports and variables across 35 files - Simplify component logic and remove dead code - Clean up test files by removing unnecessary setup - Streamline CI workflow configuration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
151 lines
3.6 KiB
YAML
151 lines
3.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
setup:
|
|
name: Prepare Dependencies
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
cache-key: ${{ steps.cache-info.outputs.key }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Cache Node Modules
|
|
id: cache-nodemodules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-node-v22-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node-v22-
|
|
|
|
- name: Install dependencies
|
|
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
|
|
run: npm ci
|
|
|
|
- name: Output Cache Key
|
|
id: cache-info
|
|
run: echo "key=${{ runner.os }}-node-v22-${{ hashFiles('**/package-lock.json') }}" >> $GITHUB_OUTPUT
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
needs: setup
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Restore Node Modules Instantantly
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-node-v22-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Run ESLint
|
|
run: npm run lint
|
|
|
|
typecheck:
|
|
name: TypeScript Check
|
|
runs-on: ubuntu-latest
|
|
needs: setup
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Restore Node Modules Instantantly
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-node-v22-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Generate WXT types
|
|
run: npx wxt prepare
|
|
|
|
- name: Run TypeScript type check
|
|
run: npm run typecheck
|
|
|
|
test:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-latest
|
|
needs: setup
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Restore Node Modules Instantantly
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-node-v22-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Generate WXT types
|
|
run: npx wxt prepare
|
|
|
|
- name: Run tests
|
|
run: npm run test
|
|
|
|
build:
|
|
name: Build (${{ matrix.browser }})
|
|
runs-on: ubuntu-latest
|
|
needs: [ lint, typecheck, test ]
|
|
strategy:
|
|
matrix:
|
|
browser: [ chrome, firefox ]
|
|
fail-fast: false
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Restore Node Modules Instantantly
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-node-v22-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Generate WXT types
|
|
run: npx wxt prepare
|
|
|
|
- name: Build Extension (${{ matrix.browser }})
|
|
run: |
|
|
if npm run | grep -q "build:${{ matrix.browser }}"; then
|
|
npm run build:${{ matrix.browser }}
|
|
else
|
|
npm run build -- --browser ${{ matrix.browser }}
|
|
fi |