From 437a52d3895795095a05d151f1d73c9451c388b0 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Wed, 7 May 2025 22:51:11 -0700 Subject: [PATCH 01/28] chore: add GitHub Actions setup and CI workflow for Node.js project, including dependency installation, type checking, linting, and testing --- .github/actions/setup/action.yml | 27 ++++++ .github/workflows/test.yml | 144 +++++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 .github/actions/setup/action.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..d674830 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,27 @@ +name: Setup +description: Setup Node.js and install dependencies + +runs: + using: composite + steps: + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + + - name: Cache dependencies + id: yarn-cache + uses: actions/cache@v3 + with: + path: | + **/node_modules + .yarn/install-state.gz + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }} + restore-keys: | + ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + ${{ runner.os }}-yarn- + + - name: Install dependencies + if: steps.yarn-cache.outputs.cache-hit != 'true' + run: yarn install --immutable + shell: bash \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..71ffdd7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,144 @@ +name: CI +on: + push: + branches: + - main + pull_request: + branches: + - main + merge_group: + types: + - checks_requested + +jobs: + # dependency-review: + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + + # - name: Dependency Review + # uses: actions/dependency-review-action@v3 + # with: + # fail-on-severity: high + + # security-scan: + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + + # - name: Run Snyk to check for vulnerabilities + # uses: snyk/actions/node@master + # env: + # SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + # with: + # args: --severity-threshold=high + + type-check: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup + + - name: Type check + run: yarn tsc --noEmit + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup + + - name: Lint files + run: yarn lint + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup + + - name: Run unit tests with coverage + run: yarn test:coverage --maxWorkers=2 + + - name: Check coverage thresholds + run: | + COVERAGE_THRESHOLD=80 + COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct') + if (( $(echo "$COVERAGE < $COVERAGE_THRESHOLD" | bc -l) )); then + echo "Coverage ($COVERAGE%) is below threshold ($COVERAGE_THRESHOLD%)" + exit 1 + fi + echo "Coverage ($COVERAGE%) is above threshold ($COVERAGE_THRESHOLD%)" + + - name: Upload coverage to Code Climate + uses: paambaati/codeclimate-action@v9.0.0 + env: + CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_KEY }} + with: + coverageCommand: yarn test:coverage --coverageReporters lcov + coverageLocations: | + ${{github.workspace}}/coverage/lcov.info:lcov + # - name: Upload coverage to Codecov + # uses: codecov/codecov-action@v4 + # with: + # token: ${{ secrets.CODECOV_TOKEN }} + # directory: ./coverage/ + # flags: unittests + # name: codecov-umbrella + # fail_ci_if_error: true + + test-comment: + name: Unit tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup + + - name: Run tests + run: | + yarn test:coverage --coverageReporters json-summary + + - name: Test coverage comment + id: coverageComment + uses: MishaKav/jest-coverage-comment@main + with: + hide-comment: false + coverage-summary-path: ./coverage/coverage-summary.json + + build-library: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup + + - name: Build package + run: yarn prepare + + misspell: + name: runner / misspell + runs-on: ubuntu-latest + steps: + - name: Check out code. + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: misspell + uses: reviewdog/action-misspell@9daa94af4357dddb6fd3775de806bc0a8e98d3e4 # v1.26.3 + with: + github_token: ${{ secrets.github_token }} + locale: 'US' From 35f3f5de2ac80b3c1956baa1eac69f6a241747b8 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Wed, 7 May 2025 22:55:02 -0700 Subject: [PATCH 02/28] chore: update pull request template to use placeholder text for screenshots instead of actual image links --- .github/pull_request_template.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 2a72cda..22bafbb 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -12,8 +12,7 @@ Screenshots if the PR has visual changes. | android | ios | |--------|--------| -| Screenshot 2025-03-27 at 9 11 22 PM | Screenshot 2025-03-27 at 9 11 22 PM | -| Screenshot 2025-03-27 at 9 11 22 PM | Screenshot 2025-03-27 at 9 11 22 PM | +| ANDROID_SCREENSHOT | IOS_SCREENSHOT | ## 🧐 Testing From 371b3597e0a3a595f6fd75ba322869cd3e011a1e Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Wed, 7 May 2025 23:00:06 -0700 Subject: [PATCH 03/28] chore: refine pull request template by adding a space for clarity in the testing section --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 22bafbb..1508909 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -16,7 +16,7 @@ Screenshots if the PR has visual changes. ## 🧐 Testing -Please explain the steps needed to verify your change. +Please explain the steps needed to verify your change. ## 📝 Documentation From eed96e9d8378e42afd47c5d72aa01a591856e430 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Wed, 7 May 2025 23:07:12 -0700 Subject: [PATCH 04/28] docs: add code coverage badge to README for improved visibility of test results --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index df1d8de..ebb9484 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![@iterable/expo-plugin](./assets/Iterable-Logo.png "@iterable/expo-plugin") # @iterable/expo-plugin - +[![code coverage](https://github.com/Iterable/iterable-expo-plugin/actions/workflows/test.yml/badge.svg)](https://github.com/Iterable/iterable-expo-plugin/actions/workflows/test.yml) This config plugin automatically configures your Expo app to work with [@iterable/react-native-sdk](https://github.com/Iterable/react-native-sdk) when @@ -341,4 +341,4 @@ For support, please: ## 📚 Further Reading - [Installing Iterables React Native SDK](https://support.iterable.com/hc/en-us/articles/360045714132-Installing-Iterable-s-React-Native-SDK#step-3-7-add-support-for-deep-links) -- [Expo docs](https://docs.expo.dev/) \ No newline at end of file +- [Expo docs](https://docs.expo.dev/) From 43aff7d60ebba6831760e7933a27ee930728bfb0 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Wed, 7 May 2025 23:16:46 -0700 Subject: [PATCH 05/28] chore: add CI workflow for library build, type checking, linting, and misspell checks --- .github/workflows/build-library.yml | 84 +++++++++++++++++++++++ .github/workflows/test.yml | 100 ++-------------------------- 2 files changed, 91 insertions(+), 93 deletions(-) create mode 100644 .github/workflows/build-library.yml diff --git a/.github/workflows/build-library.yml b/.github/workflows/build-library.yml new file mode 100644 index 0000000..1d82848 --- /dev/null +++ b/.github/workflows/build-library.yml @@ -0,0 +1,84 @@ +name: CI +on: + push: + branches: + - main + pull_request: + branches: + - main + merge_group: + types: + - checks_requested + +jobs: + # dependency-review: + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + + # - name: Dependency Review + # uses: actions/dependency-review-action@v3 + # with: + # fail-on-severity: high + + # security-scan: + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + + # - name: Run Snyk to check for vulnerabilities + # uses: snyk/actions/node@master + # env: + # SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + # with: + # args: --severity-threshold=high + + type-check: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup + + - name: Type check + run: yarn tsc --noEmit + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup + + - name: Lint files + run: yarn lint + + build-library: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup + + - name: Build package + run: yarn prepare + + misspell: + name: runner / misspell + runs-on: ubuntu-latest + steps: + - name: Check out code. + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: misspell + uses: reviewdog/action-misspell@9daa94af4357dddb6fd3775de806bc0a8e98d3e4 # v1.26.3 + with: + github_token: ${{ secrets.github_token }} + locale: 'US' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 71ffdd7..4128d50 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,54 +11,6 @@ on: - checks_requested jobs: - # dependency-review: - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v3 - - # - name: Dependency Review - # uses: actions/dependency-review-action@v3 - # with: - # fail-on-severity: high - - # security-scan: - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v3 - - # - name: Run Snyk to check for vulnerabilities - # uses: snyk/actions/node@master - # env: - # SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} - # with: - # args: --severity-threshold=high - - type-check: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup - uses: ./.github/actions/setup - - - name: Type check - run: yarn tsc --noEmit - - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup - uses: ./.github/actions/setup - - - name: Lint files - run: yarn lint - test: runs-on: ubuntu-latest steps: @@ -89,6 +41,13 @@ jobs: coverageCommand: yarn test:coverage --coverageReporters lcov coverageLocations: | ${{github.workspace}}/coverage/lcov.info:lcov + + - name: Test coverage comment + id: coverageComment + uses: MishaKav/jest-coverage-comment@main + with: + hide-comment: false + coverage-summary-path: ./coverage/coverage-summary.json # - name: Upload coverage to Codecov # uses: codecov/codecov-action@v4 # with: @@ -97,48 +56,3 @@ jobs: # flags: unittests # name: codecov-umbrella # fail_ci_if_error: true - - test-comment: - name: Unit tests - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Setup - uses: ./.github/actions/setup - - - name: Run tests - run: | - yarn test:coverage --coverageReporters json-summary - - - name: Test coverage comment - id: coverageComment - uses: MishaKav/jest-coverage-comment@main - with: - hide-comment: false - coverage-summary-path: ./coverage/coverage-summary.json - - build-library: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup - uses: ./.github/actions/setup - - - name: Build package - run: yarn prepare - - misspell: - name: runner / misspell - runs-on: ubuntu-latest - steps: - - name: Check out code. - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: misspell - uses: reviewdog/action-misspell@9daa94af4357dddb6fd3775de806bc0a8e98d3e4 # v1.26.3 - with: - github_token: ${{ secrets.github_token }} - locale: 'US' From 5bc10b0fa05600cbf10deeafc20630aa7dc4fdce Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Wed, 7 May 2025 23:20:41 -0700 Subject: [PATCH 06/28] docs: update code coverage badge in README to reflect Code Climate integration --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ebb9484..d36a446 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![@iterable/expo-plugin](./assets/Iterable-Logo.png "@iterable/expo-plugin") # @iterable/expo-plugin -[![code coverage](https://github.com/Iterable/iterable-expo-plugin/actions/workflows/test.yml/badge.svg)](https://github.com/Iterable/iterable-expo-plugin/actions/workflows/test.yml) +[![Code Climate coverage](https://codeclimate.com/github/Iterable/iterable-expo-plugin/badges/coverage.svg)](https://codeclimate.com/github/Iterable/iterable-expo-plugin) This config plugin automatically configures your Expo app to work with [@iterable/react-native-sdk](https://github.com/Iterable/react-native-sdk) when From 40d5826edd7945b8e0cac74f9de13b05b4588c10 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Wed, 7 May 2025 23:23:29 -0700 Subject: [PATCH 07/28] docs: update coverage badge in README to a more descriptive format --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d36a446..b5ba72e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![@iterable/expo-plugin](./assets/Iterable-Logo.png "@iterable/expo-plugin") # @iterable/expo-plugin -[![Code Climate coverage](https://codeclimate.com/github/Iterable/iterable-expo-plugin/badges/coverage.svg)](https://codeclimate.com/github/Iterable/iterable-expo-plugin) +[![Coverage](https://img.shields.io/badge/coverage-80%25-brightgreen)](https://github.com/Iterable/iterable-expo-plugin/actions/workflows/test.yml) This config plugin automatically configures your Expo app to work with [@iterable/react-native-sdk](https://github.com/Iterable/react-native-sdk) when From bf073d139f3e94ee725dc60544aac991963e6060 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Wed, 7 May 2025 23:37:11 -0700 Subject: [PATCH 08/28] docs: add license badge and Code Climate coverage badge to README for enhanced project visibility --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b5ba72e..5868f4d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ ![@iterable/expo-plugin](./assets/Iterable-Logo.png "@iterable/expo-plugin") # @iterable/expo-plugin +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Coverage](https://img.shields.io/badge/coverage-80%25-brightgreen)](https://github.com/Iterable/iterable-expo-plugin/actions/workflows/test.yml) +[![Code Climate coverage](https://codeclimate.com/github/Iterable/iterable-expo-plugin/badges/coverage.svg)](https://codeclimate.com/github/Iterable/iterable-expo-plugin) This config plugin automatically configures your Expo app to work with [@iterable/react-native-sdk](https://github.com/Iterable/react-native-sdk) when From fb9abdae8876b9ebc4dd470760ea0a1c2ae3cd15 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 00:18:54 -0700 Subject: [PATCH 09/28] ci: add coverage badge generation step in workflow and update README badge format for better clarity --- .github/workflows/test.yml | 6 ++++++ README.md | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4128d50..0fb6a4e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,6 +33,11 @@ jobs: fi echo "Coverage ($COVERAGE%) is above threshold ($COVERAGE_THRESHOLD%)" + - name: Generate coverage badge + run: | + COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct') + echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT + - name: Upload coverage to Code Climate uses: paambaati/codeclimate-action@v9.0.0 env: @@ -48,6 +53,7 @@ jobs: with: hide-comment: false coverage-summary-path: ./coverage/coverage-summary.json + # - name: Upload coverage to Codecov # uses: codecov/codecov-action@v4 # with: diff --git a/README.md b/README.md index 5868f4d..0bcf2d8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # @iterable/expo-plugin [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Coverage](https://img.shields.io/badge/coverage-80%25-brightgreen)](https://github.com/Iterable/iterable-expo-plugin/actions/workflows/test.yml) +[![Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/your-username/your-gist-id/raw/coverage.json)](https://github.com/Iterable/iterable-expo-plugin/actions/workflows/test.yml) [![Code Climate coverage](https://codeclimate.com/github/Iterable/iterable-expo-plugin/badges/coverage.svg)](https://codeclimate.com/github/Iterable/iterable-expo-plugin) This config plugin automatically configures your Expo app to work with From 5b128adbc2fec58c0bd59357d403018d6053d067 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 00:44:54 -0700 Subject: [PATCH 10/28] ci: add output for coverage step in workflow to improve CI reporting --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0fb6a4e..69ad4ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,8 @@ on: jobs: test: runs-on: ubuntu-latest + outputs: + coverage: ${{ steps.coverage.outputs.coverage }} steps: - name: Checkout uses: actions/checkout@v3 @@ -33,7 +35,8 @@ jobs: fi echo "Coverage ($COVERAGE%) is above threshold ($COVERAGE_THRESHOLD%)" - - name: Generate coverage badge + - id: coverage + name: Generate coverage badge run: | COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct') echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT From b5e68f0540dc0161952791326da0e8bcd8fe7e4f Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 01:00:21 -0700 Subject: [PATCH 11/28] ci: reorder coverage badge generation step in workflow for improved clarity and consistency --- .github/workflows/coverage-badge.yml | 46 ++++++++++++++++++++++++++++ .github/workflows/test.yml | 12 ++++---- 2 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/coverage-badge.yml diff --git a/.github/workflows/coverage-badge.yml b/.github/workflows/coverage-badge.yml new file mode 100644 index 0000000..85585a0 --- /dev/null +++ b/.github/workflows/coverage-badge.yml @@ -0,0 +1,46 @@ +name: Coverage Badge + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_run: + workflows: ['CI'] + types: + - completed + +jobs: + update-badge: + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion == 'success' + steps: + - uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + run: yarn install + + - name: Run tests with coverage + run: yarn test:coverage --coverageReporters json-summary + + - name: Generate coverage badge + run: | + COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct') + echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT + + - name: Update coverage badge + uses: schneegans/dynamic-badges-action@v1.6.0 + with: + auth: ${{ secrets.GIST_SECRET }} + gistID: your-gist-id + filename: coverage.json + label: coverage + message: ${{ steps.coverage.outputs.coverage }}% + color: green diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 69ad4ee..6364028 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,12 +35,6 @@ jobs: fi echo "Coverage ($COVERAGE%) is above threshold ($COVERAGE_THRESHOLD%)" - - id: coverage - name: Generate coverage badge - run: | - COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct') - echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT - - name: Upload coverage to Code Climate uses: paambaati/codeclimate-action@v9.0.0 env: @@ -57,6 +51,12 @@ jobs: hide-comment: false coverage-summary-path: ./coverage/coverage-summary.json + - id: coverage + name: Generate coverage badge + run: | + COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct') + echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT + # - name: Upload coverage to Codecov # uses: codecov/codecov-action@v4 # with: From e0b534ad1fca80c226953c19eca1bc043cb1e450 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 01:06:30 -0700 Subject: [PATCH 12/28] ci: fix output redirection syntax in coverage badge generation step for consistency --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6364028..c0023a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,7 +55,7 @@ jobs: name: Generate coverage badge run: | COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct') - echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT + echo "coverage=$COVERAGE" >> "$GITHUB_OUTPUT" # - name: Upload coverage to Codecov # uses: codecov/codecov-action@v4 From 414f5148a109b95e790df208a741d33de25ce8ae Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 14:16:32 -0700 Subject: [PATCH 13/28] ci: integrate QLTY coverage reporting in workflow and remove Codecov step for streamlined coverage management --- .github/workflows/test.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c0023a1..61f7667 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,6 +44,11 @@ jobs: coverageLocations: | ${{github.workspace}}/coverage/lcov.info:lcov + - name: Add coverage to QLTY + uses: qltysh/qlty-action/coverage@v1 + with: + token: { { secrets.QLTY_COVERAGE_TOKEN } } + files: coverage/lcov.info - name: Test coverage comment id: coverageComment uses: MishaKav/jest-coverage-comment@main @@ -56,12 +61,3 @@ jobs: run: | COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct') echo "coverage=$COVERAGE" >> "$GITHUB_OUTPUT" - - # - name: Upload coverage to Codecov - # uses: codecov/codecov-action@v4 - # with: - # token: ${{ secrets.CODECOV_TOKEN }} - # directory: ./coverage/ - # flags: unittests - # name: codecov-umbrella - # fail_ci_if_error: true From c4d812111185a894981fc1730903637fe93f57ae Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 14:29:14 -0700 Subject: [PATCH 14/28] ci: update GitHub Actions checkout action to v4 and fix token syntax for QLTY coverage reporting --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 61f7667..4ca2130 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: coverage: ${{ steps.coverage.outputs.coverage }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup uses: ./.github/actions/setup @@ -47,7 +47,7 @@ jobs: - name: Add coverage to QLTY uses: qltysh/qlty-action/coverage@v1 with: - token: { { secrets.QLTY_COVERAGE_TOKEN } } + token: ${{ secrets.QLTY_COVERAGE_TOKEN }} files: coverage/lcov.info - name: Test coverage comment id: coverageComment From b22197360ef13f907097c7c6abd2e88461433cc4 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 14:33:10 -0700 Subject: [PATCH 15/28] ci: update GitHub Actions to use checkout and setup-node actions at version 4 --- .github/workflows/build-library.yml | 10 +++++----- .github/workflows/coverage-badge.yml | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-library.yml b/.github/workflows/build-library.yml index 1d82848..ff1e396 100644 --- a/.github/workflows/build-library.yml +++ b/.github/workflows/build-library.yml @@ -15,7 +15,7 @@ jobs: # runs-on: ubuntu-latest # steps: # - name: Checkout - # uses: actions/checkout@v3 + # uses: actions/checkout@v4 # - name: Dependency Review # uses: actions/dependency-review-action@v3 @@ -26,7 +26,7 @@ jobs: # runs-on: ubuntu-latest # steps: # - name: Checkout - # uses: actions/checkout@v3 + # uses: actions/checkout@v4 # - name: Run Snyk to check for vulnerabilities # uses: snyk/actions/node@master @@ -39,7 +39,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup uses: ./.github/actions/setup @@ -51,7 +51,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup uses: ./.github/actions/setup @@ -63,7 +63,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup uses: ./.github/actions/setup diff --git a/.github/workflows/coverage-badge.yml b/.github/workflows/coverage-badge.yml index 85585a0..0060cd6 100644 --- a/.github/workflows/coverage-badge.yml +++ b/.github/workflows/coverage-badge.yml @@ -17,10 +17,10 @@ jobs: runs-on: ubuntu-latest if: github.event.workflow_run.conclusion == 'success' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '18' From 56bf046f8ef2a5e4ed4fc967318228e827ff2c6c Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 14:38:38 -0700 Subject: [PATCH 16/28] ci: add permissions to GitHub Actions workflows for improved functionality --- .github/workflows/build-library.yml | 5 +++++ .github/workflows/coverage-badge.yml | 5 +++++ .github/workflows/test.yml | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/.github/workflows/build-library.yml b/.github/workflows/build-library.yml index ff1e396..ee0bafa 100644 --- a/.github/workflows/build-library.yml +++ b/.github/workflows/build-library.yml @@ -10,6 +10,11 @@ on: types: - checks_requested +permissions: + contents: read # Required for checking out code + checks: write # Required for updating check status + security-events: write # Required for security scanning + jobs: # dependency-review: # runs-on: ubuntu-latest diff --git a/.github/workflows/coverage-badge.yml b/.github/workflows/coverage-badge.yml index 0060cd6..55d730e 100644 --- a/.github/workflows/coverage-badge.yml +++ b/.github/workflows/coverage-badge.yml @@ -12,6 +12,10 @@ on: types: - completed +permissions: + contents: write # Required for updating the coverage badge + checks: write # Required for updating check status + jobs: update-badge: runs-on: ubuntu-latest @@ -31,6 +35,7 @@ jobs: run: yarn test:coverage --coverageReporters json-summary - name: Generate coverage badge + id: coverage run: | COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct') echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4ca2130..122b668 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,10 @@ on: types: - checks_requested +permissions: + contents: read # Required for checking out code + checks: write # Required for updating check status + jobs: test: runs-on: ubuntu-latest From 3e71ad0df47d274c860b3e981442da3a04665acb Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 15:02:15 -0700 Subject: [PATCH 17/28] docs: update README and pull request template formatting, as per qlty --- .github/pull_request_template.md | 6 +- README.md | 186 ++++++++++++++++++------------- 2 files changed, 113 insertions(+), 79 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 1508909..c710f4f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -10,13 +10,13 @@ Please explain the changes you made Screenshots if the PR has visual changes. -| android | ios | -|--------|--------| +| android | ios | +| ------------------ | -------------- | | ANDROID_SCREENSHOT | IOS_SCREENSHOT | ## 🧐 Testing -Please explain the steps needed to verify your change. +Please explain the steps needed to verify your change. ## 📝 Documentation diff --git a/README.md b/README.md index 0bcf2d8..88b3df4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -![@iterable/expo-plugin](./assets/Iterable-Logo.png "@iterable/expo-plugin") +![@iterable/expo-plugin](./assets/Iterable-Logo.png '@iterable/expo-plugin') + # @iterable/expo-plugin [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) @@ -9,7 +10,6 @@ This config plugin automatically configures your Expo app to work with [@iterable/react-native-sdk](https://github.com/Iterable/react-native-sdk) when the native code is generated through `expo prebuild`. - @@ -35,48 +35,58 @@ the native code is generated through `expo prebuild`. - ## 🚀 Quick Start 1. Install the plugin and `@iterable/react-native-sdk` by running the following in your terminal: - ```bash - npx expo install @iterable/expo-plugin @iterable/react-native-sdk - ``` + + ```bash + npx expo install @iterable/expo-plugin @iterable/react-native-sdk + ``` + 2. Add the plugin to to your `app.json` or `app.config.js` - ```json - { - "expo": { - "plugins": [ - ["@iterable/expo-plugin", {}] - ] - } - } - ``` + + ```json + { + "expo": { + "plugins": [["@iterable/expo-plugin", {}]] + } + } + ``` + 3. After installing and configuring the plugin, rebuild your native projects: - ```bash - npx expo prebuild --clean - ``` - **WARNING**: `prebuild` will delete everything in your ios/android directories. + + ```bash + npx expo prebuild --clean + ``` + + **WARNING**: `prebuild` will delete everything in your ios/android directories. + 4. Run your ios or android simulator: - - ios: - ```bash - npx expo run:ios - ``` - - android: - ```bash - npx expo run:android - ``` -5. Import `@iterable/react-native-sdk` and use as needed. EG: - ```tsx - import {useEffect} from 'react'; - import {Iterable, IterableConfig} from '@iterable/react-native-sdk'; - - const App = () => { - useEffect(() => { - Iterable.initialize('MY_API_KEY', new IterableConfig()); - }, []); - } - ``` + + - ios: + + ```bash + npx expo run:ios + ``` + + - android: + + ```bash + npx expo run:android + ``` + +5. Import `@iterable/react-native-sdk` and use as needed. EG: + + ```tsx + import { useEffect } from 'react'; + import { Iterable, IterableConfig } from '@iterable/react-native-sdk'; + + const App = () => { + useEffect(() => { + Iterable.initialize('MY_API_KEY', new IterableConfig()); + }, []); + }; + ``` ## 🔧 Configuration @@ -86,12 +96,15 @@ Add the plugin to your `app.json` or `app.config.js`: { "expo": { "plugins": [ - ["@iterable/expo-plugin", { - "appEnvironment": "development", - "autoConfigurePushNotifications": true, - "enableTimeSensitivePush": true, - "requestPermissionsForPushNotifications": true, - }] + [ + "@iterable/expo-plugin", + { + "appEnvironment": "development", + "autoConfigurePushNotifications": true, + "enableTimeSensitivePush": true, + "requestPermissionsForPushNotifications": true + } + ] ] } } @@ -99,15 +112,16 @@ Add the plugin to your `app.json` or `app.config.js`: ### Plugin Options -| Option | Type | Default | Description | -|--------|------|---------|-------------| -| `appEnvironment` | `'development'` \| `'production'` | `'development'` | The environment of your app | -| `autoConfigurePushNotifications` | boolean | `true` | Whether to automatically configure push notifications. Set to `false` if you want to configure push notifications manually.

