-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (125 loc) · 4.71 KB
/
ci.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
name: CI
on:
push:
jobs:
unit_test:
name: 'Unit Tests'
runs-on: ubuntu-latest
# strategy:
# matrix:
# node-version: [16.x, 18.x]
steps:
- name: Checkout repo
uses: actions/checkout@v3
# - name: Install bun manually
# run: env|sort;curl -fsSL https://bun.sh/install | bash && mv ~/.bun/bin/bun /usr/local/bin && cd /usr/local/bin && ln -s bun bunx
# https://bun.sh/guides/runtime/cicd
- name: Install bun
uses: oven-sh/setup-bun@v1
# run any `bun` or `bunx` command
- name: bun version
run: bun --version
- name: Install dependencies
run: bun install --frozen-lockfile
- name: lint
run: bun run lint && bun run eslint
- name: unit test
run: bun run test:unit
# - name: e2e test
# run: bun run test:e2e
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v3
# with:
# node-version: ${{ matrix.node-version }}
# cache: 'npm'
# - run: npm ci
# - run: npm run build --if-present
# - run: npm test
# Playwright Tests
# output report
# need to preview with npx playwright show-report name-of-my-extracted-playwright-report
on_ubuntu:
name: 'Playwright Tests : runs on ubuntu'
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install Playwright Browsers
run: bunx playwright install --with-deps
- name: Build
run: bun run build
- name: Run Playwright tests. If some error found, you maybe forgot to update snapshots
# this environment does not match fonts...
run: bunx playwright test --update-snapshots
# output to HTML
# use container
html_report:
name: 'Playwright Tests : running on playwright container and report to html'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.41.2-jammy
steps:
- uses: actions/checkout@v3
- name: install unzip
run: apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
- uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install Playwright Browsers
run: bunx playwright install msedge && bunx playwright install chrome
- name: Build
run: bun run build
- name: Run your tests
run: HOME=/root bunx playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
# this action does not work current configuration (github-pages branch or TOKEN)
# - name: Deploy result into github pages subdir
# # https://github.com/marketplace/actions/github-pages-action
# if: always() # We want this to always run, even if test fail prior to this step running
# uses: peaceiris/[email protected]
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# destination_dir: .playwright-report
# publish_dir: ./playwright-report/
# keep_files: true
- name: Add notes into GitHub Step Summary
if: always()
run: |
echo '# How to preview result' >> $GITHUB_STEP_SUMMARY
echo 'Download playwright-report.zip from Artifacts above.' >> $GITHUB_STEP_SUMMARY
echo >> $GITHUB_STEP_SUMMARY
echo '```sh' >> $GITHUB_STEP_SUMMARY
echo 'mkdir tmp' >> $GITHUB_STEP_SUMMARY
echo 'cd tmp' >> $GITHUB_STEP_SUMMARY
echo 'mv ~/Downloads/playwright-report.zip ./' >> $GITHUB_STEP_SUMMARY
echo 'unzip playwright-report.zip' >> $GITHUB_STEP_SUMMARY
echo 'bunx vite preview --host 0.0.0.0 --outDir .' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
# output to github
# use container
github_report:
name: 'Playwright Tests : running on playwright container and report to github'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.41.2-jammy
steps:
- uses: actions/checkout@v3
- name: install unzip
run: apt-get update && apt-get install -y unzip && rm -rf /var/lib/apt/lists/*
- uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install Playwright Browsers
run: bunx playwright install msedge && bunx playwright install chrome
- name: Build
run: bun run build
- name: Run your tests
run: HOME=/root GITHUB_REPORT=1 bunx playwright test