4fr

Форк
0
/
ci-frontend.yml 
221 строка · 5.4 Кб
1
name: frontend
2

3
on:
4
  push:
5
    branches:
6
      - master
7
    paths:
8
      - ".github/workflows/ci-frontend.yml"
9
      - "frontend/apps/remark42/**"
10
      - "!**.md"
11
  pull_request:
12
    paths:
13
      - ".github/workflows/ci-frontend.yml"
14
      - "frontend/apps/remark42/**"
15
      - "!**.md"
16

17
jobs:
18
  translations-check:
19
    name: Translations check
20
    runs-on: ubuntu-latest
21
    strategy:
22
      matrix:
23
        node: [16.20.2]
24

25
    steps:
26
      - name: Checkout
27
        uses: actions/checkout@v4
28

29
      - name: Install node
30
        uses: actions/setup-node@v4
31
        with:
32
          node-version: ${{ matrix.node }}
33

34
      - name: Install pnpm
35
        uses: pnpm/action-setup@v2.4.0
36
        id: pnpm-install
37
        with:
38
          version: 7
39
          run_install: false
40

41
      - name: Get pnpm store directory
42
        id: pnpm-cache
43
        run: |
44
          echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
45

46
      - name: Setup pnpm cache
47
        uses: actions/cache@v3
48
        with:
49
          path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
50
          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
51
          restore-keys: |
52
            ${{ runner.os }}-pnpm-store-
53

54
      - name: Install dependencies
55
        run: pnpm i
56
        working-directory: ./frontend
57

58
      - name: Translations check
59
        run: pnpm translation-check
60
        working-directory: ./frontend/apps/remark42
61

62
  type-check:
63
    name: Type check
64
    runs-on: ubuntu-latest
65
    strategy:
66
      matrix:
67
        node: [16.20.2]
68

69
    steps:
70
      - name: Checkout
71
        uses: actions/checkout@v4
72

73
      - name: Install node
74
        uses: actions/setup-node@v4
75
        with:
76
          node-version: ${{ matrix.node }}
77

78
      - name: Install pnpm
79
        uses: pnpm/action-setup@v2.4.0
80
        id: pnpm-install
81
        with:
82
          version: 7
83
          run_install: false
84

85
      - name: Get pnpm store directory
86
        id: pnpm-cache
87
        run: |
88
          echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
89

90
      - name: Setup pnpm cache
91
        uses: actions/cache@v3
92
        with:
93
          path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
94
          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
95
          restore-keys: |
96
            ${{ runner.os }}-pnpm-store-
97

98
      - name: Install dependencies
99
        run: pnpm i
100
        working-directory: ./frontend
101

102
      - name: Run type check
103
        run: pnpm type-check
104
        working-directory: ./frontend/apps/remark42
105

106
  lint:
107
    name: Eslint & Stylelint
108
    runs-on: ubuntu-latest
109
    strategy:
110
      matrix:
111
        node: [16.20.2]
112

113
    steps:
114
      - name: Checkout
115
        uses: actions/checkout@v4
116

117
      - name: Install node
118
        uses: actions/setup-node@v4
119
        with:
120
          node-version: ${{ matrix.node }}
121

122
      - name: Install pnpm
123
        uses: pnpm/action-setup@v2.4.0
124
        id: pnpm-install
125
        with:
126
          version: 7
127
          run_install: false
128

129
      - name: Get pnpm store directory
130
        id: pnpm-cache
131
        run: |
132
          echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
133

134
      - name: Setup pnpm cache
135
        uses: actions/cache@v3
136
        with:
137
          path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
138
          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
139
          restore-keys: |
140
            ${{ runner.os }}-pnpm-store-
141

142
      - name: Install dependencies
143
        run: pnpm i
144
        working-directory: ./frontend
145

146
      - name: Run linters
147
        run: pnpm lint
148
        working-directory: ./frontend/apps/remark42
149

150
  size-limit:
151
    name: Size limit
152
    runs-on: ubuntu-latest
153
    if: github.event_name == 'pull_request'
154
    env:
155
      CI_JOB_NUMBER: 1
156
    steps:
157
      - name: Checkout
158
        uses: actions/checkout@v4
159

160
      - name: Install pnpm
161
        uses: pnpm/action-setup@v2.4.0
162
        id: pnpm-install
163
        with:
164
          version: 7
165
          run_install: false
166

167
      - name: Check bundle size
168
        uses: andresz1/size-limit-action@7313b26c76b3666c1dc41e2ca05370e201a9b7de
169
        with:
170
          github_token: ${{ secrets.GITHUB_TOKEN }}
171
          directory: ./frontend/apps/remark42
172
          package_manager: pnpm
173

174
  test:
175
    name: Tests & Coverage
176
    runs-on: ubuntu-latest
177
    strategy:
178
      matrix:
179
        node: [16.20.2]
180

181
    steps:
182
      - name: Checkout
183
        uses: actions/checkout@v4
184

185
      - name: Install node
186
        uses: actions/setup-node@v4
187
        with:
188
          node-version: ${{ matrix.node }}
189

190
      - name: Install pnpm
191
        uses: pnpm/action-setup@v2.4.0
192
        id: pnpm-install
193
        with:
194
          version: 7
195
          run_install: false
196

197
      - name: Get pnpm store directory
198
        id: pnpm-cache
199
        run: |
200
          echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
201

202
      - name: Setup pnpm cache
203
        uses: actions/cache@v3
204
        with:
205
          path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
206
          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
207
          restore-keys: |
208
            ${{ runner.os }}-pnpm-store-
209

210
      - name: Install dependencies
211
        run: pnpm i
212
        working-directory: ./frontend
213

214
      - name: Test & Coverage
215
        run: pnpm coverage
216
        working-directory: ./frontend/apps/remark42
217

218
      - name: Submit coverage
219
        run: ${{ github.workspace }}/frontend/apps/remark42/node_modules/.bin/codecov
220
        env:
221
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
222

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.