Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build React Native Package and Playground
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
merge_group:
permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build
40 changes: 40 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: SonarQube
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
merge_group:
permissions:
contents: read

jobs:
sonarqube:
name: SonarQube
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests with coverage
run: |
pnpm test:coverage

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@2500896589ef8f7247069a56136f8dc177c27ccf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Run unit tests for react-native package
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
merge_group:
permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Test
run: pnpm test
3 changes: 2 additions & 1 deletion apps/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "expo start --reset-cache",
"android": "expo start --android",
"ios": "expo start --ios",
"clean": "rimraf .turbo node_modules .expo"
"clean": "rimraf .turbo node_modules .expo",
"build": "expo export"
},
"dependencies": {
"@formbricks/react-native": "workspace:*",
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"dev": "turbo run dev",
"lint": "turbo run lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"check-types": "turbo run check-types"
"check-types": "turbo run check-types",
"test": "turbo run test --no-cache",
"test:coverage": "turbo run test:coverage --no-cache"
},
"devDependencies": {
"prettier": "^3.5.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dev": "vite build --watch --mode dev",
"clean": "rimraf .turbo node_modules dist .turbo",
"test": "vitest",
"coverage": "vitest run --coverage"
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"@react-native-community/netinfo": "11.4.1",
Expand Down
9 changes: 6 additions & 3 deletions packages/react-native/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ const config = (): UserConfig => {
fileName: "index",
},
},
plugins: [dts({ rollupTypes: true, bundledPackages: ["@formbricks/types"] })],
plugins: [
dts({ rollupTypes: true, bundledPackages: ["@formbricks/types"] }),
],
test: {
setupFiles: ["./vitest.setup.ts"],
coverage: {
provider: "v8",
reporter: ["text", "json", "html"],
include: ["src/lib/**/*.ts"],
reporter: ["text", "json", "html", "lcov"],
include: ["src/**/*.ts"],
exclude: ["src/types/**/*.ts"],
},
},
});
Expand Down
21 changes: 21 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SonarQube Configuration for Formbricks React Native
sonar.projectKey=formbricks_react-native
sonar.organization=formbricks

# Source code paths
sonar.sources=packages/react-native/src,apps/playground/src
sonar.tests=packages/react-native/src

# Test inclusions and exclusions
sonar.test.inclusions=**/*.test.*,**/*.spec.*
sonar.test.exclusions=**/node_modules/**,**/dist/**,**/build/**,**/coverage/**,**/.turbo/**

# General exclusions
sonar.exclusions=**/node_modules/**,**/dist/**,**/build/**,**/coverage/**,**/.turbo/**,**/apps/playground/**,**/*.config.js,**/*.config.ts,**/vite.config.ts,**/vitest.setup.ts,**/tsconfig.json,**/package.json,**/pnpm-lock.yaml,**/turbo.json,**/pnpm-workspace.yaml,**/assets/**,**/android/**,**/ios/**,**/android/**/*,**/ios/**/*,**/*.gradle,**/*.plist,**/*.pbxproj,**/*.xcworkspace,**/*.xcodeproj

# Language specific settings
sonar.javascript.lcov.reportPaths=packages/react-native/coverage/lcov.info
sonar.typescript.tsconfigPath=packages/react-native/tsconfig.json,apps/playground/tsconfig.json

# Coverage settings
sonar.coverage.exclusions=**/node_modules/**,**/dist/**,**/build/**,**/coverage/**,**/.turbo/**,**/apps/playground/**,**/*.config.js,**/*.config.ts,**/vite.config.ts,**/vitest.setup.ts,**/tsconfig.json,**/package.json,**/pnpm-lock.yaml,**/turbo.json,**/pnpm-workspace.yaml
15 changes: 15 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
"dev": {
"cache": false,
"persistent": true
},
"@formbricks/react-native:build": {
"dependsOn": ["^build"],
"cache": false
},
"playground:build": {
"dependsOn": ["@formbricks/react-native:build"],
"outputs": ["apps/playground/out/**"],
"cache": false
},
"test": {
"outputs": []
},
"test:coverage": {
"outputs": []
}
}
}