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

pr.yml

114 lines3.7 KB

1name: pr
2on: [pull_request]
3env:
4 NX_DAEMON: false
5 NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
6jobs:
7 agent:
8 name: 'Nx Cloud Agents'
9 runs-on: ubuntu-latest
10 timeout-minutes: 20
11 strategy:
12 matrix:
13 agent: [1, 2, 3, 4]
14 steps:
15 - uses: actions/checkout@v3
16 with:
17 fetch-depth: 0
18 ref: ${{ github.head_ref }}
19 repository: ${{github.event.pull_request.head.repo.full_name}}
20 - uses: pnpm/action-setup@v2.2.4
21 with:
22 version: 7
23 - uses: actions/setup-node@v3
24 with:
25 node-version: 16.14.2
26 cache: 'pnpm'
27 - name: Install dependencies
28 run: pnpm --filter "./packages/**" --filter query --prefer-offline install
29 - name: Start Nx Agent ${{ matrix.agent }}
30 run: npx nx-cloud start-agent
31 orchestrator:
32 name: 'Nx Cloud Orchestrator'
33 runs-on: ubuntu-latest
34 steps:
35 - uses: actions/checkout@v3
36 with:
37 fetch-depth: 0
38 ref: ${{ github.head_ref }}
39 repository: ${{github.event.pull_request.head.repo.full_name}}
40 - uses: pnpm/action-setup@v2.2.4
41 with:
42 version: 7
43 - uses: actions/setup-node@v3
44 with:
45 node-version: 16.14.2
46 cache: 'pnpm'
47 - name: Install dependencies
48 run: pnpm --filter "./packages/**" --filter query --prefer-offline install
49 - name: Derive appropriate SHAs for base and head for `nx affected` commands
50 uses: nrwl/nx-set-shas@v2
51 - run: |
52 echo "BASE: ${{ env.NX_BASE }}"
53 echo "HEAD: ${{ env.NX_HEAD }}"
54 - name: Start CI Orchestrator
55 run: npx nx-cloud start-ci-run
56 - name: Run All Checks
57 uses: nick-fields/retry@v2.8.3
58 env:
59 BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
60 with:
61 timeout_minutes: 5
62 max_attempts: 3
63 command: npx nx affected --targets=test:eslint,test:types,test:build,test:lib --base=${{ github.event.pull_request.base.sha }}
64 - name: Stop Agents
65 run: npx nx-cloud stop-all-agents
66 - name: Upload coverage to Codecov
67 uses: codecov/codecov-action@v3
68 format:
69 name: 'Format'
70 runs-on: ubuntu-latest
71 steps:
72 - uses: actions/checkout@v3
73 with:
74 fetch-depth: 0
75 ref: ${{ github.head_ref }}
76 repository: ${{github.event.pull_request.head.repo.full_name}}
77 - uses: pnpm/action-setup@v2.2.4
78 with:
79 version: 7
80 - uses: actions/setup-node@v3
81 with:
82 node-version: 16.14.2
83 cache: 'pnpm'
84 - name: Install dependencies
85 run: pnpm --filter "./packages/**" --filter query --prefer-offline install
86 - run: pnpm run test:format
87 test-react-17:
88 name: 'Test React 17'
89 runs-on: ubuntu-latest
90 steps:
91 - uses: actions/checkout@v3
92 with:
93 fetch-depth: 0
94 ref: ${{ github.head_ref }}
95 repository: ${{github.event.pull_request.head.repo.full_name}}
96 - uses: pnpm/action-setup@v2.2.4
97 with:
98 version: 7
99 - uses: actions/setup-node@v3
100 with:
101 node-version: 16.14.2
102 cache: 'pnpm'
103 - name: Install dependencies
104 run: pnpm --filter "./packages/**" --filter query --prefer-offline install
105 - name: Derive appropriate SHAs for base and head for `nx affected` commands
106 uses: nrwl/nx-set-shas@v2
107 - name: Run Tests
108 uses: nick-fields/retry@v2.8.3
109 with:
110 timeout_minutes: 5
111 max_attempts: 3
112 command: npx nx affected --targets=test:lib --base=${{ github.event.pull_request.base.sha }}
113 env:
114 REACTJS_VERSION: 17