Skip to content

Commit

Permalink
Merge branch 'main' into @tomekzaw/visionos
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw committed Sep 5, 2024
2 parents 9f62ccb + b2eb98d commit 7ec92ad
Show file tree
Hide file tree
Showing 144 changed files with 21,198 additions and 46,678 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
},
extends: [
'expensify',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
'plugin:import/typescript',
Expand All @@ -30,6 +31,7 @@ module.exports = {
root: true,
rules: {
'rulesdir/prefer-underscore-method': 'off',
'rulesdir/prefer-import-module-contents': 'off',
'react/jsx-props-no-spreading': 'off',
'react/require-default-props': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.tsx', '.jsx'] }],
Expand All @@ -45,6 +47,8 @@ module.exports = {
'import/no-unresolved': 'error',
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'no-use-before-define': 'off',
'es/no-nullish-coalescing-operators': 'off',
'es/no-optional-chaining': 'off',
'@typescript-eslint/no-use-before-define': 'off', // TODO consider enabling this (currently it reports styles defined at the bottom of the file)
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/consistent-type-imports': [
Expand All @@ -55,9 +59,11 @@ module.exports = {
'error',
{ fixMixedExportsWithInlineTypeSpecifier: false },
],
'valid-jsdoc': 'off',
'tsdoc/syntax': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}],
'@typescript-eslint/consistent-type-definitions': 'off',
'curly': ['error', 'all'],
},
};
51 changes: 51 additions & 0 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Test Android build
on:
pull_request:
paths:
- .github/workflows/build-android.yml
- android/**
- cpp/**
- example/package.json
- example/android/**
- react-native.config.js
merge_group:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/build-android.yml
- android/**
- cpp/**
- example/package.json
- example/android/**
- react-native.config.js

jobs:
build:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: ubuntu-latest
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
fail-fast: false
concurrency:
group: build-android-${{ matrix.react-native-architecture }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

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

- name: Build app
working-directory: example/android
run: ./gradlew assembleDebug --build-cache -PreactNativeArchitectures=arm64-v8a -PnewArchEnabled=${{ matrix.react-native-architecture == 'Fabric' && 'true' || 'false' }}
83 changes: 83 additions & 0 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Test iOS build
on:
pull_request:
paths:
- .github/workflows/build-ios.yml
- RNLiveMarkdown.podspec
- ios/**
- cpp/**
- example/package.json
- example/ios/**
merge_group:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/build-ios.yml
- RNLiveMarkdown.podspec
- ios/**
- cpp/**
- example/package.json
- example/ios/**

jobs:
build:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: macos-13
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
fail-fast: false
concurrency:
group: build-ios-${{ matrix.react-native-architecture }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: |
node_modules
example/node_modules
key: build-ios-node-modules-${{ matrix.react-native-architecture }}-${{ hashFiles('yarn.lock') }}
restore-keys: build-ios-node-modules-${{ matrix.react-native-architecture }}-

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

- name: Restore Pods from cache
uses: actions/cache@v4
with:
path: |
example/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: build-ios-pods-${{ matrix.react-native-architecture }}-${{ hashFiles('example/node_modules/react-native/package.json') }}
restore-keys: build-ios-pods-${{ matrix.react-native-architecture }}-

- name: Install Pods
working-directory: example/ios
env:
RCT_NEW_ARCH_ENABLED: ${{ matrix.react-native-architecture == 'Fabric' && '1' || '0' }}
run: |
bundler install
bundler exec pod install
- name: Remove .xcode.env.local
working-directory: example/ios
run: rm -rf .xcode.env.local

- name: Restore build artifacts from cache
uses: actions/cache@v4
with:
path: ~/Library/Developer/Xcode/DerivedData
key: build-ios-derived-data-${{ matrix.react-native-architecture }}-${{ hashFiles('example/node_modules/react-native/package.json') }}
restore-keys: build-ios-derived-data-${{ matrix.react-native-architecture }}-

- name: Build app
working-directory: example
run: npx react-native@latest run-ios --no-packager
35 changes: 35 additions & 0 deletions .github/workflows/build-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test web build
on:
pull_request:
paths:
- .github/workflows/build-web.yml
- src/**
- WebExample/**
merge_group:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/build-web.yml
- src/**
- WebExample/**

jobs:
build:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: ubuntu-latest
concurrency:
group: build-web-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

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

- name: Build app
working-directory: WebExample
run: npx expo export:web
56 changes: 56 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Typecheck, lint and test
on:
pull_request:
merge_group:
branches:
- main
push:
branches:
- main

jobs:
check:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: ubuntu-latest
concurrency:
group: check-root-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

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

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

- name: Verify there's no parser diff
working-directory: parser
run: |
yarn build
if ! git diff --name-only --exit-code; then
# shellcheck disable=SC2016
echo 'Error: Parser diff detected! Please run `cd parser && yarn build` and commit the changes.'
exit 1
fi
- name: Typecheck library
run: yarn tsc --project tsconfig.json --noEmit

- name: Typecheck parser
run: yarn tsc --project parser/tsconfig.json --noEmit

- name: Typecheck example app
run: yarn tsc --project example/tsconfig.json --noEmit

- name: Typecheck WebExample app
run: yarn tsc --project WebExample/tsconfig.json --noEmit

- name: Lint
run: yarn lint

- name: Test
run: yarn test
10 changes: 3 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,14 @@ jobs:
with:
node-version: "16.x"

- name: Setup web example
run: npm ci
working-directory: ./WebExample

- run: yarn install --immutable

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

- name: Verify there's no Prettier diff
run: |
yarn lint --fix --quiet
if ! git diff --name-only --exit-code; then
# shellcheck disable=SC2016
echo 'Error: Prettier diff detected! Please run `npm run prettier` and commit the changes.'
echo 'Error: Prettier diff detected! Please run `yarn lint --fix` and commit the changes.'
exit 1
fi
36 changes: 7 additions & 29 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ jobs:
if: ${{ github.actor != 'OSBotify' }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: main
# The OS_BOTIFY_COMMIT_TOKEN is a personal access token tied to osbotify
# This is a workaround to allow pushes to a protected branch
token: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }}

- name: Decrypt & Import OSBotify GPG key
run: |
Expand All @@ -36,17 +39,11 @@ jobs:
git config --global user.name OSBotify
git config --global user.email [email protected]
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Generate branch name
run: echo "BRANCH_NAME=OSBotify-bump-version-$(uuidgen)" >> $GITHUB_ENV

- name: Create branch for version-bump pull request
run: git checkout -b ${{ env.BRANCH_NAME }}

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

Expand All @@ -63,26 +60,7 @@ jobs:
run: git tag ${{ env.NEW_VERSION }}

- name: Push branch and publish tags
run: git push --set-upstream origin ${{ env.BRANCH_NAME }} && git push --tags

- name: Create pull request
run: |
gh pr create \
--title "Update version to ${{ env.NEW_VERSION }}" \
--body "Update version to ${{ env.NEW_VERSION }}"
sleep 5
env:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}

- name: Auto-approve pull request
run: gh pr review --approve ${{ env.BRANCH_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Auto-merge pull request
run: gh pr merge --squash --delete-branch ${{ env.BRANCH_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git push --set-upstream origin main && git push --tags

- name: Build package
run: yarn pack
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/web-e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test web E2E
on:
pull_request:
paths:
- .github/workflows/web-e2e-test.yml
- src/**
- WebExample/**
merge_group:
branches:
- main
push:
branches:
- main
paths:
- .github/workflows/web-e2e-test.yml
- src/**
- WebExample/**

jobs:
test:
if: github.repository == 'Expensify/react-native-live-markdown'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./WebExample

concurrency:
group: web-e2e-test-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out Git repository
uses: actions/checkout@v4

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

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

- name: Install browsers
run: npx playwright install --with-deps

- name: Install dependencies for browsers
run: npx playwright install-deps

- name: Run Playwright tests
run: yarn test
Loading

0 comments on commit 7ec92ad

Please sign in to comment.