Skip to content

Commit

Permalink
feat: support ci
Browse files Browse the repository at this point in the history
  • Loading branch information
eryue0220 committed Dec 29, 2023
1 parent e177118 commit 418d52c
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .github/actions/setup-and-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Setup and Cache
description: Setup for node, pnpm and cache for browser testing binaries
inputs:
node-version:
required: false
description: Node version for setup-node
default: 20.x

runs:
using: composite

steps:
- name: install pnpm
uses: pnpm/action-setup@v2
- name: Set node version to ${{ inputs.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
push:
branches: [main]

pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/setup-and-cache

- name: Install
run: pnpm i

- name: Lint
run: pnpm run lint

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/setup-and-cache

- name: Install
run: pnpm i

- name: Typecheck
run: pnpm run typecheck

test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [16, 18, 20]

steps:
- uses: actions/checkout@v4

- name: Set node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Install
run: pnpm i

- name: Unit Test
run: pnpm run test
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release

permissions:
contents: write

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set node
uses: actions/setup-node@v4
with:
node-version: lts/*

- run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@
"build": "tsup src/*.ts --format cjs,esm --dts --splitting --clean",
"test": "vitest",
"test:update": "vitest -u",
"test:coverage": "vitest --coverage"
"test:coverage": "vitest --coverage",
"lint": "",
"check": "pnpm run lint && pnpm run typecheck && pnpm run postcheck",
"typecheck": "tsc -p tsconfig.json --noEmit",
"postcheck": "rm *.tsbuildinfo"
},
"engines": {
"node": ">=16.14.0"
Expand Down

0 comments on commit 418d52c

Please sign in to comment.