Skip to content

Commit 978fcb6

Browse files
committed
ci: Add validation workflow
1 parent cb337b6 commit 978fcb6

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

.github/actions/setup/action.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Basic Setup
2+
description: Install PNPM, Node, and dependencies
3+
runs:
4+
using: composite
5+
steps:
6+
- uses: oven-sh/setup-bun@v1
7+
- run: bun install
8+
shell: bash

.github/workflows/validate.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Validate
2+
on:
3+
workflow_call:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
checks:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: ./.github/actions/setup
15+
- run: bun build:npm
16+
- run: bun check
17+
build:
18+
runs-on: ubuntu-22.04
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: ./.github/actions/setup
22+
- run: bun build:web:nuxt
23+
tests:
24+
runs-on: ubuntu-22.04
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: ./.github/actions/setup
28+
- uses: bun test

build.npm.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Cleanup
22
import { rmdir } from 'node:fs/promises';
33
await rmdir('dist/npm', { recursive: true }).catch(() => {});
4+
import pkg from './package.json';
45

56
// Build Declaration File
67
const tsc = Bun.spawn(['tsc', '-p', 'tsconfig.build.json'], {
@@ -11,10 +12,13 @@ if (tsc.exitCode != null && tsc.exitCode > 0) process.exit(tsc.exitCode);
1112

1213
// Build JS
1314
await Bun.build({
14-
entrypoints: ['src/index.ts', 'src/cli.ts'],
15+
entrypoints: ['src/index.ts'],
1516
outdir: 'dist/npm',
1617
target: 'node',
1718
splitting: true,
19+
external: Object.keys(pkg.dependencies).concat(
20+
Object.keys(pkg.devDependencies),
21+
),
1822
});
1923

2024
console.log('\x1b[1m\x1b[32m✔\x1b[0m Build \x1b[36mdist/npm\x1b[0m');

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
"skipLibCheck": true,
1919
"noFallthroughCasesInSwitch": true,
2020
// Other
21-
"types": ["@nuxtjs/auth-next", "@nuxtjs/axios"]
21+
"types": ["@types/bun"]
2222
}
2323
}

0 commit comments

Comments
 (0)