From b18677a4720c905a035101b813953783da070c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Lavault?= Date: Fri, 5 Sep 2025 14:13:35 +0200 Subject: [PATCH 1/8] chore(ci) convert Circle CI config to github workflow --- .circleci/config.yml | 98 -------------------------- .github/workflows/ci.yml | 148 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 98 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 902911a..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,98 +0,0 @@ -version: 2.1 - -executors: - default: - docker: - - image: circleci/node:16 - working_directory: ~/project - -commands: - attach_project: - steps: - - attach_workspace: - at: ~/project - -jobs: - install-dependencies: - executor: default - steps: - - checkout - - attach_project - - restore_cache: - keys: - - dependencies-{{ checksum "package.json" }} - - dependencies- - - restore_cache: - keys: - - dependencies-example-{{ checksum "example/package.json" }} - - dependencies-example- - - run: - name: Install dependencies - command: | - yarn install --cwd example --frozen-lockfile - yarn install --frozen-lockfile - - save_cache: - key: dependencies-{{ checksum "package.json" }} - paths: node_modules - - save_cache: - key: dependencies-example-{{ checksum "example/package.json" }} - paths: example/node_modules - - persist_to_workspace: - root: . - paths: . - - lint: - executor: default - steps: - - attach_project - - run: - name: Lint files - command: | - yarn lint - - typescript: - executor: default - steps: - - attach_project - - run: - name: Typecheck files - command: | - yarn typescript - - unit-tests: - executor: default - steps: - - attach_project - - run: - name: Run unit tests - command: | - yarn test --coverage - - store_artifacts: - path: coverage - destination: coverage - - build-package: - executor: default - steps: - - attach_project - - run: - name: Build package - command: | - yarn prepare - -workflows: - build-and-test: - jobs: - - install-dependencies - - lint: - requires: - - install-dependencies - - typescript: - requires: - - install-dependencies - - unit-tests: - requires: - - install-dependencies - - build-package: - requires: - - install-dependencies diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..dbff35d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,148 @@ +name: CI + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main, develop ] + +jobs: + install-dependencies: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '16' + cache: 'yarn' + + - name: Cache node modules + uses: actions/cache@v3 + with: + path: | + node_modules + example/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}- + ${{ runner.os }}-node- + + - name: Install dependencies + run: | + yarn install --cwd example --frozen-lockfile + yarn install --frozen-lockfile + + - name: Upload workspace + uses: actions/upload-artifact@v3 + with: + name: workspace + path: | + . + !node_modules/.cache + retention-days: 1 + + lint: + runs-on: ubuntu-latest + needs: install-dependencies + steps: + - name: Download workspace + uses: actions/download-artifact@v3 + with: + name: workspace + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '16' + + - name: Lint files + run: yarn lint + + typescript: + runs-on: ubuntu-latest + needs: install-dependencies + steps: + - name: Download workspace + uses: actions/download-artifact@v3 + with: + name: workspace + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '16' + + - name: Typecheck files + run: yarn typescript + + unit-tests: + runs-on: ubuntu-latest + needs: install-dependencies + steps: + - name: Download workspace + uses: actions/download-artifact@v3 + with: + name: workspace + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '16' + + - name: Run unit tests + run: yarn test --coverage + + - name: Upload coverage artifacts + uses: actions/upload-artifact@v3 + with: + name: coverage + path: coverage/ + retention-days: 30 + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + directory: ./coverage/ + fail_ci_if_error: false + + build-package: + runs-on: ubuntu-latest + needs: install-dependencies + steps: + - name: Download workspace + uses: actions/download-artifact@v3 + with: + name: workspace + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '16' + + - name: Build package + run: yarn prepare + + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: build + path: lib/ + retention-days: 30 + + # Summary job that depends on all other jobs + ci-complete: + runs-on: ubuntu-latest + needs: [lint, typescript, unit-tests, build-package] + if: always() + steps: + - name: Check all jobs status + run: | + if [[ "${{ needs.lint.result }}" == "failure" || "${{ needs.typescript.result }}" == "failure" || "${{ needs.unit-tests.result }}" == "failure" || "${{ needs.build-package.result }}" == "failure" ]]; then + echo "One or more jobs failed" + exit 1 + else + echo "All jobs completed successfully" + fi From 6e9d272afa31f46c65931c4eb502a672be9bdc6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Lavault?= Date: Fri, 5 Sep 2025 14:16:27 +0200 Subject: [PATCH 2/8] update download-artifact to v4 to fix deprecation issue --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbff35d..a05cb86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: yarn install --frozen-lockfile - name: Upload workspace - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: workspace path: | @@ -49,7 +49,7 @@ jobs: needs: install-dependencies steps: - name: Download workspace - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: workspace @@ -66,7 +66,7 @@ jobs: needs: install-dependencies steps: - name: Download workspace - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: workspace @@ -83,7 +83,7 @@ jobs: needs: install-dependencies steps: - name: Download workspace - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: workspace @@ -96,7 +96,7 @@ jobs: run: yarn test --coverage - name: Upload coverage artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: coverage path: coverage/ @@ -113,7 +113,7 @@ jobs: needs: install-dependencies steps: - name: Download workspace - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: workspace @@ -126,7 +126,7 @@ jobs: run: yarn prepare - name: Upload build artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: build path: lib/ From a07074f6a6829c0374ae1f34af81f36d735b9e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Lavault?= Date: Fri, 5 Sep 2025 14:18:52 +0200 Subject: [PATCH 3/8] update node version to 22 LTS --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/publish.yml | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a05cb86..ad34c78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '22' cache: 'yarn' - name: Cache node modules @@ -56,7 +56,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '22' - name: Lint files run: yarn lint @@ -73,7 +73,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '22' - name: Typecheck files run: yarn typescript @@ -90,7 +90,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '22' - name: Run unit tests run: yarn test --coverage @@ -120,7 +120,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '22' - name: Build package run: yarn prepare diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9d258ca..f130260 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,11 +7,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: '16.x' + node-version: '22.x' registry-url: 'https://registry.npmjs.org' - name: Install dependencies 🔧 run: yarn install --frozen-lockfile From ee153cddf67b644b6aea9df7944a122d32efd587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Lavault?= Date: Fri, 5 Sep 2025 14:22:54 +0200 Subject: [PATCH 4/8] make sure deps are installed before building --- .github/workflows/ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad34c78..5701bfe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,6 +57,10 @@ jobs: uses: actions/setup-node@v4 with: node-version: '22' + cache: 'yarn' + + - name: Install root dependencies + run: yarn install --frozen-lockfile - name: Lint files run: yarn lint @@ -74,6 +78,10 @@ jobs: uses: actions/setup-node@v4 with: node-version: '22' + cache: 'yarn' + + - name: Install root dependencies + run: yarn install --frozen-lockfile - name: Typecheck files run: yarn typescript @@ -91,6 +99,10 @@ jobs: uses: actions/setup-node@v4 with: node-version: '22' + cache: 'yarn' + + - name: Install root dependencies + run: yarn install --frozen-lockfile - name: Run unit tests run: yarn test --coverage @@ -121,6 +133,10 @@ jobs: uses: actions/setup-node@v4 with: node-version: '22' + cache: 'yarn' + + - name: Install root dependencies + run: yarn install --frozen-lockfile - name: Build package run: yarn prepare From 01d4e11bcd8e4bf63f6e35a6a587e8190f73722c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Lavault?= Date: Fri, 5 Sep 2025 14:26:17 +0200 Subject: [PATCH 5/8] fix: typescript compilation --- tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 6d6372a..2553611 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,6 @@ "allowUnreachableCode": false, "allowUnusedLabels": false, "esModuleInterop": true, - "importsNotUsedAsValues": "error", "forceConsistentCasingInFileNames": true, "jsx": "react", "lib": ["esnext"], @@ -24,5 +23,6 @@ "skipLibCheck": true, "strict": true, "target": "esnext" - } + }, + "exclude": ["example"] } From 59e17d1e7ea65b7005355f2ff4ba387cbe2ccc49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Lavault?= Date: Fri, 5 Sep 2025 14:28:41 +0200 Subject: [PATCH 6/8] feat: use cached dependencies --- .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5701bfe..fdfe177 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,13 +2,15 @@ name: CI on: push: - branches: [ main, develop ] + branches: [main, develop] pull_request: - branches: [ main, develop ] + branches: [main, develop] jobs: install-dependencies: runs-on: ubuntu-latest + outputs: + cache-hit: ${{ steps.cache-deps.outputs.cache-hit }} steps: - name: Checkout uses: actions/checkout@v4 @@ -19,18 +21,19 @@ jobs: node-version: '22' cache: 'yarn' - - name: Cache node modules + - name: Cache dependencies + id: cache-deps uses: actions/cache@v3 with: path: | node_modules example/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-deps-${{ hashFiles('yarn.lock', 'example/yarn.lock') }} restore-keys: | - ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}- - ${{ runner.os }}-node- + ${{ runner.os }}-deps- - name: Install dependencies + if: steps.cache-deps.outputs.cache-hit != 'true' run: | yarn install --cwd example --frozen-lockfile yarn install --frozen-lockfile @@ -42,6 +45,7 @@ jobs: path: | . !node_modules/.cache + !example/node_modules/.cache retention-days: 1 lint: @@ -59,8 +63,15 @@ jobs: node-version: '22' cache: 'yarn' - - name: Install root dependencies - run: yarn install --frozen-lockfile + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: | + node_modules + example/node_modules + key: ${{ runner.os }}-deps-${{ hashFiles('yarn.lock', 'example/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-deps- - name: Lint files run: yarn lint @@ -80,8 +91,15 @@ jobs: node-version: '22' cache: 'yarn' - - name: Install root dependencies - run: yarn install --frozen-lockfile + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: | + node_modules + example/node_modules + key: ${{ runner.os }}-deps-${{ hashFiles('yarn.lock', 'example/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-deps- - name: Typecheck files run: yarn typescript @@ -101,8 +119,15 @@ jobs: node-version: '22' cache: 'yarn' - - name: Install root dependencies - run: yarn install --frozen-lockfile + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: | + node_modules + example/node_modules + key: ${{ runner.os }}-deps-${{ hashFiles('yarn.lock', 'example/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-deps- - name: Run unit tests run: yarn test --coverage @@ -135,8 +160,15 @@ jobs: node-version: '22' cache: 'yarn' - - name: Install root dependencies - run: yarn install --frozen-lockfile + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: | + node_modules + example/node_modules + key: ${{ runner.os }}-deps-${{ hashFiles('yarn.lock', 'example/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-deps- - name: Build package run: yarn prepare From a7bd964ddabbcb43e09c3994f9bd03d4e044d81d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Lavault?= Date: Fri, 5 Sep 2025 14:33:57 +0200 Subject: [PATCH 7/8] fix: allow jest to pass with no test in the codebase --- .gitignore | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e932d1c..c609cb1 100644 --- a/.gitignore +++ b/.gitignore @@ -66,4 +66,7 @@ android/keystores/debug.keystore # generated by bob lib/ +# coverage reports +coverage/ + .xcode.env.local diff --git a/package.json b/package.json index ab06546..b64b511 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "!**/__mocks__" ], "scripts": { - "test": "jest", + "test": "jest --passWithNoTests", "typescript": "tsc --noEmit", "lint": "eslint \"**/*.{js,ts,tsx}\"", "prepare": "bob build", From a9ec8514450f1cf428cf59ad471b6624940fa3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Lavault?= Date: Fri, 5 Sep 2025 14:39:29 +0200 Subject: [PATCH 8/8] fix: linting --- example/index.tsx | 2 +- example/src/App.tsx | 2 +- package.json | 3 ++- src/ShadowedView.android.tsx | 5 +++-- src/utils.ts | 1 + 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/example/index.tsx b/example/index.tsx index 45fce45..14cf100 100644 --- a/example/index.tsx +++ b/example/index.tsx @@ -1,4 +1,4 @@ -import {AppRegistry} from 'react-native'; +import { AppRegistry } from 'react-native'; import App from './src/App'; AppRegistry.registerComponent('main', () => App); diff --git a/example/src/App.tsx b/example/src/App.tsx index bbff416..2731a40 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -32,7 +32,7 @@ export default function App() { -1, true ); - }, []); + }, [animatedHeight, animatedWidth]); const animatedStyle = useAnimatedStyle(() => ({ width: `${animatedWidth.value}%`, diff --git a/package.json b/package.json index b64b511..df56cd8 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,8 @@ }, "eslintIgnore": [ "node_modules/", - "lib/" + "lib/", + "coverage/" ], "prettier": { "quoteProps": "consistent", diff --git a/src/ShadowedView.android.tsx b/src/ShadowedView.android.tsx index 10be7d9..60cfeec 100644 --- a/src/ShadowedView.android.tsx +++ b/src/ShadowedView.android.tsx @@ -1,11 +1,12 @@ import React from 'react'; import { I18nManager, - StyleProp, StyleSheet, + StyleProp, // eslint-disable-line @typescript-eslint/no-unused-vars ViewProps, - ViewStyle, + ViewStyle, // eslint-disable-line @typescript-eslint/no-unused-vars } from 'react-native'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars import { FastShadowView, FastShadowViewProps } from './FastShadowView'; export class ShadowedView extends React.Component { diff --git a/src/utils.ts b/src/utils.ts index a9c0d1d..21a7185 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars import { ColorValue, Platform, ViewStyle } from 'react-native'; export type ShadowParams = {