Skip to content

Commit

Permalink
chore: setup codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Feb 13, 2024
1 parent f73f282 commit 688855d
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 20 deletions.
50 changes: 38 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@ name: Build

on:
push:
pull_request:

jobs:
test:
lint:
runs-on: ubuntu-latest

steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
- name: Install
run: yarn --no-immutable
- name: Lint
run: yarn lint

build:
runs-on: ubuntu-latest

steps:
Expand All @@ -16,24 +30,36 @@ jobs:
run: yarn --no-immutable
- name: Build
run: yarn build packages/core
- name: Examples
run: |-
yarn build examples/cross-platform
yarn build examples/node-classic
yarn build examples/node-hybrid
yarn build examples/node-next
yarn build examples/wildcard
git diff --exit-code

lint:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [18, 20]

steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: yarn --no-immutable
- name: Lint
run: yarn lint
- name: Test Examples
run: |-
yarn test:json \
examples/cross-platform \
examples/node-classic \
examples/node-hybrid \
examples/node-next \
examples/wildcard
git diff --exit-code
- name: Report Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/coverage-final.json
name: codecov
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
],
"license": "MIT",
"scripts": {
"build": "node --import tsx packages/core/src/bin.ts",
"build": "tsc -b && node --import tsx packages/core/src/bin.ts",
"lint": "eslint --cache",
"test": "yarn yakumo test --import tsx",
"test": "yarn build",
"test:text": "shx rm -rf coverage && c8 -r text yarn test",
"test:json": "shx rm -rf coverage && c8 -r json yarn test",
"test:html": "shx rm -rf coverage && c8 -r html yarn test"
Expand Down
6 changes: 6 additions & 0 deletions packages/core/.nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"exclude": [
".yarn/**",
"scripts"
]
}
12 changes: 6 additions & 6 deletions packages/core/src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { cac } from 'cac'
import { load } from 'tsconfig-utils'
import dumble from './index.js'

// const args = process.argv.slice(2)

const cli = cac('dumble [name]')
.option('-m, --minify', 'Minify output')
.option('--env <env>', 'Compile-time environment variables')
Expand All @@ -16,8 +14,10 @@ const cli = cac('dumble [name]')
const argv = cli.parse()

if (!argv.options.help) {
const cwd = resolve(process.cwd(), argv.args[0])
const manifest = await readFile(join(cwd, 'package.json'), 'utf8').then(JSON.parse)
const tsconfig = await load(cwd)
await dumble(cwd, manifest, tsconfig, argv.options)
for (const path of argv.args.length ? argv.args : ['.']) {
const cwd = resolve(process.cwd(), path)
const manifest = await readFile(join(cwd, 'package.json'), 'utf8').then(JSON.parse)
const tsconfig = await load(cwd)
await dumble(cwd, manifest, tsconfig, argv.options)
}
}

0 comments on commit 688855d

Please sign in to comment.