Repository navigation
176 lines (156 loc) · 5.57 KB
/
Copy pathplatform-tests-all.yml
File metadata and controls
176 lines (156 loc) · 5.57 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Platform Tests (All)
on:
workflow_dispatch:
inputs:
sha:
description: 'Commit SHA to test and update check status on'
required: false
default: ''
platform:
description: 'Platform to test'
type: choice
options: [all, netlify, vercel, node, bun]
default: all
permissions:
contents: read # to fetch code (actions/checkout); `{}` would strip it from the called workflows too
defaults:
run:
shell: bash
jobs:
netlify:
name: netlify / ${{ matrix.variant }}
if: github.repository == 'sveltejs/kit' && (inputs.platform == 'all' || inputs.platform == 'netlify')
strategy:
fail-fast: false
matrix:
variant: [basic, edge, instrumentation, split]
include:
- variant: split-edge
app: split
uses: ./.github/workflows/platform-test.yml
with:
sha: ${{ inputs.sha || github.sha }}
platform: netlify
variant: ${{ matrix.variant }}
app: ${{ matrix.app || matrix.variant }}
# the secrets of a job's environment only resolve in a called workflow when the caller passes `secrets`
secrets: inherit
vercel:
name: vercel / ${{ matrix.variant }}
if: github.repository == 'sveltejs/kit' && (inputs.platform == 'all' || inputs.platform == 'vercel')
strategy:
fail-fast: false
matrix:
variant: [basic, split]
uses: ./.github/workflows/platform-test.yml
with:
sha: ${{ inputs.sha || github.sha }}
platform: vercel
variant: ${{ matrix.variant }}
app: ${{ matrix.variant }}
secrets: inherit
node:
name: node / ${{ matrix.node-version }} / ${{ matrix.os }}
if: github.repository == 'sveltejs/kit' && (inputs.platform == 'all' || inputs.platform == 'node')
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- { node-version: 22, os: ubuntu-latest }
- { node-version: 24, os: ubuntu-latest }
- { node-version: 24, os: windows-latest }
environment: '@sveltejs/adapter-node platform tests'
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
APP: packages/adapter-node/test/apps/basic
steps:
- run: git config --global core.autocrlf false
- &checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.sha || github.sha }}
persist-credentials: false
- uses: ./.github/actions/node-setup
with:
node-version: ${{ matrix.node-version }}
- &install-playwright
name: Install Playwright
run: pnpm playwright install chromium --no-shell
- &test
name: Run Playwright tests
working-directory: ${{ env.APP }}
run: pnpm test:platform
- &upload-test-results
name: Upload test artifacts
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: test-results-${{ github.job }}-${{ strategy.job-index }}
path: ${{ env.APP }}/test-results
retention-days: 3
bun:
if: github.repository == 'sveltejs/kit' && (inputs.platform == 'all' || inputs.platform == 'bun')
runs-on: ubuntu-latest
timeout-minutes: 15
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
APP: packages/adapter-bun/test/apps/basic
steps:
- *checkout
- uses: ./.github/actions/node-setup
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.3
- *install-playwright
- *test
- name: Test compiled executable
working-directory: ${{ env.APP }}
env:
COMPILE: 'true'
run: pnpm test:platform
- name: Compile optimized cross-target executable
working-directory: ${{ env.APP }}
env:
ADVANCED_COMPILE: 'true'
COMPILE_TARGET: 'bun-linux-x64'
run: |
bun run --bun build
test -x build/advanced-app
- *upload-test-results
report-status:
if: always() && github.repository == 'sveltejs/kit' && inputs.platform == 'all'
needs: [netlify, vercel, node, bun]
runs-on: ubuntu-latest
permissions:
contents: write # to create the repository_dispatch event
steps:
- name: Report results
env:
GH_TOKEN: ${{ github.token }}
SHA: ${{ inputs.sha || github.sha }}
CONCLUSION: ${{ contains(needs.*.result, 'failure') && 'failure' || contains(needs.*.result, 'cancelled') && 'cancelled' || 'success' }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
case "$CONCLUSION" in
failure)
title='Platform tests failed'
summary="One or more platform test jobs failed. See the [workflow run]($RUN_URL) for details."
;;
cancelled)
title='Platform tests cancelled'
summary='Platform tests were cancelled before completing.'
;;
success)
title='Platform tests passed'
summary='All platform test jobs passed.'
;;
esac
gh api "repos/$GITHUB_REPOSITORY/dispatches" \
-f event_type=platform-tests-result \
-f "client_payload[sha]=$SHA" \
-f "client_payload[conclusion]=$CONCLUSION" \
-f "client_payload[title]=$title" \
-f "client_payload[summary]=$summary" \
-f "client_payload[details_url]=$RUN_URL"