Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Re-enable Nx Distributed Task Execution #5518

Merged
merged 17 commits into from
Jun 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: ci
concurrency:
group: publish-${{ github.github.base_ref }}
cancel-in-progress: true

on:
workflow_dispatch:
inputs:
Expand All @@ -13,9 +11,15 @@ on:
- 'main'
- 'alpha'
- 'beta'

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

env:
NX_DAEMON: false
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}

jobs:
test-and-publish:
if: github.repository == 'TanStack/query' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta')
Expand Down
98 changes: 77 additions & 21 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,90 @@ concurrency:
cancel-in-progress: true

env:
NX_CLOUD_DISTRIBUTED_EXECUTION: true
NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT: 3
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}

jobs:
main:
name: Nx Cloud
uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.13.0
with:
node-version: 18.16.0
pnpm-version: 8.6.0
main-branch-name: alpha
artifacts-name: nx-cloud-artifact
artifacts-path: |
**/build/**
**/coverage/**
!**/node_modules/**
parallel-commands: |
npx nx test:format
npx nx affected --targets=test:eslint,test:types,test:build,test:lib
codecov:
name: Codecov
needs: main
name: Nx Cloud - Main Job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Downloading artifacts
uses: actions/download-artifact@v3
with:
name: nx-cloud-artifact
path: .
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- name: Get appropriate base and head commits for `nx affected` commands
uses: nrwl/nx-set-shas@v3
with:
main-branch-name: 'alpha'
- run: |
echo "BASE: ${{ env.NX_BASE }}"
echo "HEAD: ${{ env.NX_HEAD }}"
- name: Start CI Orchestrator
run: npx nx-cloud start-ci-run
- name: Run Tests
uses: nick-fields/retry@v2.8.3
with:
timeout_minutes: 5
max_attempts: 3
command: npx nx affected --targets=test:eslint,test:lib,test:types,test:build
- name: Stop Agents
run: npx nx-cloud stop-all-agents
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
agents:
name: Nx Cloud - Agents
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
agent: [1, 2, 3]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- name: Start Nx Agent ${{ matrix.agent }}
run: npx nx-cloud start-agent
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- name: Run prettier
run: pnpm run test:format
23 changes: 9 additions & 14 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@
"test:eslint",
"test:types",
"test:build",
"build",
"build:rollup",
"build:codemods",
"build:types"
"build"
],
"parallel": 5,
"parallel": 3,
"accessToken": "ZDdkNDA4MGEtYjNmYi00MWI4LWE1N2QtYTdlNmYxMGJlZWM2fHJlYWQ="
}
}
Expand All @@ -29,25 +26,23 @@
}
},
"namedInputs": {
"globalBuildAffectingConfig": [
"sharedGlobals": [
"{workspaceRoot}/.browserslistrc",
"{workspaceRoot}/.eslintrc.cjs",
"{workspaceRoot}/babel.config.cjs",
"{workspaceRoot}/package.json",
"{workspaceRoot}/scripts/getRollupConfig.js",
"{workspaceRoot}/tsconfig.json"
],
"globalNonBuildAffectingConfig": ["{workspaceRoot}/.eslintrc.cjs"],
"default": [
"sharedGlobals",
"{projectRoot}/**/*",
"globalBuildAffectingConfig",
"globalNonBuildAffectingConfig",
"!{projectRoot}/**/*.md",
"!{projectRoot}/**/build/**/*"
"!{projectRoot}/**/*.md"
],
"public": [
"default",
"!{workspaceRoot}/.eslintrc.cjs",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"{projectRoot}/build",
"{projectRoot}/dist",
"!{projectRoot}/.eslintrc.cjs",
"!{projectRoot}/tsconfig.eslint.json"
]
Expand All @@ -69,7 +64,7 @@
"build": {
"dependsOn": ["^build"],
"inputs": ["default", "^public"],
"outputs": ["{projectRoot}/build/**/*"]
"outputs": ["{projectRoot}/build", "{projectRoot}/dist"]
},
"test:build": {
"dependsOn": ["build"],
Expand Down