Skip to content

Commit

Permalink
ci: Add validation workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 committed Apr 4, 2024
1 parent cb337b6 commit 978fcb6
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Basic Setup
description: Install PNPM, Node, and dependencies
runs:
using: composite
steps:
- uses: oven-sh/setup-bun@v1
- run: bun install
shell: bash
28 changes: 28 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Validate
on:
workflow_call:
pull_request:
push:
branches:
- main

jobs:
checks:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: bun build:npm
- run: bun check
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: bun build:web:nuxt
tests:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- uses: bun test
6 changes: 5 additions & 1 deletion build.npm.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Cleanup
import { rmdir } from 'node:fs/promises';
await rmdir('dist/npm', { recursive: true }).catch(() => {});
import pkg from './package.json';

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

// Build JS
await Bun.build({
entrypoints: ['src/index.ts', 'src/cli.ts'],
entrypoints: ['src/index.ts'],
outdir: 'dist/npm',
target: 'node',
splitting: true,
external: Object.keys(pkg.dependencies).concat(
Object.keys(pkg.devDependencies),
),
});

console.log('\x1b[1m\x1b[32m✔\x1b[0m Build \x1b[36mdist/npm\x1b[0m');
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Other
"types": ["@nuxtjs/auth-next", "@nuxtjs/axios"]
"types": ["@types/bun"]
}
}

0 comments on commit 978fcb6

Please sign in to comment.