Skip to content

Commit

Permalink
chore: Update to Nx v17 (#539)
Browse files Browse the repository at this point in the history
* Update CI run condition

* Update to Nx v17

* Attempt to fix scripts

* Fully utilise Nx for PR workflow
  • Loading branch information
lachlancollins authored Dec 31, 2023
1 parent 5615221 commit 63d6aea
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 310 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ concurrency:
cancel-in-progress: true

env:
NX_DAEMON: false
NX_VERBOSE_LOGGING: true
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
test-and-publish:
if: github.repository == 'TanStack/form' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta')
name: 'Test & Publish'
name: Test & Publish
if: github.repository == 'TanStack/form'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
105 changes: 6 additions & 99 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ concurrency:
cancel-in-progress: true

env:
NX_DAEMON: false
NX_VERBOSE_LOGGING: true
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_VERBOSE_LOGGING: true

jobs:
test:
Expand All @@ -24,36 +23,6 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'pnpm'
- name: Install dependencies
run: pnpm --prefer-offline install --no-frozen-lockfile
- name: Run Tests
uses: nick-fields/retry@v2.8.3
with:
command: pnpm test:lib --base=${{ github.event.pull_request.base.sha }}
timeout_minutes: 5
max_attempts: 3
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
lint:
name: 'Lint'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
Expand All @@ -64,74 +33,12 @@ jobs:
node-version-file: .nvmrc
cache: 'pnpm'
- name: Install dependencies
run: pnpm --prefer-offline install --no-frozen-lockfile
- run: pnpm run test:eslint --base=${{ github.event.pull_request.base.sha }}
typecheck:
name: 'Typecheck'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'pnpm'
- name: Install dependencies
run: pnpm --prefer-offline install --no-frozen-lockfile
- run: pnpm run test:types --base=${{ github.event.pull_request.base.sha }}
format:
name: 'Format'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'pnpm'
- name: Install dependencies
run: pnpm --prefer-offline install --no-frozen-lockfile
- run: pnpm run test:format --base=${{ github.event.pull_request.base.sha }}
test-build:
name: 'Test Build'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'pnpm'
- name: Install dependencies
run: pnpm --prefer-offline install --no-frozen-lockfile
run: pnpm install --frozen-lockfile --prefer-offline
- name: Get appropriate base and head commits for `nx affected` commands
uses: nrwl/nx-set-shas@v3
with:
main-branch-name: 'main'
- run: pnpm run test:build
env:
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
- name: Run Checks
run: pnpm run test:pr
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ dist
.idea

nx-cloud.env

.nx/cache
.tsup
33 changes: 12 additions & 21 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,14 @@
"affected": {
"defaultBase": "main"
},
"tasksRunnerOptions": {
"default": {
"runner": "nx-cloud",
"options": {
"cacheableOperations": [
"test:lib",
"test:eslint",
"test:types",
"test:build",
"build"
],
"parallel": 5,
"accessToken": "OTI3Y2U3NGQtYzQ3ZC00ZmE3LWJjZWQtYTYxOTEyNmNiN2IyfHJlYWQtb25seQ=="
}
}
},
"defaultBase": "main",
"pluginsConfig": {
"@nrwl/js": {
"analyzeSourceFiles": false
}
},
"nxCloudAccessToken": "OTI3Y2U3NGQtYzQ3ZC00ZmE3LWJjZWQtYTYxOTEyNmNiN2IyfHJlYWQtb25seQ==",
"parallel": 5,
"namedInputs": {
"sharedGlobals": [
"{workspaceRoot}/.browserslistrc",
Expand All @@ -49,24 +35,29 @@
"test:lib": {
"dependsOn": ["^build"],
"inputs": ["default", "^public"],
"outputs": ["{projectRoot}/coverage"]
"outputs": ["{projectRoot}/coverage"],
"cache": true
},
"test:eslint": {
"dependsOn": ["^build"],
"inputs": ["default", "^public"]
"inputs": ["default", "^public"],
"cache": true
},
"test:types": {
"dependsOn": ["^build"],
"inputs": ["default", "^public"]
"inputs": ["default", "^public"],
"cache": true
},
"build": {
"dependsOn": ["^build"],
"inputs": ["default", "^public"],
"outputs": ["{projectRoot}/build", "{projectRoot}/dist"]
"outputs": ["{projectRoot}/build", "{projectRoot}/dist"],
"cache": true
},
"test:build": {
"dependsOn": ["build"],
"inputs": ["^public"]
"inputs": ["^public"],
"cache": true
}
}
}
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@
"preinstall": "node -e \"if(process.env.CI == 'true') {console.log('Skipping preinstall...'); process.exit(1)}\" || npx -y only-allow pnpm",
"install:csb": "corepack enable && pnpm install --frozen-lockfile",
"test": "pnpm run test:ci",
"test:ci": "nx affected --exclude=examples/** --targets=test:format,test:eslint,test:lib,test:types,build,test:build",
"test:pr": "nx affected --targets=test:format,test:eslint,test:lib,test:types,build,test:build --exclude=examples/**",
"test:ci": "nx run-many --targets=test:format,test:eslint,test:lib,test:types,build,test:build --exclude=examples/**",
"test:eslint": "nx affected --target=test:eslint",
"test:format": "pnpm run prettier --check",
"test:lib": "nx affected --target=test:lib",
"test:lib:dev": "pnpm --filter \"./packages/**\" run test:lib:dev",
"test:build": "nx affected --target=test:build",
"test:types": "nx affected --target=test:types",
"build": "nx run-many --exclude=examples/** --target=build",
"watch": "pnpm run build && nx watch --all -- pnpm run build",
"test:lib": "nx affected --target=test:lib --exclude=examples/**",
"test:lib:dev": "pnpm run test:lib && nx watch --all -- pnpm run test:lib",
"test:build": "nx affected --target=test:build --exclude=examples/**",
"test:types": "nx affected --target=test:types --exclude=examples/**",
"build": "nx affected --target=build --exclude=examples/**",
"build:all": "nx run-many --target=build --exclude=examples/**",
"watch": "pnpm run build:all && nx watch --all -- pnpm run build:all",
"dev": "pnpm run watch",
"prettier": "prettier \"{packages,examples,scripts}/**/*.{md,js,jsx,cjs,ts,tsx,json,vue}\"",
"prettier:write": "pnpm run prettier --write",
Expand Down Expand Up @@ -70,8 +72,7 @@
"jsdom": "^22.0.0",
"jsonfile": "^6.1.0",
"luxon": "^3.3.0",
"nx": "^16.7.4",
"nx-cloud": "^16.0.5",
"nx": "17.2.8",
"prettier": "^3.0.2",
"publint": "^0.1.15",
"react": "^18.2.0",
Expand Down
Loading

0 comments on commit 63d6aea

Please sign in to comment.