-
Notifications
You must be signed in to change notification settings - Fork 298
71 lines (62 loc) · 2.08 KB
/
test-preview.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
name: Playwright + Argos Tests
on:
# Trigger on deployment event
deployment_status:
workflow_dispatch:
# Trigger when a label is added to a PR
pull_request:
types:
- labeled
jobs:
test:
# Run tests only if the deployment is successful
if: |
(
github.event_name == 'deployment_status' &&
github.event.deployment_status.state == 'success' &&
contains(github.event.deployment_status.deployment.payload.pull_request.labels.*.name, 'visual-test')
) || (
github.event_name == 'pull_request' &&
github.event.action == 'labeled' &&
github.event.label.name == 'visual-test'
)
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Check out docs repo
uses: actions/checkout@v4
with:
repository: ClickHouse/clickhouse-docs
path: ./
# Step 2: Setup node
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.0'
cache: 'yarn'
# Debug: List files in the working directory
- name: List files
run: ls -la
# Step 3: Download reference docs
- name: Download Reference Docs
run: |
curl https://codeload.github.com/ClickHouse/ClickHouse/tar.gz/master | tar -xz -C ./ --strip=2 "ClickHouse-master/docs/"
cp -R ./en docs/
cp -R ./ru docs/
cp -R ./zh docs/
# Step 4: Install dependencies and build the site
- name: Install and build
run: |
export NODE_OPTIONS="--max_old_space_size=4096"
npm install -g yarn
yarn install
yarn build
# Step 5: Run Playwright tests
- name: Run Playwright tests
run: yarn playwright test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_URL: ${{ github.event.deployment_status.environment_url }}
ARGOS_BRANCH: ${{ github.event.deployment_status.environment == 'Production' && 'main' || github.ref_name }}
CI: true
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}