diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml index 27930205a..ab1420ca8 100644 --- a/.github/workflows/beta-release.yml +++ b/.github/workflows/beta-release.yml @@ -21,7 +21,27 @@ jobs: with: node-version: 16.x - - name: Install Dependencies + - name: Get current node version + id: node-version + run: | + node_version=$(node -v) + echo "node_version=$node_version" >> $GITHUB_OUTPUT + + # Attempt to cache all the node_modules directories based on the node version and package lock. + - name: Cache node_modules + id: npm-cache + uses: actions/cache@v3 + env: + cache-name: cache-node-modules-${{ steps.node-version.outputs.node_version }} + with: + key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: | + **/node_modules + !/pages-e2e/workspaces/**/node_modules + + # If the cache missed then install using `npm ci` to follow package lock exactly + - if: ${{ steps.npm-cache.outputs.cache-hit != 'true'}} + name: Install NPM Dependencies run: npm ci - name: Modify package.json version diff --git a/.github/workflows/configs-docs-scraping.yml b/.github/workflows/configs-docs-scraping.yml index f367bee04..8f4c7c39f 100644 --- a/.github/workflows/configs-docs-scraping.yml +++ b/.github/workflows/configs-docs-scraping.yml @@ -12,21 +12,46 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v3 + - name: Setup Node.js 16.x uses: actions/setup-node@v3 with: node-version: 16.x - - name: Install NPM Dependencies + + - name: Get current node version + id: node-version + run: | + node_version=$(node -v) + echo "node_version=$node_version" >> $GITHUB_OUTPUT + + # Attempt to cache all the node_modules directories based on the node version and package lock. + - name: Cache node_modules + id: npm-cache + uses: actions/cache@v3 + env: + cache-name: cache-node-modules-${{ steps.node-version.outputs.node_version }} + with: + key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: | + **/node_modules + !/pages-e2e/workspaces/**/node_modules + + # If the cache missed then install using `npm ci` to follow package lock exactly + - if: ${{ steps.npm-cache.outputs.cache-hit != 'true'}} + name: Install NPM Dependencies run: npm ci + - name: Run Checker id: run-checker working-directory: internal-packages/docs-scraper run: GH_ACTION=true npm run check-docs + - name: Generate table id: generate-table if: steps.run-checker.outputs.result == 'out-of-date' working-directory: internal-packages/docs-scraper run: GH_ACTION=true npm run generate-configs-table + - name: Create or update issue if: steps.run-checker.outputs.result == 'out-of-date' working-directory: internal-packages/docs-scraper diff --git a/.github/workflows/create-pullrequest-prerelease.yml b/.github/workflows/create-pullrequest-prerelease.yml index 297e1e7d4..bac279142 100644 --- a/.github/workflows/create-pullrequest-prerelease.yml +++ b/.github/workflows/create-pullrequest-prerelease.yml @@ -18,11 +18,29 @@ jobs: uses: actions/setup-node@v3 with: node-version: 16.13 - cache: 'npm' # cache ~/.npm in case 'npm ci' needs to run - - name: Install NPM Dependencies - run: npm ci + - name: Get current node version + id: node-version + run: | + node_version=$(node -v) + echo "node_version=$node_version" >> $GITHUB_OUTPUT + # Attempt to cache all the node_modules directories based on the node version and package lock. + - name: Cache node_modules + id: npm-cache + uses: actions/cache@v3 + env: + cache-name: cache-node-modules-${{ steps.node-version.outputs.node_version }} + with: + key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: | + **/node_modules + !/pages-e2e/workspaces/**/node_modules + + # If the cache missed then install using `npm ci` to follow package lock exactly + - if: ${{ steps.npm-cache.outputs.cache-hit != 'true'}} + name: Install NPM Dependencies + run: npm ci - name: Modify package.json version run: node .github/version-script.js PR=${{ github.event.number }} diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index e97044cb3..06f9f94c8 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -23,11 +23,43 @@ jobs: with: node-version: 16.13.x - - name: Install + - name: Get current node version + id: node-version + run: | + node_version=$(node -v) + echo "node_version=$node_version" >> $GITHUB_OUTPUT + + # Attempt to cache all the node_modules directories based on the node version and package lock + - name: Cache node_modules + id: npm-cache + uses: actions/cache@v3 + env: + cache-name: cache-node-modules-${{ steps.node-version.outputs.node_version }} + with: + key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: | + **/node_modules + !/pages-e2e/workspaces/**/node_modules + + # If the cache missed then install using `npm ci` to follow package lock exactly + - if: ${{ steps.npm-cache.outputs.cache-hit != 'true'}} + name: Install NPM Dependencies run: npm ci + - name: Cache turbo + id: turbo-cache + uses: actions/cache@v3 + with: + path: ./turbo-cache + key: cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }} + restore-keys: | + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }} + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}- + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}- + cache-turbo-${{ github.workflow }}-${{ github.job }} + - name: Check formatting - run: npm run prettier:check + run: npm run prettier:check -- --cache-dir ./turbo-cache linting: name: Linting runs-on: ubuntu-latest @@ -39,11 +71,43 @@ jobs: with: node-version: 16.13.x - - name: Install + - name: Get current node version + id: node-version + run: | + node_version=$(node -v) + echo "node_version=$node_version" >> $GITHUB_OUTPUT + + # Attempt to cache all the node_modules directories based on the node version and package lock. + - name: Cache node_modules + id: npm-cache + uses: actions/cache@v3 + env: + cache-name: cache-node-modules-${{ steps.node-version.outputs.node_version }} + with: + key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: | + **/node_modules + !/pages-e2e/workspaces/**/node_modules + + # If the cache missed then install using `npm ci` to follow package lock exactly + - if: ${{ steps.npm-cache.outputs.cache-hit != 'true'}} + name: Install NPM Dependencies run: npm ci + - name: Cache turbo + id: turbo-cache + uses: actions/cache@v3 + with: + path: ./turbo-cache + key: cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }} + restore-keys: | + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }} + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}- + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}- + cache-turbo-${{ github.workflow }}-${{ github.job }} + - name: Check linting - run: npm run lint + run: npm run lint -- --cache-dir ./turbo-cache types: name: Types runs-on: ubuntu-latest @@ -55,11 +119,43 @@ jobs: with: node-version: 16.13.x - - name: Install + - name: Get current node version + id: node-version + run: | + node_version=$(node -v) + echo "node_version=$node_version" >> $GITHUB_OUTPUT + + # Attempt to cache all the node_modules directories based on the node version and package lock. + - name: Cache node_modules + id: npm-cache + uses: actions/cache@v3 + env: + cache-name: cache-node-modules-${{ steps.node-version.outputs.node_version }} + with: + key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: | + **/node_modules + !/pages-e2e/workspaces/**/node_modules + + # If the cache missed then install using `npm ci` to follow package lock exactly + - if: ${{ steps.npm-cache.outputs.cache-hit != 'true'}} + name: Install NPM Dependencies run: npm ci + - name: Cache turbo + id: turbo-cache + uses: actions/cache@v3 + with: + path: ./turbo-cache + key: cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }} + restore-keys: | + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }} + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}- + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}- + cache-turbo-${{ github.workflow }}-${{ github.job }} + - name: Check types - run: npm run types-check + run: npm run types-check -- --cache-dir ./turbo-cache build: name: Build runs-on: ubuntu-latest @@ -71,11 +167,43 @@ jobs: with: node-version: 16.13.x - - name: Install + - name: Get current node version + id: node-version + run: | + node_version=$(node -v) + echo "node_version=$node_version" >> $GITHUB_OUTPUT + + # Attempt to cache all the node_modules directories based on the node version and package lock. + - name: Cache node_modules + id: npm-cache + uses: actions/cache@v3 + env: + cache-name: cache-node-modules-${{ steps.node-version.outputs.node_version }} + with: + key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: | + **/node_modules + !/pages-e2e/workspaces/**/node_modules + + # If the cache missed then install using `npm ci` to follow package lock exactly + - if: ${{ steps.npm-cache.outputs.cache-hit != 'true'}} + name: Install NPM Dependencies run: npm ci + - name: Cache turbo + id: turbo-cache + uses: actions/cache@v3 + with: + path: ./turbo-cache + key: cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }} + restore-keys: | + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }} + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}- + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}- + cache-turbo-${{ github.workflow }}-${{ github.job }} + - name: Build - run: npm run build + run: npm run build -- --cache-dir ./turbo-cache unit-tests: name: Unit tests runs-on: ubuntu-latest @@ -87,11 +215,43 @@ jobs: with: node-version: 16.13.x - - name: Install + - name: Get current node version + id: node-version + run: | + node_version=$(node -v) + echo "node_version=$node_version" >> $GITHUB_OUTPUT + + # Attempt to cache all the node_modules directories based on the node version and package lock. + - name: Cache node_modules + id: npm-cache + uses: actions/cache@v3 + env: + cache-name: cache-node-modules-${{ steps.node-version.outputs.node_version }} + with: + key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: | + **/node_modules + !/pages-e2e/workspaces/**/node_modules + + # If the cache missed then install using `npm ci` to follow package lock exactly + - if: ${{ steps.npm-cache.outputs.cache-hit != 'true'}} + name: Install NPM Dependencies run: npm ci + - name: Cache turbo + id: turbo-cache + uses: actions/cache@v3 + with: + path: ./turbo-cache + key: cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }} + restore-keys: | + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }} + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}-${{ github.ref_name }}- + cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.base_ref }}- + cache-turbo-${{ github.workflow }}-${{ github.job }} + - name: Run unit tests - run: npm run test:unit + run: npm run test:unit -- --cache-dir ./turbo-cache e2e-tests: name: e2e tests runs-on: ubuntu-latest @@ -103,7 +263,27 @@ jobs: with: node-version: 18.x - - name: Install + - name: Get current node version + id: node-version + run: | + node_version=$(node -v) + echo "node_version=$node_version" >> $GITHUB_OUTPUT + + # Attempt to cache all the node_modules directories based on the node version and package lock. + - name: Cache node_modules + id: npm-cache + uses: actions/cache@v3 + env: + cache-name: cache-node-modules-${{ steps.node-version.outputs.node_version }} + with: + key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: | + **/node_modules + !/pages-e2e/workspaces/**/node_modules + + # If the cache missed then install using `npm ci` to follow package lock exactly + - if: ${{ steps.npm-cache.outputs.cache-hit != 'true'}} + name: Install NPM Dependencies run: npm ci - name: Run e2e tests diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 279739d11..1ed66f7da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,27 @@ jobs: with: node-version: 16.x - - name: Install Dependencies + - name: Get current node version + id: node-version + run: | + node_version=$(node -v) + echo "node_version=$node_version" >> $GITHUB_OUTPUT + + # Attempt to cache all the node_modules directories based on the node version and package lock. + - name: Cache node_modules + id: npm-cache + uses: actions/cache@v3 + env: + cache-name: cache-node-modules-${{ steps.node-version.outputs.node_version }} + with: + key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: | + **/node_modules + !/pages-e2e/workspaces/**/node_modules + + # If the cache missed then install using `npm ci` to follow package lock exactly + - if: ${{ steps.npm-cache.outputs.cache-hit != 'true'}} + name: Install NPM Dependencies run: npm ci - name: Create Release Pull Request or Publish to npm diff --git a/.gitignore b/.gitignore index e1f23a45b..9c418d035 100644 --- a/.gitignore +++ b/.gitignore @@ -178,6 +178,7 @@ dist # Turobrepo .turbo/ +turbo-cache # pages-e2e /pages-e2e/workspaces diff --git a/package.json b/package.json index 2bd41ea98..0f54f9682 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,11 @@ "pages-e2e/features/*" ], "scripts": { - "prettier": "npx prettier --ignore-path .prettierignore --ignore-path .gitignore .", - "prettier:check": "npm run prettier -- --check", - "prettier:fix": "npm run prettier -- --write", + "prettier": "prettier --ignore-path .prettierignore --ignore-path .gitignore .", + "prettier__check": "npm run prettier -- --check", + "prettier:check": "FORCE_COLOR=1 turbo run prettier__check", + "prettier__fix": "npm run prettier -- --write", + "prettier:fix": "FORCE_COLOR=1 turbo prettier__fix", "lint": "FORCE_COLOR=1 turbo lint", "types-check": "FORCE_COLOR=1 turbo types-check", "build": "FORCE_COLOR=1 turbo build", diff --git a/turbo.json b/turbo.json index 7572abad2..a73de7b6e 100644 --- a/turbo.json +++ b/turbo.json @@ -10,13 +10,13 @@ "outputs": ["dist/**"] }, "lint": {}, - "prettier:fix": { + "//#prettier__check": {}, + "//#prettier__fix": { "cache": false }, "types-check": {}, "test:unit": { - "persistent": true, - "cache": false + "persistent": true }, "publish": {} }