-
Notifications
You must be signed in to change notification settings - Fork 83
73 lines (57 loc) · 1.63 KB
/
build-test.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
# Test if the theme works well
name: Build Test
on:
pull_request:
jobs:
build:
strategy:
matrix:
node-version: [18, 20, 22]
runs-on: ubuntu-latest
steps:
# Setup Node.js env
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
# Get Hexo test utils
- uses: actions/checkout@v4
with:
repository: 'hexojs/hexo-theme-unit-test'
# Make dirs for themes
- name: Make dirs for themes
run: mkdir themes
# Clone Kratos-Rebirth into themes dir
- uses: actions/checkout@v4
with:
path: 'themes/kratos-rebirth'
# Build fresh theme files
- name: Build theme files
run: |
cd ./themes/kratos-rebirth
pnpm install --frozen-lockfile
pnpm build
# Edit hexo site settings
- name: Edit Hexo Theme settings
run: |
sed -i "s/language:/language: zh-CN/" "_config.yml"
sed -i "s/theme: landscape/theme: kratos-rebirth/" "_config.yml"
# Copy theme settings
- name: Copy theme settings
run: cp "themes/kratos-rebirth/.demo/_config.kratos-rebirth.yml" "_config.kratos-rebirth.yml"
# Install Hexo env
- name: Install Hexo environment
run: npm install
# Hexo build demo site
- name: Hexo build test
run: npx hexo generate
- name: Upload built as artifacts
uses: actions/upload-artifact@v4
with:
name: test-node${{ matrix.node-version }}
path: public
retention-days: 1