diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index cebc11f76..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,124 +0,0 @@ -version: 2.1 - -aliases: - - &filter-only-main - branches: - only: - - main - - &filter-ignore-main - branches: - ignore: - - main - -defaults: &defaults - docker: - - image: cimg/node:current - working_directory: ~/react-native-testing-library - -orbs: - codecov: codecov/codecov@3.2.2 - -jobs: - install-dependencies: - <<: *defaults - steps: - - checkout - - attach_workspace: - at: ~/react-native-testing-library - - restore_cache: - keys: - - dependencies-{{ checksum "yarn.lock" }} - - run: yarn install --frozen-lockfile --no-progress --non-interactive --cache-folder ~/.cache/yarn - - save_cache: - key: dependencies-{{ checksum "yarn.lock" }} - paths: - - ~/.cache/yarn - - persist_to_workspace: - root: . - paths: - - . - lint-and-typescript: - <<: *defaults - steps: - - attach_workspace: - at: ~/react-native-testing-library - - run: | - yarn lint - yarn typecheck - flow: - <<: *defaults - steps: - - attach_workspace: - at: ~/react-native-testing-library - - run: | - yarn flow - tests: - <<: *defaults - steps: - - attach_workspace: - at: ~/react-native-testing-library - - run: yarn test:ci - - store_artifacts: - path: coverage - destination: coverage - - codecov/upload - test-react-17: - <<: *defaults - steps: - - attach_workspace: - at: ~/react-native-testing-library - - run: | - yarn test:ci:react:17 - test-website: - <<: *defaults - steps: - - attach_workspace: - at: ~/react-native-testing-library - - run: | - cd website && yarn install && yarn build - upload-code-coverage: - <<: *defaults - steps: - - codecov/upload: - file: coverage/coverage-final.json - deploy-website: - <<: *defaults - steps: - - checkout - - run: - name: Deploying to GitHub Pages - command: | - git config --global user.email "thymikee@users.noreply.github.com" - git config --global user.name "Michał Pierzchała" - echo "machine github.com login thymikee password $GITHUB_TOKEN" > ~/.netrc - cd website && yarn install && GIT_USER=thymikee yarn deploy - -workflows: - version: 2 - build-and-test: - jobs: - - install-dependencies - - lint-and-typescript: - requires: - - install-dependencies - - flow: - requires: - - install-dependencies - - tests: - requires: - - install-dependencies - - test-react-17: - requires: - - install-dependencies - - test-website: - requires: - - install-dependencies - # docusuarus build is running when deploying website as well - filters: *filter-ignore-main - - upload-code-coverage: - requires: - - tests - - deploy-website: - requires: - - install-dependencies - filters: *filter-only-main diff --git a/.github/actions/setup-deps/action.yml b/.github/actions/setup-deps/action.yml new file mode 100644 index 000000000..05c9ade0d --- /dev/null +++ b/.github/actions/setup-deps/action.yml @@ -0,0 +1,22 @@ +name: Setup deps +description: Setup Node.js and install dependencies + +runs: + using: composite + steps: + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Cache deps + id: yarn-cache + uses: actions/cache@v3 + with: + path: ./node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} + + - name: Install deps + if: steps.yarn-cache.outputs.cache-hit != 'true' + run: yarn install --frozen-lockfile + shell: bash diff --git a/.github/actions/setup-node-deps/action.yml b/.github/actions/setup-website-deps/action.yml similarity index 54% rename from .github/actions/setup-node-deps/action.yml rename to .github/actions/setup-website-deps/action.yml index 5b4ba66d4..bb59f001a 100644 --- a/.github/actions/setup-node-deps/action.yml +++ b/.github/actions/setup-website-deps/action.yml @@ -1,5 +1,5 @@ -name: Setup -description: Setup Node.js and install dependencies +name: Setup Website deps +description: Setup Node.js and install website dependencies runs: using: composite @@ -7,19 +7,7 @@ runs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: '16' - - - name: Cache deps - id: yarn-cache - uses: actions/cache@v3 - with: - path: ./node_modules - key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} - - - name: Install deps - if: steps.yarn-cache.outputs.cache-hit != 'true' - run: yarn install --frozen-lockfile - shell: bash + node-version: 18 - name: Cache website deps id: yarn-cache-website diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml new file mode 100644 index 000000000..0e54aa6a1 --- /dev/null +++ b/.github/workflows/deploy-website.yml @@ -0,0 +1,36 @@ +name: Website + +on: + push: + branches: + - main + +jobs: + deploy: + name: Deploy to GitHub Pages + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js and website deps + uses: ./.github/actions/setup-website-deps + + - name: Build website + run: yarn --cwd website build + + # Popular action to deploy to GitHub Pages: + # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + # Build output to publish to the `gh-pages` branch: + publish_dir: ./website/build + # The following lines assign commit authorship to the official + # GH-Actions bot for deploys to `gh-pages` branch: + # https://github.com/actions/checkout/issues/13#issuecomment-724415212 + # The GH actions bot is used by default if you didn't specify the two fields. + # You can swap them out with your own user credentials. + user_name: github-actions[bot] + user_email: 41898282+github-actions[bot]@users.noreply.github.com diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f30783ab1..29e8eed08 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ on: branches: ['**'] jobs: - install-cached-deps: + install-cache-deps: runs-on: ubuntu-latest name: Install and Cache deps steps: @@ -14,10 +14,10 @@ jobs: uses: actions/checkout@v3 - name: Setup - uses: ./.github/actions/setup-node-deps + uses: ./.github/actions/setup-deps lint: - needs: [install-cached-deps] + needs: [install-cache-deps] runs-on: ubuntu-latest name: Lint steps: @@ -25,13 +25,13 @@ jobs: uses: actions/checkout@v3 - name: Setup Node.js and deps - uses: ./.github/actions/setup-node-deps + uses: ./.github/actions/setup-deps - name: Lint run: yarn lint typecheck: - needs: [install-cached-deps] + needs: [install-cache-deps] runs-on: ubuntu-latest name: Typecheck steps: @@ -39,13 +39,13 @@ jobs: uses: actions/checkout@v3 - name: Setup Node.js and deps - uses: ./.github/actions/setup-node-deps + uses: ./.github/actions/setup-deps - name: Typecheck run: yarn typecheck flow: - needs: [install-cached-deps] + needs: [install-cache-deps] runs-on: ubuntu-latest name: Flow steps: @@ -53,13 +53,13 @@ jobs: uses: actions/checkout@v3 - name: Setup Node.js and deps - uses: ./.github/actions/setup-node-deps + uses: ./.github/actions/setup-deps - name: Flow run: yarn flow test: - needs: [install-cached-deps] + needs: [install-cache-deps] runs-on: ubuntu-latest name: Test React 18 steps: @@ -67,7 +67,7 @@ jobs: uses: actions/checkout@v3 - name: Setup Node.js and deps - uses: ./.github/actions/setup-node-deps + uses: ./.github/actions/setup-deps - name: Test React 18 run: yarn test:ci @@ -76,7 +76,7 @@ jobs: uses: codecov/codecov-action@v2 test-react-17: - needs: [install-cached-deps] + needs: [install-cache-deps] runs-on: ubuntu-latest name: Test React 17 steps: @@ -84,21 +84,20 @@ jobs: uses: actions/checkout@v3 - name: Setup Node.js and deps - uses: ./.github/actions/setup-node-deps + uses: ./.github/actions/setup-deps - name: Test React 17 run: yarn test:ci:react:17 test-website: - needs: [install-cached-deps] runs-on: ubuntu-latest name: Test Website steps: - name: Checkout uses: actions/checkout@v3 - - name: Setup Node.js and deps - uses: ./.github/actions/setup-node-deps + - name: Setup Node.js and website deps + uses: ./.github/actions/setup-website-deps - name: Build website run: yarn --cwd website build diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index b997039ca..db189f764 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -10,6 +10,7 @@ const siteConfig = { projectName: 'react-native-testing-library', organizationName: 'callstack', favicon: 'img/owl.png', + trailingSlash: false, themeConfig: { navbar: { diff --git a/website/static/.nojekyll b/website/static/.nojekyll new file mode 100644 index 000000000..e69de29bb