Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Auto detect text files and perform LF normalization
* text=auto

# Source code
*.ts text eol=lf
*.js text eol=lf
*.json text eol=lf
*.md text eol=lf

# GitHub Actions
*.yml text eol=lf
*.yaml text eol=lf

# Scripts
*.sh text eol=lf

# Documentation
*.txt text eol=lf
LICENSE text eol=lf
README text eol=lf

# Binary files
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.mov binary
*.mp4 binary
*.mp3 binary
*.zip binary
*.gz binary
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
push:
branches: [master, main, develop]
pull_request:
branches: [master, main, develop]

jobs:
build:
name: Build & Lint & Test
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint

- name: Run tests
run: npm test

- name: Build project
run: npm run build

- name: Check build output
run: |
ls -lh dist/
echo "IIFE bundle size: $(du -h dist/pixelguide.js | cut -f1)"
echo "ESM bundle size: $(du -h dist/pixelguide.esm.js | cut -f1)"

- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: matrix.node-version == '20.x'
with:
name: dist-files
path: dist/
retention-days: 7

- name: Generate coverage report
run: npm run test:coverage
if: matrix.node-version == '20.x'

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.node-version == '20.x'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage-final.json
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
continue-on-error: true
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint

on:
push:
branches: ['**']
pull_request:
branches: ['**']

jobs:
lint:
name: ESLint
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint

- name: Run ESLint with no warnings (strict mode)
run: npm run lint:check
continue-on-error: true
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test

on:
push:
branches: ['**']
pull_request:
branches: ['**']

jobs:
test:
name: Tests
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Generate coverage report
run: npm run test:coverage
if: matrix.node-version == '20.x'

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.node-version == '20.x'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage-final.json
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
continue-on-error: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dependencies
node_modules/
package-lock.json
# package-lock.json should be committed for reproducible builds
yarn.lock
pnpm-lock.yaml

Expand Down
Loading
Loading