Skip to content

Commit 3433bb6

Browse files
committed
adds github actions for build and test
1 parent 2b5cc02 commit 3433bb6

File tree

7 files changed

+94
-5
lines changed

7 files changed

+94
-5
lines changed

.github/workflows/build.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build React Native Package and Playground
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
merge_group:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "20"
23+
cache: "pnpm"
24+
25+
- name: Setup pnpm
26+
uses: pnpm/action-setup@v4
27+
with:
28+
version: 9.0.0
29+
30+
- name: Install dependencies
31+
run: pnpm install
32+
33+
- name: Build
34+
run: pnpm build

.github/workflows/test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Run unit tests for react-native package
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
merge_group:
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "20"
23+
cache: "pnpm"
24+
25+
- name: Setup pnpm
26+
uses: pnpm/action-setup@v4
27+
with:
28+
version: 9.0.0
29+
30+
- name: Install dependencies
31+
run: pnpm install
32+
33+
- name: Build
34+
run: pnpm build

apps/playground/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"dev": "expo start --reset-cache",
77
"android": "expo start --android",
88
"ios": "expo start --ios",
9-
"clean": "rimraf .turbo node_modules .expo"
9+
"clean": "rimraf .turbo node_modules .expo",
10+
"build": "expo export"
1011
},
1112
"dependencies": {
1213
"@formbricks/react-native": "workspace:*",

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"dev": "turbo run dev",
77
"lint": "turbo run lint",
88
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
9-
"check-types": "turbo run check-types"
9+
"check-types": "turbo run check-types",
10+
"test": "turbo run test --no-cache",
11+
"test:coverage": "turbo run test:coverage --no-cache"
1012
},
1113
"devDependencies": {
1214
"prettier": "^3.5.3",

packages/react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"dev": "vite build --watch --mode dev",
3939
"clean": "rimraf .turbo node_modules dist .turbo",
4040
"test": "vitest",
41-
"coverage": "vitest run --coverage"
41+
"test:coverage": "vitest run --coverage"
4242
},
4343
"dependencies": {
4444
"@react-native-community/netinfo": "11.4.1",

packages/react-native/vite.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@ const config = (): UserConfig => {
3131
fileName: "index",
3232
},
3333
},
34-
plugins: [dts({ rollupTypes: true, bundledPackages: ["@formbricks/types"] })],
34+
plugins: [
35+
dts({ rollupTypes: true, bundledPackages: ["@formbricks/types"] }),
36+
],
3537
test: {
3638
setupFiles: ["./vitest.setup.ts"],
3739
coverage: {
3840
provider: "v8",
3941
reporter: ["text", "json", "html"],
40-
include: ["src/lib/**/*.ts"],
42+
include: ["src/**/*.ts"],
43+
exclude: ["src/types/**/*.ts"],
4144
},
4245
},
4346
});

turbo.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@
1616
"dev": {
1717
"cache": false,
1818
"persistent": true
19+
},
20+
"@formbricks/react-native:build": {
21+
"dependsOn": ["^build"],
22+
"cache": false
23+
},
24+
"playground:build": {
25+
"dependsOn": ["@formbricks/react-native:build"],
26+
"outputs": ["apps/playground/out/**"],
27+
"cache": false
28+
},
29+
"test": {
30+
"outputs": []
31+
},
32+
"test:coverage": {
33+
"outputs": []
1934
}
2035
}
2136
}

0 commit comments

Comments
 (0)