-
Notifications
You must be signed in to change notification settings - Fork 8
71 lines (68 loc) · 2.09 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
name: CI
on: [push, pull_request]
env:
YARN_ENABLE_SCRIPTS: false # disable post-install scripts
jobs:
prepare-yarn-cache:
name: Prepare Cache
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js latest
uses: actions/setup-node@v4
with:
node-version: latest
cache: "yarn"
- name: Check Yarn dedupe
run: |
yarn dedupe --check
- name: Check or update Yarn cache
run: |
yarn install --immutable --mode=skip-build
test:
name: Test on Node.js # GitHub will add ${{ matrix.node-version }} to this title
needs: prepare-yarn-cache
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [latest, 20, 18]
os: ["ubuntu-latest", "windows-latest"]
hexo-version: [6]
include:
- node-version: latest
os: ubuntu-latest
hexo-version: 6
coverage: 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js latest # Run yarn on latest node
uses: actions/setup-node@v4
with:
node-version: latest
cache: "yarn"
- name: Install
run: |
yarn install
yarn add --dev hexo@${{ matrix.hexo-version }}
- name: Build
run: |
yarn build
- name: Use Node.js ${{ matrix.node-version }} # Checkout node version for test executor
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Test
if: ${{ matrix.coverage == '' }}
run: |
node --test
- name: Test with coverage
if: ${{ matrix.coverage == 'true' }}
run: |
node --test --experimental-test-coverage --test-reporter=spec --test-reporter=lcov --test-reporter-destination=stdout --test-reporter-destination=coverage
- name: Coveralls GitHub Action
if: ${{ matrix.coverage == 'true' }}
uses: coverallsapp/github-action@v2
with:
file: coverage