-
Notifications
You must be signed in to change notification settings - Fork 5
152 lines (122 loc) · 4.18 KB
/
pr-check.yml
File metadata and controls
152 lines (122 loc) · 4.18 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
name: CI for PR
on:
pull_request:
branches:
- main
paths-ignore:
- 'public/**' # Ignore changes to the public directory
concurrency:
group: pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
CI: development
SITE_DIR: public
HUGO_VERSION: 0.151.0
DART_SASS_VERSION: 1.99.0
jobs:
lint:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 24
cache: 'npm'
- name: Install dependencies
run: npm ci -o
- uses: super-linter/super-linter/slim@9e863354e3ff62e0727d37183162c4a88873df41 # v8.6.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILTER_REGEX_EXCLUDE: tools/.*
VALIDATE_MARKDOWN: true
VALIDATE_YAML: true
MARKDOWN_CONFIG_FILE: .markdownlint.json
ENABLE_GITHUB_ACTIONS_STEP_SUMMARY: true
test:
permissions:
actions: write
checks: write
contents: read
pull-requests: write
security-events: write
environment:
name: development
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
submodules: recursive
fetch-depth: 0
- name: Dependency Review
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5
with:
config-file: >-
./.github/dependency-review-config.yml
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
sudo dpkg -i ${{ runner.temp }}/hugo.deb
hugo version
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 24
cache: 'npm'
- name: Cache Playwright browsers
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('package-lock.json') }}
- name: Install Dart Sass
run: |
npm install -g sass@${DART_SASS_VERSION}
sass --version
- name: Install test dependencies
timeout-minutes: 10
run: |
# Clean install of the node modules
# Note: The -o flag is required to install optional
# dependencies that include pre-built binaries for tailwindcss
# when running in a CI environment.
#
# See: https://github.com/tailwindlabs/tailwindcss/issues/15806
npm ci -o
# Install browsers for running functional tests
npx playwright install --with-deps
- name: Unit tests
run: |
npm run test:unit
- name: Build JS bundle
run: |
# Build the JavaScript bundle using webpack
npm run build
# Make sure the bundle.js exists and has content
if [ ! -s static/js/bundle.js ]; then
echo "::error::bundle.js was not created or is empty"
exit 1
fi
- name: Build site
run: |
hugo --gc --minify --baseURL "/"
- name: Fix site file permissions
run: |
chmod -c -R +rX "${{ env.SITE_DIR }}/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: HTML Proofer
uses: chabad360/htmlproofer@c2750eb7eb937599ac859517e7dd23a29f1b3ed7 # v2
with:
directory: ${{ github.workspace }}/${{ env.SITE_DIR }}
arguments: --disable-external --allow-missing-href
- name: Functional tests
run: |
npm run test:functional
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 7