diff --git a/.circleci/comment-artifacts.sh b/.circleci/comment-artifacts.sh deleted file mode 100644 index 7991e99012..0000000000 --- a/.circleci/comment-artifacts.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -URL="https://callstack-github-bot.herokuapp.com/comment" -LINK="https://output.circle-artifacts.com/output/job/$CIRCLE_WORKFLOW_JOB_ID/artifacts/$CIRCLE_NODE_INDEX/docs/index.html" -TEMPLATE="Hey @{{user.login}}, thank you for your pull request 🤗. The documentation from this branch can be viewed [here]($LINK)." - -read -r -d '' DATA << EOM -{ - "pull_request": "$CIRCLE_PULL_REQUEST", - "template": "$TEMPLATE", - "test": { - "type": "string", - "data": "The documentation from this branch can be viewed" - }, - "update": true -} -EOM - -curl \ - -H "Content-Type: application/json" \ - -d "$DATA" \ - -X POST $URL diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index c4053c5f19..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,154 +0,0 @@ -version: 2.1 - -executors: - default: - docker: - - image: cimg/node:20.19.0 - working_directory: ~/react-native-paper - -commands: - attach_project: - steps: - - attach_workspace: - at: ~/react-native-paper - -jobs: - install-dependencies: - executor: default - steps: - - checkout - - attach_project - - restore_cache: - keys: - - dependencies-{{ checksum "package.json" }} - - dependencies- - - restore_cache: - keys: - - dependencies-example-{{ checksum "example/package.json" }} - - dependencies-example- - - run: - name: Install dependencies - command: | - sudo corepack enable - yarn --cwd example --immutable - yarn --cwd docs --immutable - yarn --immutable - - save_cache: - key: dependencies-{{ checksum "package.json" }} - paths: - - node_modules - - save_cache: - key: dependencies-docs-{{ checksum "docs/package.json" }} - paths: - - docs/node_modules - - save_cache: - key: dependencies-example-{{ checksum "example/package.json" }} - paths: - - example/node_modules - - persist_to_workspace: - root: . - paths: - - . - lint: - executor: default - steps: - - attach_project - - run: - name: Lint files - command: | - yarn lint-no-fix - - typescript: - executor: default - steps: - - attach_project - - run: - name: Typecheck files - command: | - yarn typescript - - unit-tests: - executor: default - steps: - - attach_project - - restore_cache: - name: Restore Jest Cache - keys: - - jest-cache-{{ .Branch }} - - jest-cache - - run: - name: Run unit tests - command: | - yarn test --maxWorkers=2 --coverage - - store_artifacts: - path: coverage - destination: coverage - - save_cache: - paths: - - ./cache/jest - key: jest-cache-{{ .Branch }} - - build-package: - executor: default - steps: - - attach_project - - run: - name: Build package - command: | - yarn prepack - node ./scripts/typescript-output-lint - - build-docs: - executor: default - steps: - - attach_project - - run: - name: Build docs - command: | - export DOCUSAURUS_BASE_URL="/output/job/$CIRCLE_WORKFLOW_JOB_ID/artifacts/$CIRCLE_NODE_INDEX/docs/" - cd docs && yarn build && cd .. - bash .circleci/comment-artifacts.sh - - store_artifacts: - path: docs/build - destination: docs - - deploy-docs: - executor: default - steps: - - checkout - - attach_project - - add_ssh_keys: - fingerprints: - - '2f:b4:ed:e1:25:88:5c:4a:03:c2:16:40:56:70:29:29' - - run: - name: Deploy docs to GitHub pages - command: | - bash .circleci/deploy-docs.sh - -workflows: - build-and-test: - jobs: - - install-dependencies - - lint: - requires: - - install-dependencies - - typescript: - requires: - - install-dependencies - - unit-tests: - requires: - - install-dependencies - - build-package: - requires: - - install-dependencies - - build-docs: - requires: - - install-dependencies - filters: - branches: - ignore: main - - deploy-docs: - filters: - branches: - only: - - main diff --git a/.circleci/deploy-docs.sh b/.circleci/deploy-docs.sh deleted file mode 100755 index 5546f8bb2c..0000000000 --- a/.circleci/deploy-docs.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -# Based on domenic's tutorial: https://gist.github.com/domenic/ec8b0fc8ab45f39403dd - -set -euxo pipefail # Exit with nonzero exit code if anything fails - -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -SOURCE_BRANCH="main" -TARGET_BRANCH="gh-pages" - -git checkout $SOURCE_BRANCH - -cd $DIR/.. - -# Install React Native Paper dependencies for examples -yarn - -cd docs - -# Save some useful information -REPO=`git config remote.origin.url` -SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:} -SHA=`git rev-parse --verify HEAD` - -# Clone the existing gh-pages for this repo into dist/ -# Create a new empty branch if gh-pages doesn't exist yet (should only happen on first deploy) -git clone $REPO dist -cd dist -git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH -cd .. - -# Clean existing dist/ contents -rm -rf dist/**/* || : -rm -f dist/*.{html,css,js,json,map,xml} || : -rmdir dist/* || : - -# Run our build script. -yarn -yarn build - -# Move the built docs to cloned `gh-pages` directory -cp -R build/. dist - -rm -rf build - -# Change directory to the one using `gh-pages` branch -cd dist - -# Configure git. -git config user.name "$COMMIT_AUTHOR_NAME" -git config user.email "$COMMIT_AUTHOR_EMAIL" - -git add -A . - -# If there are no changes to the compiled dist (e.g. this is a README update) then just bail. -if git diff --cached --quiet; then - echo "No changes to the output on this push; exiting." - exit 0 -fi - -# Commit the "changes", i.e. the new version. -# The delta will show diffs between new and old versions. -git commit -m "Deploy to GitHub Pages: ${SHA}" - -# Now that we're all set up, we can push. -git push $SSH_REPO $TARGET_BRANCH - -# Change back to original branch -cd .. -git checkout $SOURCE_BRANCH -yarn diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000000..66e709c9e8 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,36 @@ +name: Setup +description: Setup Node.js and install dependencies + +runs: + using: composite + steps: + - name: Setup Node.js + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e + with: + node-version-file: .nvmrc + + - name: Restore dependencies + id: yarn-cache + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae + 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 + + - name: Cache dependencies + if: steps.yarn-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae + with: + path: | + **/node_modules + .yarn/install-state.gz + key: ${{ steps.yarn-cache.outputs.cache-primary-key }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..8096174f9a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,96 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup + uses: ./.github/actions/setup + + - name: Lint + run: yarn lint-no-fix + + typescript: + name: TypeScript + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup + uses: ./.github/actions/setup + + - name: Check types + run: yarn typescript + + unit-tests: + name: Unit tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup + uses: ./.github/actions/setup + + - name: Restore Jest cache + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ./cache/jest + key: jest-cache-${{ github.ref_name }} + restore-keys: jest-cache- + + - name: Run unit tests + run: yarn test --maxWorkers=2 --coverage + + - name: Upload coverage + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + if: always() + with: + name: coverage + path: coverage + + build-package: + name: Build package + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup + uses: ./.github/actions/setup + + - name: Build package + run: | + yarn prepack + node ./scripts/typescript-output-lint + + build-docs: + name: Build docs + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup + uses: ./.github/actions/setup + + - name: Build docs + run: yarn --cwd docs build + + - name: Upload docs + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: docs + path: docs/build diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000000..d6eb089477 --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,44 @@ +name: Deploy docs + +on: + push: + branches: + - main + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + deploy: + name: Deploy docs + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup + uses: ./.github/actions/setup + + - name: Build docs + run: yarn --cwd docs build + + - name: Configure Pages + uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + with: + path: docs/build + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 diff --git a/.github/workflows/publish-each-pr.yml b/.github/workflows/publish-each-pr.yml deleted file mode 100644 index 0fa519e55f..0000000000 --- a/.github/workflows/publish-each-pr.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Expo Preview -on: [pull_request] - -permissions: - contents: read - pull-requests: write - -jobs: - publish: - name: Install and publish - runs-on: ubuntu-latest - if: github.event.pull_request.head.repo.full_name == 'callstack/react-native-paper' - steps: - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - - - name: Setup Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - with: - node-version-file: .nvmrc - - - name: Setup Expo - uses: expo/expo-github-action@d300b960e9f91a8c59b2aaca92e89ad70b0785ac # v7 - with: - eas-version: latest - token: ${{ secrets.EXPO_TOKEN }} - - - name: Restore dependencies - id: yarn-cache - uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4 - with: - path: '**/node_modules' - 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: | - sudo corepack enable - yarn --cwd example --immutable - yarn --immutable - - - name: Cache dependencies - if: steps.yarn-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4 - with: - path: '**/node_modules' - key: ${{ steps.yarn-cache.outputs.cache-primary-key }} - - - name: Publish Expo app - working-directory: ./example - run: CI=1 rm -rf android && eas update --branch=pr-${{ github.event.number }} --message="$(git log -1 --pretty=%B)" - - - name: Get expo config - working-directory: ./example - id: expo - run: echo "EXPO_CONFIG=$(npx expo config --json)" >> $GITHUB_OUTPUT - - - name: Comment on PR - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const config = JSON.parse('${{ steps.expo.outputs.EXPO_CONFIG }}'); - - const { sdkVersion } = config; - const { projectId } = config.extra.eas; - - const channel = 'pr-${{ github.event.number }}'; - - const url = `https://expo.dev/@react-native-paper/react-native-paper-example?serviceType=eas&distribution=expo-go&scheme=exp+react-native-paper-example&channel=${channel}&sdkVersion=${sdkVersion}`; - const body = `The mobile version of example app from this branch is ready! You can [see it here.](${url}) - - `; - - const comments = await github.rest.issues.listComments({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - }); - - if (comments.data.some(comment => comment.body === body)) { - return; - } - - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body - }) diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml index 632323c6a5..371b3c504a 100644 --- a/.github/workflows/semantic-pr.yml +++ b/.github/workflows/semantic-pr.yml @@ -6,7 +6,7 @@ jobs: name: Validate PR title runs-on: ubuntu-latest steps: - - uses: amannn/action-semantic-pull-request@91682d013dea3ff257520b9b68c9cb93ced4fe9b # v4.5.0 + - uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 7b6949f2fb..1b4619fbde 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -5,7 +5,6 @@ on: - cron: '30 1 * * *' permissions: - contents: read issues: write pull-requests: write @@ -13,7 +12,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9 + - uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # v10.3.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-stale: 30 diff --git a/.github/workflows/triage.yaml b/.github/workflows/triage.yaml index c9c69eb8bb..26e574ef24 100644 --- a/.github/workflows/triage.yaml +++ b/.github/workflows/triage.yaml @@ -12,8 +12,8 @@ jobs: runs-on: ubuntu-latest if: github.event.label.name == 'needs more info' steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -40,8 +40,8 @@ jobs: runs-on: ubuntu-latest if: github.event.label.name == 'needs repro' steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/updates.yml b/.github/workflows/updates.yml index fa753fd5bf..336a01184e 100644 --- a/.github/workflows/updates.yml +++ b/.github/workflows/updates.yml @@ -10,44 +10,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Setup Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - with: - node-version-file: .nvmrc + - name: Setup + uses: ./.github/actions/setup - name: Setup Expo - uses: expo/expo-github-action@d300b960e9f91a8c59b2aaca92e89ad70b0785ac # v7 + uses: expo/expo-github-action@c7b66a9c327a43a8fa7c0158e7f30d6040d2481e # v8.2.1 with: expo-version: latest eas-version: latest token: ${{ secrets.EXPO_TOKEN }} - - name: Restore dependencies - id: yarn-cache - uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4 - with: - path: '**/node_modules' - 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: | - sudo corepack enable - yarn --cwd example --immutable - yarn --immutable - - - name: Cache dependencies - if: steps.yarn-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4 - with: - path: '**/node_modules' - key: ${{ steps.yarn-cache.outputs.cache-primary-key }} - - name: Publish Expo app update working-directory: ./example run: eas update --auto diff --git a/.github/workflows/versions.yml b/.github/workflows/versions.yml index a84b362955..bcadaaeab1 100644 --- a/.github/workflows/versions.yml +++ b/.github/workflows/versions.yml @@ -12,7 +12,7 @@ jobs: if: ${{ github.event.label.name == 'bug' }} runs-on: ubuntu-latest steps: - - uses: react-navigation/check-versions-action@deac0a153b834fdda425028be69b2cf786dacc31 # v1.1.0 + - uses: react-navigation/check-versions-action@1f7edac18020a4dc38c4d174bb04311b196f9b75 # v1.2.2 with: github-token: ${{ secrets.GITHUB_TOKEN }} required-packages: |