-
Notifications
You must be signed in to change notification settings - Fork 5
141 lines (116 loc) · 3.42 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
133
134
135
136
137
138
139
140
141
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18
- name: Install dependencies
run: yarn install --immutable
- name: Run build
run: yarn build
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18
- name: Install dependencies
run: yarn install --immutable
- name: Lint with eslint
if: ${{ success() || failure() }}
run: yarn lint:eslint
- name: Lint with markdownlint
if: ${{ success() || failure() }}
run: yarn lint:markdownlint
- name: Lint with prettier
if: ${{ success() || failure() }}
run: yarn lint:prettier
- name: Lint with tsc
if: ${{ success() || failure() }}
run: yarn lint:tsc
- name: Lint with yarn-dedupe
if: ${{ success() || failure() }}
run: yarn lint:yarn-dedupe
tests:
name: Tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-12, windows-2022, ubuntu-22.04]
node: [14, 16, 18]
exclude:
- os: ubuntu-22.04
node: 18
include:
- os: ubuntu-22.04
node: 18
extra: coverage
- os: ubuntu-22.04
node: 19
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
cache: yarn
node-version: ${{ matrix.node }}
- name: Install dependencies
run: yarn install --immutable
- name: "Prettier v1: Run tests"
if: ${{ success() || failure() }}
run: yarn test
env:
COVERAGE: ${{ matrix.extra == 'coverage' }}
PRETTIER_MAJOR_VERSION: "1"
- name: "Prettier v1: Report coverage to codecov.io"
uses: codecov/codecov-action@v3
if: matrix.extra == 'coverage'
with:
files: coverage/lcov.info
name: prettier-v1
- name: "Prettier v2: Run tests"
if: ${{ success() || failure() }}
run: yarn test
env:
COVERAGE: ${{ matrix.extra == 'coverage' }}
PRETTIER_MAJOR_VERSION: "2"
- name: "Prettier v2: Report coverage to codecov.io"
uses: codecov/codecov-action@v3
if: matrix.extra == 'coverage'
with:
files: coverage/lcov.info
name: prettier-v2
- name: "Prettier v3: Run tests"
if: ${{ success() || failure() }}
## Running both tests on Node 14 causes exit code 129/1 on Ubuntu/Windows
## TODO: Remove after dropping Node 14 support
run: ${{ matrix.node == 14 && 'yarn test cache && yarn test main' || 'yarn test' }}
env:
COVERAGE: ${{ matrix.extra == 'coverage' }}
- name: "Prettier v3: Report coverage to codecov.io"
uses: codecov/codecov-action@v3
if: matrix.extra == 'coverage'
with:
files: coverage/lcov.info
name: prettier-v3