-
Notifications
You must be signed in to change notification settings - Fork 2
83 lines (71 loc) · 2.04 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
name: CI
on:
workflow_dispatch:
workflow_call:
push:
branches:
- main
pull_request:
types:
- opened
- ready_for_review
- synchronize
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
node:
name: Node
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [ 16 ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Paths filters
uses: dorny/paths-filter@v2
id: paths
with:
filters: |
workflows: &workflows
- '.github/actions/**/*.yml'
- '.github/workflows/**/*.yml'
npm: &npm
- *workflows
- 'package.json'
- 'package-lock.json'
javascript: &javascript
- *workflows
- '**/*.js'
eslint:
- *workflows
- *javascript
- *npm
- '**/*.json'
- '.eslintignore'
- '.eslintrc'
- name: Setup
if: ${{ toJSON( steps.paths.outputs.changes ) != '"[]"' }}
uses: ./.github/actions/setup-node
with:
cache_version: ${{ secrets.GH_ACTIONS_CACHE_KEY }}
- name: Install dependencies
if: ${{ toJSON( steps.paths.outputs.changes ) != '"[]"' && steps.cache-node-dependencies.outputs.cache-hit != 'true' }}
run: npm ci --no-progress --no-fund --no-audit --loglevel error
- name: Lint code
if: ${{ steps.paths.outputs.eslint == 'true' }}
uses: wearerequired/lint-action@v2
with:
continue_on_error: false
eslint: true
eslint_extensions: js,json
- name: Run tests
if: ${{ steps.paths.outputs.javascript == 'true' || steps.paths.outputs.npm == 'true' }}
run: npm test
- name: Build application
if: ${{ steps.paths.outputs.javascript == 'true' || steps.paths.outputs.npm == 'true' }}
run: npm run build