diff --git a/.github/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md similarity index 100% rename from .github/pull_request_template.md rename to .github/PULL_REQUEST_TEMPLATE/pull_request_template.md diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 000000000..dbe6bdce6 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,36 @@ +name: Setup +description: Setup Node.js and install dependencies + +inputs: + registry-url: + description: Optional registry to set up for auth. + +runs: + using: composite + steps: + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + registry-url: ${{ inputs.registry-url }} + + - name: Enable Corepack for yarn v4 + run: corepack enable + shell: bash + + - name: Cache dependencies + id: yarn-cache + uses: actions/cache@v4 + 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 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 79c120ee2..5e52bee78 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,3 +6,8 @@ updates: interval: "weekly" # Disable version updates for npm dependencies open-pull-requests-limit: 0 + + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly diff --git a/.github/label-actions.yml b/.github/label-actions.yml deleted file mode 100644 index f261a8309..000000000 --- a/.github/label-actions.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Configuration for Label Actions - https://github.com/dessant/label-actions -"Needs: Issue Template": - comment: > - :wave: @{issue-author}, have a look at our issue template and make sure that you've filled out the required fields. - # Close the issue - close: true -"question": - comment: > - :thinking: @{issue-author}, this appears to be a question rather than an issue
please use GitHub Discussions or [Slack](https://slack.openstreetmap.us/). - # Close the issue - close: true -"stale": - comment: > - :thinking: @{issue-author} we're closing this issue due to lack of activity. - # Close the issue - close: true diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 7bf58a7e6..000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,11 +0,0 @@ -daysUntilStale: 60 -daysUntilClose: 7 -exemptLabels: - - pinned - - security -staleLabel: wontfix -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -closeComment: false \ No newline at end of file diff --git a/.github/workflows/android-actions.yml b/.github/workflows/android-actions.yml deleted file mode 100644 index af049dc27..000000000 --- a/.github/workflows/android-actions.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Android Build - -on: - workflow_call: - inputs: - NVMRC: - required: true - type: string - -jobs: - build_example: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup node ${{ inputs.NVMRC }} - uses: actions/setup-node@v4 - with: - node-version: ${{ inputs.NVMRC }} - - - name: Setup JDK zulu 17 - uses: actions/setup-java@v4 - with: - distribution: "zulu" - java-version: "17" - - - name: Enable Corepack - run: corepack enable - - - run: yarn install --immutable --check-cache - working-directory: packages/react-native-app - - - run: ./gradlew assemble - working-directory: packages/react-native-app/android diff --git a/.github/workflows/build-react-native-android.yml b/.github/workflows/build-react-native-android.yml new file mode 100644 index 000000000..0ad4658c2 --- /dev/null +++ b/.github/workflows/build-react-native-android.yml @@ -0,0 +1,30 @@ +name: Build React Native Android + +on: + workflow_call: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + defaults: + run: + working-directory: ./packages/react-native-app + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Setup Azul Zulu OpenJDK + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 21 + + - name: Build Android + run: ./gradlew assemble + working-directory: packages/react-native-app/android diff --git a/.github/workflows/ios-actions.yml b/.github/workflows/build-react-native-ios.yml similarity index 51% rename from .github/workflows/ios-actions.yml rename to .github/workflows/build-react-native-ios.yml index 93a298bd5..dd4b68ab2 100644 --- a/.github/workflows/ios-actions.yml +++ b/.github/workflows/build-react-native-ios.yml @@ -1,16 +1,13 @@ -name: iOS Build & Detox +name: Build React Native iOS & Test with Detox on: workflow_call: - inputs: - NVMRC: - required: true - type: string jobs: build: + name: Build runs-on: macos-latest - timeout-minutes: 45 # Figure out why this job can be super slow; runner hardware? + timeout-minutes: 30 defaults: run: @@ -20,16 +17,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup node ${{ inputs.NVMRC }} - uses: actions/setup-node@v4 - with: - node-version: ${{ inputs.NVMRC }} - - - name: Enable Corepack - run: corepack enable - - - name: Install Yarn Dependencies - run: yarn install --immutable --check-cache + - name: Setup + uses: ./.github/actions/setup - name: Install Pod Dependencies run: cd ios && pod --version && pod install @@ -38,9 +27,10 @@ jobs: run: | brew tap wix/brew brew install applesimutils + yarn detox clean-framework-cache && yarn detox build-framework-cache - - name: Build for detox + - name: Build iOS run: yarn detox build -c ios.sim.release - - name: Test with detox + - name: Test with Detox run: yarn detox test --debug-synchronization 200 -c ios.sim.release diff --git a/.github/workflows/label-actions.yml b/.github/workflows/label-actions.yml deleted file mode 100644 index 55d4ef364..000000000 --- a/.github/workflows/label-actions.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Configuration for Label Actions - https://github.com/dessant/label-actions - -name: "Label Actions" - -on: - issues: - types: labeled - -permissions: - contents: read - issues: write - -jobs: - action: - runs-on: ubuntu-latest - steps: - - uses: dessant/label-actions@v4 diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml deleted file mode 100644 index 597d17318..000000000 --- a/.github/workflows/on-push.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: On Push -on: [push, pull_request] - -jobs: - lint_test_generate: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Read .nvmrc - run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT - id: nvm - - - name: Setup node ${{ steps.nvm.outputs.NVMRC }} - uses: actions/setup-node@v4 - with: - node-version: ${{ steps.nvm.outputs.NVMRC }} - - - name: Enable Corepack - run: corepack enable - - - name: Install - run: yarn install --immutable --check-cache - - - name: Lint with ESLint - run: yarn lint:eslint - - - name: Lint with TSC - run: yarn lint:tsc - - - name: Run test with Jest - run: yarn test - - - name: Codegen - run: yarn codegen - - - name: Pack (to ensure the plugin builds) - run: yarn pack - - outputs: - NVMRC: ${{ steps.nvm.outputs.NVMRC }} - - call_android_workflow: - needs: lint_test_generate - uses: ./.github/workflows/android-actions.yml - with: - NVMRC: ${{ needs.lint_test_generate.outputs.NVMRC }} - - call_ios_workflow: - needs: lint_test_generate - uses: ./.github/workflows/ios-actions.yml - with: - NVMRC: ${{ needs.lint_test_generate.outputs.NVMRC }} - - publish: - if: startsWith(github.ref, 'refs/tags/') - needs: [lint_test_generate, call_android_workflow, call_ios_workflow] - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup node ${{ steps.nvm.outputs.NVMRC }} - uses: actions/setup-node@v4 - with: - node-version: ${{ needs.lint_test_generate.outputs.NVMRC }} - registry-url: https://registry.npmjs.org/ - - - name: Enable Corepack - run: corepack enable - - - name: Install - run: yarn install --immutable --check-cache - - - name: Setup .yarnrc.yml - run: yarn config set npmAuthToken $NPM_AUTH_TOKEN - env: - NPM_AUTH_TOKEN: ${{ secrets.NPM_ORG_TOKEN }} - - - name: Publish - run: yarn npm publish diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml new file mode 100644 index 000000000..645a3b3fb --- /dev/null +++ b/.github/workflows/review.yml @@ -0,0 +1,119 @@ +name: Review + +on: + push: + branches: + - main + pull_request: + branches: + - main + merge_group: + types: + - checks_requested + +jobs: + lint-tsc: + name: Lint TSC + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Lint with TSC + run: yarn lint:tsc + + - name: Lint Plugin with TSC + run: yarn plugin:lint:tsc + + lint-eslint: + name: Lint ESLint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Lint with ESLint + run: yarn lint:eslint + + - name: Lint Plugin with ESLint + run: yarn plugin:lint:eslint + + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Test with Jest + run: yarn test + + - name: Test Plugin with Jest + run: yarn plugin:test + + codegen: + name: Codegen + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Codegen + run: yarn codegen + + build-library: + name: Build Library + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Build Library + run: yarn prepack + + build-react-native-android: + name: Build React Native Android + needs: [lint-eslint, lint-tsc, test, codegen, build-library] + uses: ./.github/workflows/build-react-native-android.yml + + build-react-native-ios: + name: Build React Native iOS & Test with Detox + needs: [lint-eslint, lint-tsc, test, codegen, build-library] + uses: ./.github/workflows/build-react-native-ios.yml + + publish: + name: Publish + if: startsWith(github.ref, 'refs/tags/') + needs: [lint-eslint, lint-tsc, test, codegen, build-library, build-react-native-android, build-react-native-ios] + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + with: + registry-url: https://registry.npmjs.org/ + + - name: Setup .yarnrc.yml + run: yarn config set npmAuthToken $NPM_AUTH_TOKEN + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_ORG_TOKEN }} + + - name: Publish + run: yarn npm publish diff --git a/.nvmrc b/.nvmrc index e44a38e08..7af24b7dd 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v18.12.1 +22.11.0 diff --git a/README.md b/README.md index 7b9239860..630e733cf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ [![MapLibre Logo](https://maplibre.org/img/maplibre-logo-big.svg)](https://maplibre.org) # MapLibre React Native +[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE.md) +[![Version](https://img.shields.io/npm/v/@maplibre/maplibre-react-native)](https://www.npmjs.com/package/@maplibre/maplibre-react-native) +[![Actions](https://img.shields.io/github/actions/workflow/status/maplibre/maplibre-react-native/review.yml?label=Actions +)](https://github.com/maplibre/maplibre-react-native/actions/workflows/review.yml) + _React Native library for creating maps with [MapLibre Native for Android & iOS](https://github.com/maplibre/maplibre-gl-native)_. @@ -9,22 +14,16 @@ React Native library for building maps with the Mapbox iOS and Android mobile SD supported both Mapbox and MapLibre for some time, but as the MapLibre and Mapbox SDKs have diverged, it has become necessary to separate the projects into specific wrappers by underlying renderer. ---- - -[![npm version](https://badge.fury.io/js/%40maplibre%2Fmaplibre-react-native.svg)](https://badge.fury.io/js/%40maplibre%2Fmaplibre-react-native) [![Android Build](https://github.com/maplibre/maplibre-react-native/actions/workflows/android-actions.yml/badge.svg)](https://github.com/maplibre/maplibre-react-native/actions/workflows/android-actions.yml) [![iOS Build](https://github.com/maplibre/maplibre-react-native/actions/workflows/ios-actions.yml/badge.svg)](https://github.com/maplibre/maplibre-react-native/actions/workflows/ios-actions.yml) - ---- - -
- -Indoor Building Map Android -Indoor Building Map iOS +

+ Indoor Building Map Android + Indoor Building Map iOS +

## Documentation diff --git a/package.json b/package.json index 9c87ba639..cc9ec83da 100644 --- a/package.json +++ b/package.json @@ -27,12 +27,14 @@ "codegen": "tsx scripts/codegen.ts", "test": "jest", "lint": "yarn lint:tsc && yarn lint:eslint", - "lint:eslint": "eslint .", - "lint:eslint:fix": "eslint . --fix", - "lint:tsc": "tsc --project . && tsc --project ./packages/examples", - "plugin:build": "tsc --build plugin", - "plugin:lint": "eslint plugin/src/*", - "plugin:test": "jest plugin", + "lint:tsc": "tsc --project ./ && tsc --project ./packages/examples", + "lint:eslint": "eslint ./", + "lint:eslint:fix": "eslint ./ --fix", + "plugin:build": "tsc --build ./plugin", + "plugin:lint": "yarn plugin:lint:tsc && yarn plugin:lint:eslint", + "plugin:lint:tsc": "tsc --noEmit --project ./plugin", + "plugin:lint:eslint": "eslint ./plugin/src/*", + "plugin:test": "jest ./plugin", "prepack": "bob build && yarn plugin:build" }, "workspaces": [ diff --git a/packages/react-native-app/.nvmrc b/packages/react-native-app/.nvmrc deleted file mode 100644 index e44a38e08..000000000 --- a/packages/react-native-app/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v18.12.1