From 42e79e6402d186f2d6fcbc36edffdb6affd8ad5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Jastrze=CC=A8bski?= Date: Wed, 18 Jan 2023 22:13:08 +0000 Subject: [PATCH 1/5] chore: deploy website to gh pages --- .circleci/config.yml | 124 --------------------- .github/actions/setup-node-deps/action.yml | 2 +- .github/workflows/deploy-website.yml | 37 ++++++ website/docs/MigrationV2.md | 2 + website/docusaurus.config.js | 1 + website/static/.nojekyll | 0 6 files changed, 41 insertions(+), 125 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/deploy-website.yml create mode 100644 website/static/.nojekyll 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-node-deps/action.yml b/.github/actions/setup-node-deps/action.yml index 5b4ba66d4..b0658beb4 100644 --- a/.github/actions/setup-node-deps/action.yml +++ b/.github/actions/setup-node-deps/action.yml @@ -7,7 +7,7 @@ runs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: '16' + node-version: 18 - name: Cache deps id: yarn-cache diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml new file mode 100644 index 000000000..9726abb40 --- /dev/null +++ b/.github/workflows/deploy-website.yml @@ -0,0 +1,37 @@ +name: Deploy Website to GitHub Pages + +on: + push: + branches: + - main + - 'chore/gh-actions-docs' + +jobs: + deploy: + name: Deploy to GitHub Pages + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js and deps + uses: ./.github/actions/setup-node-deps + + - name: Build website + run: yarn 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: ./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/website/docs/MigrationV2.md b/website/docs/MigrationV2.md index c5a113fc8..8ec78f51a 100644 --- a/website/docs/MigrationV2.md +++ b/website/docs/MigrationV2.md @@ -124,3 +124,5 @@ function flushMicrotasksQueue() { return new Promise((resolve) => setImmediate(resolve)); } ``` + +1, 2, 3 MIC CHECK 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 From 58e4bcb275120ddd698f5fe754bd25a45ba2777c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Jastrze=CC=A8bski?= Date: Wed, 18 Jan 2023 22:22:06 +0000 Subject: [PATCH 2/5] chore: fix deploy script --- .github/actions/setup-deps/action.yml | 22 +++++++++++++++++++ .../action.yml | 16 ++------------ .github/workflows/deploy-website.yml | 8 +++---- .github/workflows/main.yml | 16 +++++++------- 4 files changed, 36 insertions(+), 26 deletions(-) create mode 100644 .github/actions/setup-deps/action.yml rename .github/actions/{setup-node-deps => setup-website-deps}/action.yml (57%) 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 57% rename from .github/actions/setup-node-deps/action.yml rename to .github/actions/setup-website-deps/action.yml index b0658beb4..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 @@ -9,18 +9,6 @@ runs: 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 - - name: Cache website deps id: yarn-cache-website uses: actions/cache@v3 diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml index 9726abb40..a448a53bf 100644 --- a/.github/workflows/deploy-website.yml +++ b/.github/workflows/deploy-website.yml @@ -14,11 +14,11 @@ jobs: - 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 build + run: yarn --cwd website build # Popular action to deploy to GitHub Pages: # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus @@ -27,7 +27,7 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} # Build output to publish to the `gh-pages` branch: - publish_dir: ./build + 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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f30783ab1..1c6fff32a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v3 - name: Setup - uses: ./.github/actions/setup-node-deps + uses: ./.github/actions/setup-deps lint: needs: [install-cached-deps] @@ -25,7 +25,7 @@ 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 @@ -39,7 +39,7 @@ 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 @@ -53,7 +53,7 @@ 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 @@ -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 @@ -84,7 +84,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 17 run: yarn test:ci:react:17 @@ -97,8 +97,8 @@ jobs: - 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 From ea503c6694c1a21bf6112ec7f331cbb2bd14aeb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Jastrze=CC=A8bski?= Date: Wed, 18 Jan 2023 22:25:18 +0000 Subject: [PATCH 3/5] chore: fix deploy script --- .github/workflows/deploy-website.yml | 2 +- .github/workflows/main.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml index a448a53bf..32d6112ef 100644 --- a/.github/workflows/deploy-website.yml +++ b/.github/workflows/deploy-website.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v3 - name: Setup Node.js and website deps - uses: ./.github/actions/setup--website-deps + uses: ./.github/actions/setup-website-deps - name: Build website run: yarn --cwd website build diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c6fff32a..2e91181e2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,7 +59,7 @@ jobs: run: yarn flow test: - needs: [install-cached-deps] + needs: [lint, typecheck] runs-on: ubuntu-latest name: Test React 18 steps: @@ -76,7 +76,7 @@ jobs: uses: codecov/codecov-action@v2 test-react-17: - needs: [install-cached-deps] + needs: [test] runs-on: ubuntu-latest name: Test React 17 steps: @@ -90,7 +90,7 @@ jobs: run: yarn test:ci:react:17 test-website: - needs: [install-cached-deps] + needs: [lint, typecheck] runs-on: ubuntu-latest name: Test Website steps: @@ -98,7 +98,7 @@ jobs: uses: actions/checkout@v3 - name: Setup Node.js and website deps - uses: ./.github/actions/setup--website-deps + uses: ./.github/actions/setup-website-deps - name: Build website run: yarn --cwd website build From bf3404c03d20818ef784c5a9bc4673c60dadb477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Jastrze=CC=A8bski?= Date: Wed, 18 Jan 2023 22:30:49 +0000 Subject: [PATCH 4/5] chore: tweaks --- .github/workflows/deploy-website.yml | 3 +-- .github/workflows/main.yml | 2 +- website/docs/MigrationV2.md | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml index 32d6112ef..0e54aa6a1 100644 --- a/.github/workflows/deploy-website.yml +++ b/.github/workflows/deploy-website.yml @@ -1,10 +1,9 @@ -name: Deploy Website to GitHub Pages +name: Website on: push: branches: - main - - 'chore/gh-actions-docs' jobs: deploy: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2e91181e2..c0702b990 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -76,7 +76,7 @@ jobs: uses: codecov/codecov-action@v2 test-react-17: - needs: [test] + needs: [lint, typecheck] runs-on: ubuntu-latest name: Test React 17 steps: diff --git a/website/docs/MigrationV2.md b/website/docs/MigrationV2.md index 8ec78f51a..c5a113fc8 100644 --- a/website/docs/MigrationV2.md +++ b/website/docs/MigrationV2.md @@ -124,5 +124,3 @@ function flushMicrotasksQueue() { return new Promise((resolve) => setImmediate(resolve)); } ``` - -1, 2, 3 MIC CHECK From fa70076a060bebd96bd62b2bdb391f860368fb22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Jastrze=CC=A8bski?= Date: Wed, 18 Jan 2023 22:51:30 +0000 Subject: [PATCH 5/5] chore: tweaks --- .github/workflows/main.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c0702b990..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: @@ -17,7 +17,7 @@ jobs: uses: ./.github/actions/setup-deps lint: - needs: [install-cached-deps] + needs: [install-cache-deps] runs-on: ubuntu-latest name: Lint steps: @@ -31,7 +31,7 @@ jobs: run: yarn lint typecheck: - needs: [install-cached-deps] + needs: [install-cache-deps] runs-on: ubuntu-latest name: Typecheck steps: @@ -45,7 +45,7 @@ jobs: run: yarn typecheck flow: - needs: [install-cached-deps] + needs: [install-cache-deps] runs-on: ubuntu-latest name: Flow steps: @@ -59,7 +59,7 @@ jobs: run: yarn flow test: - needs: [lint, typecheck] + needs: [install-cache-deps] runs-on: ubuntu-latest name: Test React 18 steps: @@ -76,7 +76,7 @@ jobs: uses: codecov/codecov-action@v2 test-react-17: - needs: [lint, typecheck] + needs: [install-cache-deps] runs-on: ubuntu-latest name: Test React 17 steps: @@ -90,7 +90,6 @@ jobs: run: yarn test:ci:react:17 test-website: - needs: [lint, typecheck] runs-on: ubuntu-latest name: Test Website steps: