Skip to content

Commit

Permalink
fix(repo): Retheme node_modules cache (#2351)
Browse files Browse the repository at this point in the history
* fix(repo): Retheme node_modules cache

* fix(*): Apply `$TURBO_ARGS` to retheme
  • Loading branch information
tmilewski authored Dec 14, 2023
1 parent 6063f78 commit a6eb828
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .changeset/sixty-frogs-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ packages/*/dist/**
packages/eslint-config-custom/**
**/dist/*
**/build/*
**/.turbo/*
playground
packages/*/examples
.github
.idea
.vscode
.turbo
Expand Down
2 changes: 1 addition & 1 deletion .github/.cache-version
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Update this file to invalidate **all** cache on GitHub actions (use sparingly)

version: v1
version: v2
4 changes: 4 additions & 0 deletions .github/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: [require.resolve('../packages/eslint-config-custom/github-actions')]
};
10 changes: 9 additions & 1 deletion .github/actions/init/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ inputs:
description: 'Enable Playwright?'
required: false
default: 'false'
cache-suffix:
description: 'The cache suffix to use'
required: false
default: ''
turbo-summarize:
description: 'The token to use for Turbo task summaries'
required: false
Expand Down Expand Up @@ -101,13 +105,17 @@ runs:
id: npm-cache
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ inputs.node-version }}-${{ hashFiles('.github/.cache-version') }}-node-modules-${{ hashFiles('package-lock.json') }}
key: ${{ runner.os }}-node-${{ inputs.node-version }}-${{ hashFiles('.github/.cache-version') }}-node-modules-${{ hashFiles('package-lock.json') }}${{ inputs.cache-suffix }}

- name: Install NPM Dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci --audit=false --fund=false
shell: bash

- name: Lint GitHub Actions Workflows
run: npx eslint .github
shell: bash

- name: Get Playwright Version
if: inputs.playwright-enabled == 'true'
shell: bash
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ jobs:

- name: Lint types using attw
timeout-minutes: ${{ fromJSON(vars.TIMEOUT_MINUTES_SHORT) }}
run: npx turbo lint:attw --filter=!nextjs --only
run: npx turbo lint:attw $TURBO_ARGS --filter=!nextjs --only

- name: Lint types using attw [Errors Allowed]
timeout-minutes: ${{ fromJSON(vars.TIMEOUT_MINUTES_SHORT) }}
run: npx turbo lint:attw --filter=nextjs --continue --only
run: npx turbo lint:attw $TURBO_ARGS --filter=nextjs --continue --only
continue-on-error: true # TODO: Remove this when all related errors are fixed

- name: Run lint
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
uses: ./.github/actions/verdaccio
with:
publish-cmd: |
if [ "$(npm config get registry)" = "https://registry.npmjs.org/" ]; then echo 'Error: Using default registry' && exit 1; else npx turbo build $TURBO_ARGS && npx changeset publish --no-git-tag; fi
if [ "$(npm config get registry)" = "https://registry.npmjs.org/" ]; then echo 'Error: Using default registry' && exit 1; else npx turbo build $TURBO_ARGS --only && npx changeset publish --no-git-tag; fi
- name: Install @clerk/backend in /integration
working-directory: ./integration
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/preview.retheme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:
id: config
uses: ./.github/actions/init
with:
cache-suffix: "-retheme"
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
turbo-team: ${{ vars.TURBO_TEAM }}
turbo-token: ${{ secrets.TURBO_TOKEN }}
registry-url: "https://registry.npmjs.org"

- name: Build packages
run: |
npx turbo build
run: npx turbo build $TURBO_ARGS

- name: Install site in isolation
run: node scripts/install-site-in-isolation.mjs playground/nextjs
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ node_modules
package-lock.json
playground
packages/backend/tests/**/*.js
/**/CHANGELOG.md
/**/CHANGELOG.md
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/eslint-config-custom/_constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ module.exports = {
JAVASCRIPT_FILES: ['*.js?(x)', '*.mjs'],
TYPESCRIPT_FILES: ['*.ts?(x)'],
TEST_FILES: ['*.test.js?(x)', '*.test.ts?(x)', 'test/**', '__tests__/**'],
YAML_FILES: ['*.yml', '*.yaml'],
};
22 changes: 22 additions & 0 deletions packages/eslint-config-custom/github-actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const { YAML_FILES } = require('./_constants');

module.exports = {
plugins: ['eslint-plugin-regex'],
overrides: [
{
files: YAML_FILES,
parser: 'any-eslint-parser',
rules: {
'regex/invalid': [
'error',
[
{
regex: '^(?!.*\\$TURBO_ARGS( |$)).*turbo \\S+',
message: 'Invalid turbo CI command. Must contain `$TURBO_ARGS`',
},
],
],
},
},
],
};
2 changes: 2 additions & 0 deletions packages/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"dependencies": {
"@next/eslint-plugin-next": "^12.3.0",
"@vercel/style-guide": "^5.0.1",
"any-eslint-parser": "^1.0.1",
"eslint-config-prettier": "^9.0.0",
"eslint-config-turbo": "^1.10.14",
"eslint-plugin-playwright": "^0.17.0",
"eslint-plugin-qunit": "^8.0.1",
"eslint-plugin-regex": "^1.10.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-unused-imports": "^3.0.0"
},
Expand Down

0 comments on commit a6eb828

Please sign in to comment.