-
Notifications
You must be signed in to change notification settings - Fork 35
144 lines (134 loc) · 5.39 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Run tests
on:
push:
paths:
- ".github/workflows/**"
- "packages/**"
- "integration-test/**"
- "yarn.lock"
pull_request:
paths:
- ".github/workflows/**"
- "packages/**"
- "integration-test/**"
- "yarn.lock"
workflow_dispatch:
jobs:
matrix:
name: Determine if the `next` tag is higher than the `latest` tag
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "yarn"
- run: yarn install --immutable
- name: Calculate Matrix
id: version
run: yarn matrix | tee $GITHUB_OUTPUT
test:
name: Unit Tests
needs: matrix
if: |
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ${{ fromJson(needs.matrix.outputs.version) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.11.0"
cache: "yarn"
- run: yarn install --immutable
- run: yarn workspaces foreach --all --include "@apollo/*" add -D -P @apollo/client@${{ matrix.version }}
- run: yarn workspaces foreach --all --include "@apollo/*" run build
- run: yarn workspaces foreach --all --include "@apollo/*" run test | tee $GITHUB_STEP_SUMMARY; exit ${PIPESTATUS[0]}
packageShapes:
name: Test Bundles
needs: matrix
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ${{ fromJson(needs.matrix.outputs.version) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "yarn"
- run: yarn install --immutable
- run: yarn workspaces foreach --all --include "@apollo/*" add -D -P @apollo/client@${{ matrix.version }}
- run: yarn workspaces foreach --all --include "@apollo/*" run test-bundle | tee $GITHUB_STEP_SUMMARY; exit ${PIPESTATUS[0]}
tests_playwright:
name: Integration Tests
needs: matrix
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ${{ fromJson(needs.matrix.outputs.version) }}
defaults:
run:
working-directory: ./integration-test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "yarn"
- name: Install Packages (Root)
run: yarn install --immutable
working-directory: ./
- name: Set target version of Apollo Client (Root)
run: yarn workspaces foreach --all --include "@apollo/*" add -D -P @apollo/client@${{ matrix.version }}
working-directory: ./
- name: Install Packages (Integration Test)
run: |
yarn install
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: "false"
- name: Set target version of Apollo Client (Integration Test)
run: yarn workspaces foreach --all --include "@integration-test/*" add @apollo/client@${{ matrix.version }}
- name: Get installed Playwright version
id: playwright-version
run: yarn why @playwright/test --json | jq '.children|to_entries[0].value.locator' --raw-output | sed 's/^.*npm:/PLAYWRIGHT_VERSION=/' >> $GITHUB_ENV
- name: Cache playwright binaries
uses: actions/cache@v4
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- run: npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- run: npx playwright install-deps
if: steps.playwright-cache.outputs.cache-hit == 'true'
- name: "Next.js: Build"
run: yarn workspace @integration-test/nextjs run build
# Upload webpack-stats.json to use on relative-ci.yaml workflow
- name: Upload webpack stats artifact
if: matrix.version == 'latest'
uses: relative-ci/agent-upload-artifact-action@v2
with:
webpackStatsFile: ./integration-test/nextjs/webpack-stats.json
- name: "Next.js: Test"
run: yarn workspace @integration-test/nextjs run test | tee $GITHUB_STEP_SUMMARY; exit ${PIPESTATUS[0]}
- name: "Experimentally patched React: Build"
run: yarn workspace @integration-test/experimental-react run build
- name: "Experimentally patched React: Test"
run: yarn workspace @integration-test/experimental-react run test | tee $GITHUB_STEP_SUMMARY; exit ${PIPESTATUS[0]}
- name: "Vite Streaming: Build"
run: yarn workspace @integration-test/vite-streaming run build
- name: "Vite Streaming: Test"
run: yarn workspace @integration-test/vite-streaming run test | tee $GITHUB_STEP_SUMMARY; exit ${PIPESTATUS[0]}
- name: "Jest: Test"
run: yarn workspace @integration-test/jest run test | tee $GITHUB_STEP_SUMMARY; exit ${PIPESTATUS[0]}