diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..46746a79 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI - ESLint, Prettier, Jest, and Codecov +on: + push: + branches: [develop, main] + pull_request: + branches: [develop, main] +jobs: + test: + name: Run tests and collect coverage + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Bun + uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Run ESLint + run: bunx eslint . --ext .js,.jsx,.ts,.tsx + + - name: Run Prettier + run: bunx prettier . --check + + - name: Run tests + run: bunx jest --coverage --reporters=jest-junit + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + directory: ${{ github.action_path }} + token: ${{ secrets.CODECOV_TOKEN }} + slug: getsentry/self-hosted + + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + directory: ${{ github.action_path }} + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 6858eda1..00000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: CI ESLint -on: - push: - branches: [develop, main] - pull_request: - branches: [develop, main] -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: oven-sh/setup-bun@v2 - with: - bun-version: latest - - uses: actions/checkout@v4 - - name: Install modules - run: bun install --frozen-lockfile - - name: Run ESLint - run: bunx eslint . --ext .js,.jsx,.ts,.tsx diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml deleted file mode 100644 index 525ba647..00000000 --- a/.github/workflows/prettier.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Prettier -on: - push: - branches: [develop, main] - pull_request: - branches: [develop, main] -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: oven-sh/setup-bun@v2 - with: - bun-version: latest - - uses: actions/checkout@v4 - - name: Install modules - run: bun install --frozen-lockfile - - name: Run Prettier - run: bunx prettier . --check diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 0a216ba9..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Run tests -on: - push: - branches: [develop, main] - pull_request: - branches: [develop, main] -jobs: - test: - name: Run tests and collect coverage - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Bun - uses: oven-sh/setup-bun@v2 - - - name: Install dependencies - run: bun install --frozen-lockfile - - - name: Run tests - run: bunx jest --coverage - - - name: Upload results to Codecov - uses: codecov/codecov-action@v5 - with: - token: ${{ secrets.CODECOV_TOKEN }} diff --git a/bun.lockb b/bun.lockb index 0992dc5f..23783eaa 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..aab435df --- /dev/null +++ b/codecov.yml @@ -0,0 +1,10 @@ +coverage: + status: + project: #add everything under here, more options at https://docs.codecov.com/docs/commit-status + default: + # basic + target: auto #default + threshold: 0% + base: auto + comment: + enabled: true diff --git a/junit.xml b/junit.xml new file mode 100644 index 00000000..84422c40 --- /dev/null +++ b/junit.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/package.json b/package.json index 24fd8958..22a5bae1 100644 --- a/package.json +++ b/package.json @@ -156,6 +156,7 @@ "husky": "^9.1.7", "jest": "~29.7.0", "jest-expo": "~52.0.3", + "jest-junit": "^16.0.0", "lint-staged": "^15.4.0", "prettier": "3.4.2", "prop-types": "^15.8.1", @@ -175,19 +176,18 @@ "react-native-drag-sort@2.4.4": "patches/react-native-drag-sort@2.4.4.patch" }, "jest": { - "preset": "jest-expo", - "transformIgnorePatterns": [ - "node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@sentry/react-native|native-base|react-native-svg)" - ], - "collectCoverage": true, - "collectCoverageFrom": [ - "**/*.{ts,tsx,js,jsx}", - "!**/coverage/**", - "!**/node_modules/**", - "!**/babel.config.js", - "!**/expo-env.d.ts", - "!**/.expo/**" - ] -} - + "preset": "jest-expo", + "transformIgnorePatterns": [ + "node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@sentry/react-native|native-base|react-native-svg)" + ], + "collectCoverage": true, + "collectCoverageFrom": [ + "**/*.{ts,tsx,js,jsx}", + "!**/coverage/**", + "!**/node_modules/**", + "!**/babel.config.js", + "!**/expo-env.d.ts", + "!**/.expo/**" + ] + } }