forked from vercel/vercel
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (119 loc) · 4.32 KB
/
test-18.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
name: Tests Node.js v18
on:
push:
branches:
- main
tags:
- '!*'
pull_request:
merge_group:
env:
VERCEL_TELEMETRY_DISABLED: '1'
NODE_VERSION: '18'
TURBO_REMOTE_ONLY: 'true'
TURBO_TEAM: 'vercel'
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
setup:
name: Find Changes
runs-on: ubuntu-latest
if: (github.event_name == 'pull_request' || github.event_name == 'merge_group') && github.event.pull_request.title != 'Version Packages'
outputs:
tests: ${{ steps['set-tests'].outputs['tests'] }}
dplUrl: ${{ steps.waitForTarball.outputs.url }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: install [email protected]
run: npm i -g [email protected]
- run: pnpm install
- id: set-tests
run: |
TESTS_ARRAY=$(node utils/chunk-tests-18.js $SCRIPT_NAME)
echo "Files to test:"
echo "$TESTS_ARRAY"
echo "tests=$TESTS_ARRAY" >> $GITHUB_OUTPUT
- uses: patrickedqvist/wait-for-vercel-preview@bfdff514ff78a669f2536e9f4dd4ef5813a704a2
id: waitForTarball
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_timeout: 360
check_interval: 5
test:
timeout-minutes: 120
runs-on: ${{ matrix.runner }}
name: ${{matrix.scriptName}} (${{matrix.packageName}}, ${{matrix.chunkNumber}}, ${{ matrix.runner }})
if: ${{ needs.setup.outputs['tests'] != '[]' }}
needs:
- setup
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.setup.outputs['tests']) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.nodeVersion || env.NODE_VERSION }}
# yarn 1.22.21 introduced a Corepack bug when running tests.
# this can be removed once https://github.com/yarnpkg/yarn/issues/9015 is resolved
- name: install [email protected]
run: npm i -g [email protected]
- name: install [email protected]
run: npm i -g [email protected]
- run: pnpm install
- name: Build ${{matrix.packageName}} and all its dependencies
run: node utils/gen.js && node_modules/.bin/turbo run build --cache-dir=".turbo" --log-order=stream --scope=${{matrix.packageName}} --include-dependencies --no-deps
env:
FORCE_COLOR: '1'
- name: Test ${{matrix.packageName}}
run: node utils/gen.js && node_modules/.bin/turbo run ${{matrix.testScript}} --summarize --cache-dir=".turbo" --log-order=stream --scope=${{matrix.packageName}} --no-deps -- ${{ join(matrix.testPaths, ' ') }}
shell: bash
env:
JEST_JUNIT_OUTPUT_FILE: ${{github.workspace}}/.junit-reports/${{matrix.scriptName}}-${{matrix.packageName}}-${{matrix.chunkNumber}}-${{ matrix.runner }}.xml
VERCEL_CLI_VERSION: ${{ needs.setup.outputs.dplUrl }}/tarballs/vercel.tgz
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_TEAM_ID: ${{ secrets.VERCEL_TEAM_ID }}
FORCE_COLOR: '1'
- name: 'Determine Turbo HIT or MISS'
if: ${{ !cancelled() }}
id: turbo-summary
shell: bash
run: |
TURBO_MISS_COUNT=`node utils/determine-turbo-hit-or-miss.js`
echo "MISS COUNT: $TURBO_MISS_COUNT"
echo "misses=$TURBO_MISS_COUNT" >> $GITHUB_OUTPUT
- name: 'Upload Test Report to Datadog'
if: ${{ steps['turbo-summary'].outputs.misses != '0' && !cancelled() }}
run: 'npx @datadog/[email protected] junit upload --service vercel-cli .junit-reports'
env:
DATADOG_API_KEY: ${{secrets.DATADOG_API_KEY_CLI}}
DD_ENV: ci
summary:
name: Summary (Node 18)
runs-on: ubuntu-latest
timeout-minutes: 5
if: always()
needs:
- test
steps:
- name: Check All
run: |-
for status in ${{ join(needs.*.result, ' ') }}
do
if [ "$status" != "success" ] && [ "$status" != "skipped" ]
then
echo "Some checks failed"
exit 1
fi
done