-
Notifications
You must be signed in to change notification settings - Fork 9
104 lines (84 loc) · 2.98 KB
/
tests-e2e.yml
File metadata and controls
104 lines (84 loc) · 2.98 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
name: tests:e2e
on:
workflow_run:
workflows: ["👷♂️ Build Release"]
branches: [master]
types: [completed]
workflow_dispatch:
inputs:
xyd_version:
description: 'xyd-js version to install (e.g. "canary", "0.1.0-alpha.6", "latest")'
required: false
default: ''
branch:
description: 'Branch to checkout tests from'
required: false
default: ''
jobs:
test:
name: 🧪 E2E Tests
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
strategy:
matrix:
node-version: [22.12.0]
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: 🟢 Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.10.0
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 'latest'
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm i
- name: Install Playwright browsers
run: pnpm exec playwright install
- name: 🔧 Install xyd-js CLI
run: |
# Check if a custom version was provided via workflow_dispatch
CUSTOM_VERSION="${{ github.event.inputs.xyd_version }}"
if [ -n "$CUSTOM_VERSION" ]; then
echo "📦 Installing xyd-js@${CUSTOM_VERSION} (manual)"
npm i -g xyd-js@${CUSTOM_VERSION}
else
# Auto-detect from workflow_run (snapshot build)
BUILD_VERSION="${{ github.event.workflow_run.outputs.BUILD_VERSION }}"
if [ -z "$BUILD_VERSION" ]; then
SHA=$(git rev-parse HEAD)
SHORT_SHA=${SHA::7}
BUILD_VERSION=build-${SHORT_SHA}
fi
SHORT_SHA=${BUILD_VERSION#build-}
LATEST_BUILD_VERSION=$(npm view @xyd-js/cli versions --json | jq -r '.[] | select(test("^0\\.0\\.0-build-'${SHORT_SHA}'-[0-9]+$")) | .' | sort -V | tail -n1)
if [ -z "$LATEST_BUILD_VERSION" ]; then
echo "❌ No build version found for SHA: ${SHORT_SHA}"
exit 1
fi
echo "📦 Installing @xyd-js/cli@${LATEST_BUILD_VERSION}"
pnpm add -g @xyd-js/cli@${LATEST_BUILD_VERSION} --registry=https://registry.npmjs.org
fi
echo "✅ Installed version:"
xyd --version || echo "(version command not available)"
- name: 🧪 Run E2E tests
run: pnpm run test:e2e