**WARNING**: Iterable cannot guarantee compatibility with custom push notification configurations. | -| `enableTimeSensitivePush` | boolean | `true` | Whether to enable time-sensitive push notifications (iOS only) | -| `requestPermissionsForPushNotifications` | boolean | `false` | Whether to request permissions for push notifications (iOS only) | +| Option | Type | Default | Description | +| ---------------------------------------- | --------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `appEnvironment` | `'development'` \| `'production'` | `'development'` | The environment of your app | +| `autoConfigurePushNotifications` | boolean | `true` | Whether to automatically configure push notifications. Set to `false` if you want to configure push notifications manually.

**WARNING**: Iterable cannot guarantee compatibility with custom push notification configurations. | +| `enableTimeSensitivePush` | boolean | `true` | Whether to enable time-sensitive push notifications (iOS only) | +| `requestPermissionsForPushNotifications` | boolean | `false` | Whether to request permissions for push notifications (iOS only) | ### Disabling New Architecture -`@iterable/react-native-sdk` is *NOT* compatible with Reacts New Architecture, + +`@iterable/react-native-sdk` is _NOT_ compatible with Reacts New Architecture, so this needs to be disabled in your `app.json`: ```json @@ -120,16 +134,18 @@ so this needs to be disabled in your `app.json`: ### Adding push capabilities -#### iOS +#### iOS + - [Configure push notifications for iOS in Iterable](https://support.iterable.com/hc/en-us/articles/115000315806-Setting-up-iOS-Push-Notifications) #### Android - [Configure push notifications for Android in Iterable](https://support.iterable.com/hc/en-us/articles/115000331943-Setting-up-Android-Push-Notifications) -- Place your `google-services.json` file in the root of the *example* +- Place your `google-services.json` file in the root of the _example_ directory - In `app.json`, add the path to the `google-services.json` file to - `expo.android.googleServicesFile`. EG: + `expo.android.googleServicesFile`. EG: + ```json { "expo": { @@ -140,28 +156,30 @@ so this needs to be disabled in your `app.json`: } ``` -### Adding Deeplinks +### Adding Deeplinks Deep linking allows users to navigate to specific screens in your app using URLs. To set up deep linking in your **Expo** application, [configure deep links in Iterable](https://support.iterable.com/hc/en-us/articles/115002651226-Configuring-Deep-Links-for-Email-or-SMS), -then follow the below instructions. +then follow the below instructions. #### iOS + To add deeplinks to your Expo app for use with Iterable on iOS devices, add associated domains to your `app.json` under the iOS configuration. -EG: +EG: + ```json { "expo": { "ios": { "associatedDomains": [ - "applinks:expo.dev", - "applinks:iterable.com", - "applinks:links.anotherone.com" - ] + "applinks:expo.dev", + "applinks:iterable.com", + "applinks:links.anotherone.com" + ] } } } @@ -175,11 +193,13 @@ See further documentation about how expo setup of iOS Universal Links [here](https://docs.expo.dev/linking/ios-universal-links/). #### Android + To add deeplinks to your Expo app for use with Iterable on Android devices, add URL schemes and intent filters to your `app.json` under the Android -configuration. These would be in `expo.android.intentFilters`. +configuration. These would be in `expo.android.intentFilters`. EG: + ```json { "expo": { @@ -188,7 +208,7 @@ EG: { "action": "MAIN", "category": ["LAUNCHER"], - "autoVerify": true, + "autoVerify": true }, { "action": "VIEW", @@ -213,21 +233,26 @@ See further documentation about how expo setup of Android App Links [here](https://docs.expo.dev/linking/android-app-links/). ### Configuring [ProGuard](https://reactnative.dev/docs/signed-apk-android#enabling-proguard-to-reduce-the-size-of-the-apk-optional) + If you're using ProGuard when building your Android app, you will need to add this line of ProGuard configuration to your build: `-keep class org.json.** { *; }`. Below is how to do this using Expo: + 1. Add the [expo-build-properties](https://www.npmjs.com/package/expo-build-properties) - plugin by running: - ```bash - npx expo install expo-build-properties - ``` -2. Add the plugin to your *app.json* file + plugin by running: + + ```bash + npx expo install expo-build-properties + ``` + +2. Add the plugin to your _app.json_ file 3. To the plugin options, add `{"android":{"extraProguardRules":"-keep class org.json.** { *; }"}}` -The overall code in your *app.json* file should look something like this: +The overall code in your _app.json_ file should look something like this: + ```json { "expo": { @@ -250,18 +275,18 @@ Learn more in the [Configure Proguard](https://support.iterable.com/hc/en-us/art ## ✅ Requirements and Limitations - New Architecture needs to be disabled, as `@iterable/react-native-sdk` does - not support it. See [Disabling New Architecture](#disabling-new-architecture) + not support it. See [Disabling New Architecture](#disabling-new-architecture) for instructions on how to disable it. - Your expo app needs to be run as a [development build](https://docs.expo.dev/develop/development-builds/introduction/) instead - of through Expo Go. Both + of through Expo Go. Both `@iterable/iterable-expo-plugin` and `@iterable/react-native-sdk` will **NOT** work in Expo Go as they are reliant on native code, which Expo Go [does not support](https://expo.dev/blog/expo-go-vs-development-builds#expo-go-limitations). - `@iterable/iterable-expo-plugin` is intended for managed workflows, and will - overwrite the files in your `ios` and `android` directories. Any manual - changes to those directories will be overwritten on the next build. -- This plugin has been tested on Expo version 52+. While it may work on + overwrite the files in your `ios` and `android` directories. Any manual + changes to those directories will be overwritten on the next build. +- This plugin has been tested on Expo version 52+. While it may work on previous versions, they are not supported. ## 🎉 Features @@ -271,12 +296,14 @@ Learn more in the [Configure Proguard](https://support.iterable.com/hc/en-us/art The plugin automatically configures push notifications for both iOS and Android platforms. #### iOS + - Adds bridge to native Iterable code - Sets up notification service extension - Configures required entitlements - Handles notification permissions #### Android + - Adds bridge to native Iterable code - Configures Firebase integration - Sets up notification handling @@ -287,10 +314,12 @@ The plugin automatically configures push notifications for both iOS and Android The plugin configures deep linking capabilities for both platforms. #### iOS + - Sets up Universal Links - Configures associated domains #### Android + - Configures App Links - Sets up intent filters @@ -301,6 +330,7 @@ The plugin configures deep linking capabilities for both platforms. If you encounter the error "Your JavaScript code tried to access a native module that doesn't exist in this development client", try: 1. Clean your project: + ```bash rm -rf node_modules rm -rf ios/Pods @@ -308,11 +338,13 @@ yarn cache clean ``` 2. Reinstall dependencies: + ```bash yarn install ``` 3. Rebuild native projects: + ```bash npx expo prebuild --clean cd ios && pod install && cd .. @@ -320,8 +352,8 @@ cd ios && pod install && cd .. ### Failed to delete [ios|android] code: ENOTEMPTY: directory not empty -Sometimes this error appears when running `npx expo prebuild --clean`. It seems -to be an intermittent bug within expo. It usually works upon running the same +Sometimes this error appears when running `npx expo prebuild --clean`. It seems +to be an intermittent bug within expo. It usually works upon running the same command a second time, so just try again. ## 👏 Contributing @@ -336,11 +368,13 @@ for details. ## 💬 Support For support, please: + 1. Check the [documentation](https://github.com/Iterable/iterable-expo-plugin#readme) 2. Open an [issue](https://github.com/Iterable/iterable-expo-plugin/issues) 3. Contact [Iterable support](https://support.iterable.com/hc/en-us/requests/new) ## 📚 Further Reading + - [Installing Iterables React Native SDK](https://support.iterable.com/hc/en-us/articles/360045714132-Installing-Iterable-s-React-Native-SDK#step-3-7-add-support-for-deep-links) - [Expo docs](https://docs.expo.dev/) From 830e1b85285a762cb71af809b05b188e8da6f3f3 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 15:05:06 -0700 Subject: [PATCH 18/28] fix: add missing newlines at the end of action.yml and google-services.json files --- .github/actions/setup/action.yml | 2 +- plugin/__mocks__/google-services.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index d674830..6a31108 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -24,4 +24,4 @@ runs: - name: Install dependencies if: steps.yarn-cache.outputs.cache-hit != 'true' run: yarn install --immutable - shell: bash \ No newline at end of file + shell: bash diff --git a/plugin/__mocks__/google-services.json b/plugin/__mocks__/google-services.json index 1af9499..3ad2406 100644 --- a/plugin/__mocks__/google-services.json +++ b/plugin/__mocks__/google-services.json @@ -3,4 +3,4 @@ "project_number": "1234567890", "project_id": "test-project-id" } -} \ No newline at end of file +} From db2f4388caac1618dab7520245ceae523f897fdc Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 15:10:33 -0700 Subject: [PATCH 19/28] docs: update README to replace Code Climate badge with QLTY badges for coverage and maintainability --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 88b3df4..dfcfd6e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/your-username/your-gist-id/raw/coverage.json)](https://github.com/Iterable/iterable-expo-plugin/actions/workflows/test.yml) -[![Code Climate coverage](https://codeclimate.com/github/Iterable/iterable-expo-plugin/badges/coverage.svg)](https://codeclimate.com/github/Iterable/iterable-expo-plugin) +[![Code +Coverage](https://qlty.sh/badges/7b2b3c7b-27c0-4fed-af07-57b151b30a59/test_coverage.svg)](https://qlty.sh/gh/Iterable/projects/iterable-expo-plugin) +[![Maintainability](https://qlty.sh/badges/7b2b3c7b-27c0-4fed-af07-57b151b30a59/maintainability.svg)](https://qlty.sh/gh/Iterable/projects/iterable-expo-plugin) This config plugin automatically configures your Expo app to work with [@iterable/react-native-sdk](https://github.com/Iterable/react-native-sdk) when From 2cbc41053d9fd640ccae5a7eec7d9dba981053c0 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 15:21:07 -0700 Subject: [PATCH 20/28] ci: rename workflows for clarity and remove coverage badge workflow --- .github/workflows/build-library.yml | 33 ++++++------------ .github/workflows/coverage-badge.yml | 51 ---------------------------- .github/workflows/test.yml | 23 ++----------- 3 files changed, 13 insertions(+), 94 deletions(-) delete mode 100644 .github/workflows/coverage-badge.yml diff --git a/.github/workflows/build-library.yml b/.github/workflows/build-library.yml index ee0bafa..9ff0d08 100644 --- a/.github/workflows/build-library.yml +++ b/.github/workflows/build-library.yml @@ -1,4 +1,4 @@ -name: CI +name: Lint and Build Library on: push: branches: @@ -16,29 +16,16 @@ permissions: security-events: write # Required for security scanning jobs: - # dependency-review: - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - - # - name: Dependency Review - # uses: actions/dependency-review-action@v3 - # with: - # fail-on-severity: high - - # security-scan: - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v4 + dependency-review: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 - # - name: Run Snyk to check for vulnerabilities - # uses: snyk/actions/node@master - # env: - # SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} - # with: - # args: --severity-threshold=high + - name: Dependency Review + uses: actions/dependency-review-action@v3 + with: + fail-on-severity: high type-check: runs-on: ubuntu-latest diff --git a/.github/workflows/coverage-badge.yml b/.github/workflows/coverage-badge.yml deleted file mode 100644 index 55d730e..0000000 --- a/.github/workflows/coverage-badge.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Coverage Badge - -on: - push: - branches: - - main - pull_request: - branches: - - main - workflow_run: - workflows: ['CI'] - types: - - completed - -permissions: - contents: write # Required for updating the coverage badge - checks: write # Required for updating check status - -jobs: - update-badge: - runs-on: ubuntu-latest - if: github.event.workflow_run.conclusion == 'success' - steps: - - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - - - name: Install dependencies - run: yarn install - - - name: Run tests with coverage - run: yarn test:coverage --coverageReporters json-summary - - - name: Generate coverage badge - id: coverage - run: | - COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct') - echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT - - - name: Update coverage badge - uses: schneegans/dynamic-badges-action@v1.6.0 - with: - auth: ${{ secrets.GIST_SECRET }} - gistID: your-gist-id - filename: coverage.json - label: coverage - message: ${{ steps.coverage.outputs.coverage }}% - color: green diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 122b668..6d75a05 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: CI +name: Unit Tests on: push: branches: @@ -17,8 +17,6 @@ permissions: jobs: test: runs-on: ubuntu-latest - outputs: - coverage: ${{ steps.coverage.outputs.coverage }} steps: - name: Checkout uses: actions/checkout@v4 @@ -39,29 +37,14 @@ jobs: fi echo "Coverage ($COVERAGE%) is above threshold ($COVERAGE_THRESHOLD%)" - - name: Upload coverage to Code Climate - uses: paambaati/codeclimate-action@v9.0.0 - env: - CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_KEY }} - with: - coverageCommand: yarn test:coverage --coverageReporters lcov - coverageLocations: | - ${{github.workspace}}/coverage/lcov.info:lcov - - - name: Add coverage to QLTY + - name: Upload coverage to QLTY uses: qltysh/qlty-action/coverage@v1 with: token: ${{ secrets.QLTY_COVERAGE_TOKEN }} files: coverage/lcov.info - - name: Test coverage comment + - name: Add test coverage comment id: coverageComment uses: MishaKav/jest-coverage-comment@main with: hide-comment: false coverage-summary-path: ./coverage/coverage-summary.json - - - id: coverage - name: Generate coverage badge - run: | - COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct') - echo "coverage=$COVERAGE" >> "$GITHUB_OUTPUT" From f94d42e1bb2639866c8c477f4f2f648d9b899134 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 16:08:33 -0700 Subject: [PATCH 21/28] ci: add GitHub Actions workflow for automated build and commit process --- .github/workflows/build-and-commit.yml | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/build-and-commit.yml diff --git a/.github/workflows/build-and-commit.yml b/.github/workflows/build-and-commit.yml new file mode 100644 index 0000000..c06a8de --- /dev/null +++ b/.github/workflows/build-and-commit.yml @@ -0,0 +1,44 @@ +name: Build and Commit + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +permissions: + contents: write # Required for committing changes + +jobs: + build-and-commit: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for proper versioning + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + + - name: Install dependencies + run: yarn install + + - name: Build package + run: yarn prepare + + - name: Configure Git + run: | + git config --global user.name 'GitHub Actions' + git config --global user.email 'github-actions@github.com' + + - name: Commit build results + run: | + git add build/ + git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update build files [skip ci]" && git push) From 3d28a4b8f00883ac24de407f1637ea25258a3127 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 16:13:37 -0700 Subject: [PATCH 22/28] ci: add linting and type-checking workflow to GitHub Actions --- .../workflows/{build-library.yml => lint.yml} | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) rename .github/workflows/{build-library.yml => lint.yml} (81%) diff --git a/.github/workflows/build-library.yml b/.github/workflows/lint.yml similarity index 81% rename from .github/workflows/build-library.yml rename to .github/workflows/lint.yml index 9ff0d08..5a0acb6 100644 --- a/.github/workflows/build-library.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: Lint and Build Library +name: Lint on: push: branches: @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v4 - name: Dependency Review - uses: actions/dependency-review-action@v3 + uses: actions/dependency-review-action@v4 with: fail-on-severity: high @@ -51,18 +51,6 @@ jobs: - name: Lint files run: yarn lint - build-library: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Build package - run: yarn prepare - misspell: name: runner / misspell runs-on: ubuntu-latest From c120de9f4ed65f2e8208e21a9a73723d4cdc930e Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 16:13:51 -0700 Subject: [PATCH 23/28] ci: force add build directory to ensure all files are committed in GitHub Actions workflow --- .github/workflows/build-and-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-commit.yml b/.github/workflows/build-and-commit.yml index c06a8de..0faa7fc 100644 --- a/.github/workflows/build-and-commit.yml +++ b/.github/workflows/build-and-commit.yml @@ -40,5 +40,5 @@ jobs: - name: Commit build results run: | - git add build/ + git add build/ -f git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update build files [skip ci]" && git push) From da95614367fe78d284c37afb984342d7b899829b Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 16:16:19 -0700 Subject: [PATCH 24/28] ci: update GitHub Actions workflow to push build results to the correct branch --- .github/workflows/build-and-commit.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-commit.yml b/.github/workflows/build-and-commit.yml index 0faa7fc..d7ab9d2 100644 --- a/.github/workflows/build-and-commit.yml +++ b/.github/workflows/build-and-commit.yml @@ -20,6 +20,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch all history for proper versioning + ref: ${{ github.ref }} - name: Setup Node.js uses: actions/setup-node@v4 @@ -41,4 +42,4 @@ jobs: - name: Commit build results run: | git add build/ -f - git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update build files [skip ci]" && git push) + git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update build files [skip ci]" && git push origin HEAD:${{ github.ref_name }}) From 6c39051cc35ba874d7c57786393562ddcafdc28e Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 16:18:29 -0700 Subject: [PATCH 25/28] ci: enhance GitHub Actions workflow to handle commits based on event type --- .github/workflows/build-and-commit.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-commit.yml b/.github/workflows/build-and-commit.yml index d7ab9d2..3756e36 100644 --- a/.github/workflows/build-and-commit.yml +++ b/.github/workflows/build-and-commit.yml @@ -20,7 +20,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # Fetch all history for proper versioning - ref: ${{ github.ref }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Setup Node.js uses: actions/setup-node@v4 @@ -42,4 +42,15 @@ jobs: - name: Commit build results run: | git add build/ -f - git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update build files [skip ci]" && git push origin HEAD:${{ github.ref_name }}) + if git diff --quiet && git diff --staged --quiet; then + echo "No changes to commit" + exit 0 + fi + + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + git commit -m "chore: update build files [skip ci]" + git push origin HEAD:refs/heads/${{ github.head_ref }} + else + git commit -m "chore: update build files [skip ci]" + git push origin HEAD:refs/heads/${{ github.ref_name }} + fi From dbf979cf3239b7526b65841c866bddeceaba67dc Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 8 May 2025 23:19:10 +0000 Subject: [PATCH 26/28] chore: update build files [skip ci] --- build/ExpoAdapterIterableModule.d.ts | 6 ++++++ build/ExpoAdapterIterableModule.d.ts.map | 1 + build/ExpoAdapterIterableModule.js | 4 ++++ build/ExpoAdapterIterableModule.js.map | 1 + build/index.d.ts | 3 +++ build/index.d.ts.map | 1 + build/index.js | 4 ++++ build/index.js.map | 1 + 8 files changed, 21 insertions(+) create mode 100644 build/ExpoAdapterIterableModule.d.ts create mode 100644 build/ExpoAdapterIterableModule.d.ts.map create mode 100644 build/ExpoAdapterIterableModule.js create mode 100644 build/ExpoAdapterIterableModule.js.map create mode 100644 build/index.d.ts create mode 100644 build/index.d.ts.map create mode 100644 build/index.js create mode 100644 build/index.js.map diff --git a/build/ExpoAdapterIterableModule.d.ts b/build/ExpoAdapterIterableModule.d.ts new file mode 100644 index 0000000..5c73bf0 --- /dev/null +++ b/build/ExpoAdapterIterableModule.d.ts @@ -0,0 +1,6 @@ +import { NativeModule } from 'expo'; +declare class ExpoAdapterIterableModule extends NativeModule { +} +declare const _default: ExpoAdapterIterableModule; +export default _default; +//# sourceMappingURL=ExpoAdapterIterableModule.d.ts.map \ No newline at end of file diff --git a/build/ExpoAdapterIterableModule.d.ts.map b/build/ExpoAdapterIterableModule.d.ts.map new file mode 100644 index 0000000..467dc95 --- /dev/null +++ b/build/ExpoAdapterIterableModule.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ExpoAdapterIterableModule.d.ts","sourceRoot":"","sources":["../src/ExpoAdapterIterableModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAEzD,OAAO,OAAO,yBAA0B,SAAQ,YAAY;CAAG;;AAG/D,wBAEE"} \ No newline at end of file diff --git a/build/ExpoAdapterIterableModule.js b/build/ExpoAdapterIterableModule.js new file mode 100644 index 0000000..38aaa62 --- /dev/null +++ b/build/ExpoAdapterIterableModule.js @@ -0,0 +1,4 @@ +import { requireNativeModule } from 'expo'; +// This call loads the native module object from the JSI. +export default requireNativeModule('ExpoAdapterIterable'); +//# sourceMappingURL=ExpoAdapterIterableModule.js.map \ No newline at end of file diff --git a/build/ExpoAdapterIterableModule.js.map b/build/ExpoAdapterIterableModule.js.map new file mode 100644 index 0000000..f97c2c7 --- /dev/null +++ b/build/ExpoAdapterIterableModule.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ExpoAdapterIterableModule.js","sourceRoot":"","sources":["../src/ExpoAdapterIterableModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAIzD,yDAAyD;AACzD,eAAe,mBAAmB,CAChC,qBAAqB,CACtB,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\n\ndeclare class ExpoAdapterIterableModule extends NativeModule {}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule(\n 'ExpoAdapterIterable'\n);\n"]} \ No newline at end of file diff --git a/build/index.d.ts b/build/index.d.ts new file mode 100644 index 0000000..bd9f7b0 --- /dev/null +++ b/build/index.d.ts @@ -0,0 +1,3 @@ +import ExpoAdapterIterableModule from './ExpoAdapterIterableModule'; +export default ExpoAdapterIterableModule; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/build/index.d.ts.map b/build/index.d.ts.map new file mode 100644 index 0000000..ab71e42 --- /dev/null +++ b/build/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,yBAAyB,MAAM,6BAA6B,CAAC;AAEpE,eAAe,yBAAyB,CAAC"} \ No newline at end of file diff --git a/build/index.js b/build/index.js new file mode 100644 index 0000000..f20e8c8 --- /dev/null +++ b/build/index.js @@ -0,0 +1,4 @@ +// Reexport the native module. +import ExpoAdapterIterableModule from './ExpoAdapterIterableModule'; +export default ExpoAdapterIterableModule; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/index.js.map b/build/index.js.map new file mode 100644 index 0000000..902e01a --- /dev/null +++ b/build/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,yBAAyB,MAAM,6BAA6B,CAAC;AAEpE,eAAe,yBAAyB,CAAC","sourcesContent":["// Reexport the native module.\nimport ExpoAdapterIterableModule from './ExpoAdapterIterableModule';\n\nexport default ExpoAdapterIterableModule;\n"]} \ No newline at end of file From e0b23ccaaea6bf4b3309dde1121f4028c63d7ed0 Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 16:27:59 -0700 Subject: [PATCH 27/28] ci: refactor GitHub Actions workflow by commenting out existing steps for clarity --- .github/workflows/build-and-commit.yml | 112 ++++++++++++------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/.github/workflows/build-and-commit.yml b/.github/workflows/build-and-commit.yml index 3756e36..8c8d836 100644 --- a/.github/workflows/build-and-commit.yml +++ b/.github/workflows/build-and-commit.yml @@ -1,56 +1,56 @@ -name: Build and Commit - -on: - push: - branches: - - main - pull_request: - branches: - - main - workflow_dispatch: - -permissions: - contents: write # Required for committing changes - -jobs: - build-and-commit: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Fetch all history for proper versioning - ref: ${{ github.event.pull_request.head.sha || github.sha }} - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - cache: 'yarn' - - - name: Install dependencies - run: yarn install - - - name: Build package - run: yarn prepare - - - name: Configure Git - run: | - git config --global user.name 'GitHub Actions' - git config --global user.email 'github-actions@github.com' - - - name: Commit build results - run: | - git add build/ -f - if git diff --quiet && git diff --staged --quiet; then - echo "No changes to commit" - exit 0 - fi - - if [[ "${{ github.event_name }}" == "pull_request" ]]; then - git commit -m "chore: update build files [skip ci]" - git push origin HEAD:refs/heads/${{ github.head_ref }} - else - git commit -m "chore: update build files [skip ci]" - git push origin HEAD:refs/heads/${{ github.ref_name }} - fi +# name: Build and Commit + +# on: +# push: +# branches: +# - main +# pull_request: +# branches: +# - main +# workflow_dispatch: + +# permissions: +# contents: write # Required for committing changes + +# jobs: +# build-and-commit: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# with: +# fetch-depth: 0 # Fetch all history for proper versioning +# ref: ${{ github.event.pull_request.head.sha || github.sha }} + +# - name: Setup Node.js +# uses: actions/setup-node@v4 +# with: +# node-version: '20' +# cache: 'yarn' + +# - name: Install dependencies +# run: yarn install + +# - name: Build package +# run: yarn prepare + +# - name: Configure Git +# run: | +# git config --global user.name 'GitHub Actions' +# git config --global user.email 'github-actions@github.com' + +# - name: Commit build results +# run: | +# git add build/ -f +# if git diff --quiet && git diff --staged --quiet; then +# echo "No changes to commit" +# exit 0 +# fi + +# if [[ "${{ github.event_name }}" == "pull_request" ]]; then +# git commit -m "chore: update build files [skip ci]" +# git push origin HEAD:refs/heads/${{ github.head_ref }} +# else +# git commit -m "chore: update build files [skip ci]" +# git push origin HEAD:refs/heads/${{ github.ref_name }} +# fi From a50be99fbd89a581bffc101118ea5373da5e9fdd Mon Sep 17 00:00:00 2001 From: Loren Posen Date: Thu, 8 May 2025 16:35:58 -0700 Subject: [PATCH 28/28] ci: update GitHub Actions workflow to include build step and rename lint job --- .github/workflows/lint.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5a0acb6..8e718c2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: Lint +name: Build and Lint on: push: branches: @@ -38,7 +38,17 @@ jobs: - name: Type check run: yarn tsc --noEmit + build-library: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + - name: Build package + run: yarn prepare lint: runs-on: ubuntu-latest steps: