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
6 changes: 5 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"ignore": [],
"privatePackages": {
"version": false,
"tag": false
}
}
43 changes: 4 additions & 39 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,10 @@ parameters:
orbs:
publish-docs: infinitered/publish-docs@0.4

# Docker defaults
defaults: &defaults
docker:
- image: cimg/node:18.16.1
working_directory: /mnt/ramdisk/repo

# Jobs
jobs:
test_and_build:
<<: *defaults
steps:
- checkout
# Restore Yarn cache (Yarn 3 uses .yarn/cache directory)
- restore_cache:
name: Restore Yarn Cache
keys:
- yarn-cache-{{ checksum "yarn.lock" }}
- run:
name: Use local Yarn version
command: echo "export PATH=$(pwd)/.yarn/releases:$PATH" >> $BASH_ENV
- run:
name: Install Dependencies
command: yarn install --immutable
# Save Yarn cache
- save_cache:
name: Save Yarn Cache
key: yarn-cache-{{ checksum "yarn.lock" }}
paths:
- .yarn/cache
- run:
name: Lint code
command: yarn lint
- run:
name: Build modules and packages
command: yarn ci:build
- run:
name: Run tests
command: yarn test
# Lint/build/test now live in GitHub Actions (.github/workflows/ci.yml) so that
# pull requests and `main` run the exact same checks. CircleCI is kept solely
# for docs publishing, which relies on the Infinite Red publish-docs orb and
# CircleCI-managed SSH access to the ir-docs repo.

# Publishing docs details
publish-details: &publish-details
Expand All @@ -67,7 +33,6 @@ workflows:
version: 2
build-and-test:
jobs:
- test_and_build
- publish-docs/build_docs:
<<: *publish-details
filters:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI

# Single source of truth for the checks that gate the repo.
#
# This workflow runs on every pull request AND is called by the release
# workflow (via `workflow_call`) before anything is versioned or published.
# Running the exact same `verify` job in both places keeps PR and `main`
# checks in lockstep, so a PR can't go green and then break on merge.

on:
pull_request:
workflow_call:

# Least privilege: this job only reads the repo to lint, build, and test.
# No publishing or writes happen here (that stays in release.yml).
permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
verify:
# Keep this name stable: it's referenced by the branch protection
# "required status checks" rule on main.
name: verify
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# Full history so `changeset status` can find where the branch
# diverged from origin/main.
fetch-depth: 0

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

- name: Install Dependencies
run: yarn install --immutable

# Requires a changeset for changed published packages and fails on
# changesets that reference a missing package (#247). Private packages
# (example-app, configs) are exempt via `privatePackages.version: false`
# in .changeset/config.json.
- name: Validate changesets
run: yarn changeset status --since=origin/main

# CI lints without mutating (eslint without --fix, prettier --check), so
# formatting drift fails the build. Locally `yarn lint` still auto-fixes.
- name: Lint code
run: yarn ci:lint

- name: Build modules and packages
run: yarn ci:build

- name: Run tests
run: yarn test
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
# Run the same lint/changeset/build/test checks that gate every pull request
# (see ci.yml) before doing anything irreversible like versioning or
# publishing. This keeps `main` in lockstep with PRs.
verify:
name: "CI checks"
uses: ./.github/workflows/ci.yml

version_or_release:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
# This job checks whether any changesets are present in './changesets'
#
# - If changesets are present, it will run 'yarn version' which updates the
Expand All @@ -21,6 +28,7 @@
# etc.
#
name: "Changesets version or release"
needs: verify
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
Expand Down
5 changes: 4 additions & 1 deletion apps/ExampleApp/app/screens/TextRecognitionScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { AppStackScreenProps } from "../navigators"
import { Text, Icon, ImageSelector, Screen } from "../components"
import { useTypedNavigation } from "../navigators/useTypedNavigation"

import { recognizeText, Text as RecognizedText } from "@infinitered/react-native-mlkit-text-recognition"
import {
recognizeText,
Text as RecognizedText,
} from "@infinitered/react-native-mlkit-text-recognition"
import { UseExampleImageStatus, SelectedImage } from "../utils/useExampleImage"

type TextRecognitionScreenProps = NativeStackScreenProps<AppStackScreenProps<"TextRecognition">>
Expand Down
2 changes: 1 addition & 1 deletion apps/ExampleApp/app/screens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export * from "./ImageLabelingScreen"
export * from "./DocumentScannerScreen"
export { BOX_COLORS } from "./FaceDetectionScreen"
export * from "./ObjectDetectionScreen"
export * from "./TextRecognitionScreen"
export * from "./TextRecognitionScreen"
2 changes: 2 additions & 0 deletions apps/ExampleApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"scripts": {
"compile": "tsc --noEmit -p . --pretty",
"format": "prettier --write \"app/**/*.{js,jsx,json,md,ts,tsx}\"",
"format:check": "prettier --check \"app/**/*.{js,jsx,json,md,ts,tsx}\"",
"lint": "eslint App.tsx app test --fix --ext .js,.ts,.tsx && npm run format",
"lint:ci": "eslint App.tsx app test --ext .js,.ts,.tsx && npm run format:check",
"patch": "patch-package",
"test": "jest",
"test:watch": "jest --watch",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"test": "turbo run test -- --run-in-band",
"dev": "turbo run dev",
"lint": "turbo run lint",
"ci:lint": "turbo run lint --filter=!example-app && yarn workspace example-app lint:ci",
"clean": "turbo run clean --force",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"setup": "./scripts/setup.sh",
Expand Down
Loading