Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

pr.yml

99 lines2.9 KB

1name: pr
2​
3on: [pull_request]
4​
5concurrency:
6 group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
7 cancel-in-progress: true
8​
9env:
10 NX_CLOUD_DISTRIBUTED_EXECUTION: true
11 NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT: 3
12 NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
13 NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}
14​
15jobs:
16 main:
17 name: Nx Cloud - Main Job
18 runs-on: ubuntu-latest
19 steps:
20 - uses: actions/checkout@v4
21 with:
22 fetch-depth: 0
23 - name: Setup pnpm
24 uses: pnpm/action-setup@v2
25 with:
26 version: 8
27 - name: Setup Node
28 uses: actions/setup-node@v3
29 with:
30 node-version-file: .nvmrc
31 cache: pnpm
32 cache-dependency-path: pnpm-lock.yaml
33 - name: Install dependencies
34 run: pnpm --filter "./packages/**" --filter query --prefer-offline install
35 - name: Get appropriate base and head commits for `nx affected` commands
36 uses: nrwl/nx-set-shas@v3
37 with:
38 main-branch-name: 'main'
39 - run: |
40 echo "BASE: ${{ env.NX_BASE }}"
41 echo "HEAD: ${{ env.NX_HEAD }}"
42 - name: Start CI Orchestrator
43 run: npx nx-cloud start-ci-run
44 - name: Run Tests
45 uses: nick-fields/retry@v2.8.3
46 with:
47 timeout_minutes: 5
48 max_attempts: 3
49 command: npx nx affected --targets=test:eslint,test:lib,test:types,test:build,test:bundle
50 - name: Stop Agents
51 run: npx nx-cloud stop-all-agents
52 - name: Upload coverage to Codecov
53 uses: codecov/codecov-action@v3
54 agents:
55 name: Nx Cloud - Agents
56 runs-on: ubuntu-latest
57 timeout-minutes: 10
58 strategy:
59 matrix:
60 agent: [1, 2, 3]
61 steps:
62 - uses: actions/checkout@v4
63 with:
64 fetch-depth: 0
65 - name: Setup pnpm
66 uses: pnpm/action-setup@v2
67 with:
68 version: 8
69 - name: Setup Node
70 uses: actions/setup-node@v3
71 with:
72 node-version-file: .nvmrc
73 cache: pnpm
74 cache-dependency-path: pnpm-lock.yaml
75 - name: Install dependencies
76 run: pnpm --filter "./packages/**" --filter query --prefer-offline install
77 - name: Start Nx Agent ${{ matrix.agent }}
78 run: npx nx-cloud start-agent
79 format:
80 name: Format
81 runs-on: ubuntu-latest
82 steps:
83 - uses: actions/checkout@v4
84 with:
85 fetch-depth: 0
86 - name: Setup pnpm
87 uses: pnpm/action-setup@v2
88 with:
89 version: 8
90 - name: Setup Node
91 uses: actions/setup-node@v3
92 with:
93 node-version-file: .nvmrc
94 cache: pnpm
95 cache-dependency-path: pnpm-lock.yaml
96 - name: Install dependencies
97 run: pnpm --filter "./packages/**" --filter query --prefer-offline install
98 - name: Run prettier
99 run: pnpm run test:format