Skip to content

Commit 460d53e

Browse files
authored
Merge pull request #1 from olliethedev/build/ci-script
build: ci
2 parents 60170ae + c57fe8b commit 460d53e

63 files changed

Lines changed: 6156 additions & 237 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
10+
concurrency:
11+
group: ci-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Setup PNPM
24+
uses: pnpm/action-setup@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 20
30+
cache: 'pnpm'
31+
32+
- name: Install dependencies
33+
run: pnpm install
34+
35+
- name: Typecheck
36+
run: pnpm -w typecheck
37+
38+
- name: Lint
39+
run: pnpm -w lint
40+
41+
- name: Build
42+
run: pnpm -w build
43+
44+
- name: Test
45+
run: pnpm -w test
46+

.github/workflows/e2e.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: E2E Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
10+
jobs:
11+
e2e:
12+
runs-on: ubuntu-latest
13+
concurrency:
14+
group: e2e-${{ github.ref }}
15+
cancel-in-progress: true
16+
permissions:
17+
contents: read
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Setup PNPM
24+
uses: pnpm/action-setup@v4
25+
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 20
31+
cache: 'pnpm'
32+
33+
- name: Install dependencies
34+
run: pnpm install
35+
36+
- name: Install Playwright browsers
37+
run: cd e2e && pnpm exec playwright install --with-deps
38+
39+
- name: Build workspace
40+
run: pnpm -w build
41+
42+
- name: Run Playwright smoke tests
43+
run: pnpm e2e:smoke
44+
45+
- name: Upload Playwright report
46+
if: always()
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: playwright-report
50+
path: e2e/playwright-report
51+
if-no-files-found: ignore
52+
53+
- name: Upload traces
54+
if: failure()
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: traces
58+
path: test-results/**/*.zip
59+
if-no-files-found: ignore

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727

2828
- run: pnpm install
2929

30+
- name: Copy README to package
31+
run: cp README.md packages/better-stack/README.md
32+
3033
- name: Typecheck
3134
working-directory: packages/better-stack
3235
run: pnpm typecheck

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ import type {
430430
// Utilities (can be used in both)
431431
import {
432432
createApiClient,
433-
getServerBaseURL,
434433
} from "@btst/stack/plugins";
435434
```
436435

@@ -709,7 +708,7 @@ my-plugin-client/
709708
"name": "@yourorg/my-plugin-client",
710709
"peerDependencies": {
711710
"@btst/stack": "^1.0.0",
712-
"@btst/yar": "^1.1.0",
711+
"@btst/yar": "^1.1.1",
713712
"react": "^18.0.0 || ^19.0.0"
714713
}
715714
}

biome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
"!**/dev/cloudflare/drizzle",
6868
"!**/playwright-report",
6969
"!**/.output",
70-
"!**/.tmp"
70+
"!**/.tmp",
71+
"!**/examples/**"
7172
]
7273
}
7374
}

e2e/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

e2e/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "e2e",
3+
"version": "0.0.0",
4+
"private": true,
5+
"description": "End-to-end tests(Playwright)",
6+
"scripts": {
7+
"e2e:install": "playwright install --with-deps",
8+
"e2e:smoke": "playwright test",
9+
"e2e:ui": "playwright test --ui"
10+
},
11+
"devDependencies": {
12+
"@playwright/test": "^1.48.2",
13+
"tsx": "^4.20.3"
14+
}
15+
}

e2e/playwright.config.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { defineConfig } from "@playwright/test";
2+
3+
export default defineConfig({
4+
testDir: "./tests",
5+
timeout: 90_000,
6+
forbidOnly: !!process.env.CI,
7+
outputDir: "../test-results",
8+
reporter: process.env.CI
9+
? [["list"], ["html", { open: "never" }]]
10+
: [["list"]],
11+
expect: {
12+
timeout: 10_000,
13+
},
14+
retries: process.env["CI"] ? 2 : 0,
15+
use: {
16+
trace: "retain-on-failure",
17+
video: "retain-on-failure",
18+
screenshot: "only-on-failure",
19+
actionTimeout: 15_000,
20+
navigationTimeout: 30_000,
21+
baseURL: "http://localhost:3000",
22+
},
23+
webServer: [
24+
// Next.js with memory provider and custom plugin
25+
{
26+
command: "pnpm -F examples/nextjs run start:e2e",
27+
port: 3001,
28+
reuseExistingServer: !process.env["CI"],
29+
timeout: 120_000,
30+
stdout: "pipe",
31+
stderr: "pipe",
32+
env: {
33+
...process.env,
34+
PORT: "3001",
35+
HOST: "127.0.0.1",
36+
BASE_URL: "http://localhost:3001",
37+
},
38+
},
39+
],
40+
projects: [
41+
{
42+
name: "nextjs:memory",
43+
use: { baseURL: "http://localhost:3001" },
44+
testMatch: ["**/*.spec.ts"],
45+
},
46+
],
47+
});

e2e/tests/smoke.todos.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { expect, test } from "@playwright/test";
2+
3+
test("page renders", async ({ page }) => {
4+
const errors: string[] = [];
5+
page.on("console", (msg) => {
6+
if (msg.type() === "error") errors.push(msg.text());
7+
});
8+
9+
await page.goto("/pages/todos", { waitUntil: "networkidle" });
10+
await expect(page).toHaveTitle(/Create Next App/i);
11+
// no console errors
12+
expect(errors, `Console errors detected: \n${errors.join("\n")}`).toEqual([]);
13+
});

examples/nextjs/.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts

0 commit comments

Comments
 (0)