Repository navigation
118 lines (100 loc) · 3.89 KB
/
Copy pathtest.yml
File metadata and controls
118 lines (100 loc) · 3.89 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
name: Test
on:
workflow_call:
secrets:
SONAR_TOKEN:
required: true
permissions: {}
jobs:
run-unit-tests:
name: Run Tests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Vite+
uses: voidzero-dev/setup-vp@3754dd7dbdb32bd8f6d28b6043de13ad3a75f21f # v1.21.1
with:
cache: true
node-version-file: '.nvmrc'
- name: Run tests with coverage
run: vp run test
- name: Archive code coverage results
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: code-coverage-report
path: coverage/lcov.info
visual-regression:
name: Visual Regression
# arm64 to match `scripts/visual.sh`, which cannot generate amd64 baselines
# because Chromium segfaults under emulation on Apple Silicon.
runs-on: ubuntu-26.04-arm
permissions:
contents: read
# The same image the baselines were generated with. The committed
# screenshots are comparable only against an identical browser build and
# font stack, which a bare runner does not provide.
#
# This tag must match the `playwright` devDependency, which ships the
# matching browser build. Renovate groups the two so they always move
# together; `scripts/visual.sh` reads the version straight from package.json.
container: mcr.microsoft.com/playwright:v1.63.0-noble@sha256:eff16c30e6f3f4af0a03fa4b706120d5e9b0891c344a27d64559aff5900a4a27
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Vite+
uses: voidzero-dev/setup-vp@3754dd7dbdb32bd8f6d28b6043de13ad3a75f21f # v1.21.1
with:
cache: true
node-version-file: '.nvmrc'
- name: Run visual regression tests
# The job already runs in the pinned image, so the script runs vitest
# directly instead of starting another container.
env:
GITIFY_VISUAL_IN_CONTAINER: '1'
run: vp run test:visual
# Vitest writes the actual and diff images here; the reference stays in
# __screenshots__. Download this to see what changed.
- name: Archive visual diffs
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: visual-regression-diffs
path: .vitest-attachments/
include-hidden-files: true
if-no-files-found: ignore
sonarqube:
name: SonarQube Cloud Analysis
runs-on: ubuntu-latest
needs: run-unit-tests
permissions:
contents: read
# Only analyze PRs from the same repository. Limitation of SonarQube Cloud
if: github.event.pull_request.head.repo.fork == false
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
persist-credentials: false
- name: Setup Vite+
uses: voidzero-dev/setup-vp@3754dd7dbdb32bd8f6d28b6043de13ad3a75f21f # v1.21.1
with:
cache: true
node-version-file: '.nvmrc'
- name: Download a single artifact
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: code-coverage-report
path: coverage/
- name: SonarQube Cloud Scan
uses: SonarSource/sonarqube-scan-action@d209202bc7d53ff1cc128f7f907dac145c9d6ae9 # v8.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}