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

pr.yml

123 lines3.4 KB

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