Skip to content

Commit

Permalink
ci: update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
lihbr committed Jun 14, 2024
1 parent b86edbe commit 3c906e1
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 30 deletions.
90 changes: 66 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,84 @@
name: ci

on:
push:
branches:
- master
pull_request:
branches:
- master
on: push

jobs:
ci:
runs-on: ${{ matrix.os }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install

- name: Lint
run: pnpm lint

typecheck:
runs-on: ubuntu-latest
name: typecheck (node ${{ matrix.node }}, typescript ${{ matrix.typescript }})

strategy:
matrix:
os: [ubuntu-latest]
node: [20]
node: [lts/*]
# Based on https://majors.nullvoxpopuli.com/q?minors=on&packages=typescript
typescript: ["5.3", "5.4"]
fail-fast: false

steps:
- uses: actions/setup-node@v1
- uses: actions/checkout@v4

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

- name: checkout
uses: actions/checkout@master
- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install

- name: cache node_modules
uses: actions/cache@v1
- name: Set typescript ${{ matrix.typescript }}
run: pnpm add --save-dev typescript@${{ matrix.typescript }} && npx tsc --version

- name: Typecheck
run: pnpm typecheck

test:
runs-on: ${{ matrix.os }}
name: test (os ${{ matrix.os }}, node ${{ matrix.node }})

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node: [lts/*]
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Set node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
node-version: ${{ matrix.node }}

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn
run: pnpm install

- name: Test
run: yarn test
- name: Unit
run: pnpm unit

- name: Coverage
uses: codecov/codecov-action@v1
- name: Build
run: pnpm build
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@
"dev:build": "nuxi build playground",
"postinstall": "node postinstall.js",
"lint": "eslint .",
"prepare": "nuxi prepare playground && npm run build",
"release": "npm run test && standard-version --release-as patch && git push --follow-tags && npm run build && npm publish",
"prepare": "nuxi prepare playground && pnpm build",
"release": "pnpm test && standard-version --release-as patch && git push --follow-tags && pnpm build && npm publish",
"release:dry": "standard-version --release-as patch --dry-run",
"release:rc": "npm run test && standard-version --release-as major --prerelease rc && git push --follow-tags && npm run build && npm publish --tag rc",
"release:rc": "pnpm test && standard-version --release-as major --prerelease rc && git push --follow-tags && pnpm build && npm publish --tag rc",
"release:rc:dry": "standard-version --release-as major --prerelease rc --dry-run",
"test": "npm run lint && npm run unit && npm run build",
"typecheck": "tsc --noEmit",
"test": "pnpm lint && pnpm typecheck && pnpm unit && pnpm build",
"unit": "vitest run --coverage",
"unit:watch": "vitest watch"
},
Expand All @@ -69,7 +70,8 @@
"node-fetch": "^2.7.0",
"rc9": "^2.1.2",
"rxjs": "^7.8.1",
"std-env": "^3.7.0"
"std-env": "^3.7.0",
"typescript": "^5.4.5"
},
"devDependencies": {
"@lihbr/eslint-config": "^0.0.2",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default defineNuxtModule<NuxtHue.Config>({

// Expose options through public runtime config
nuxt.options.runtimeConfig.public ||= {} as typeof nuxt.options.runtimeConfig.public
nuxt.options.runtimeConfig.public["nuxt-hue"] = mergedOptions
nuxt.options.runtimeConfig.public["nuxt-hue"] = mergedOptions as Required<NuxtHue.Config>

nuxt.options.vite.server ||= {}
nuxt.options.vite.server!.fs ||= {}
Expand Down

0 comments on commit 3c906e1

Please sign in to comment.