-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (116 loc) · 3.31 KB
/
ci.yml
File metadata and controls
128 lines (116 loc) · 3.31 KB
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
name: CI
on:
release:
types: [released]
push:
branches:
- main
pull_request:
schedule:
- cron: '0 0 * * *'
permissions:
contents: read
jobs:
quality_checks:
name: Quality checks
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
node: [ 18, 20, 22 ]
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
- name: Setup NodeJS ${{ matrix.node }}
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install deps
run: npm ci
- name: Run tests
run: npm test -- --coverage
security_checks:
name: Security checks
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
- name: Setup NodeJS 22
uses: actions/setup-node@v3.6.0
with:
node-version: '22'
cache: 'npm'
- name: Audit dependencies
run: npm audit --audit-level=low --omit=dev
lint:
name: Lint
if: github.ref != 'refs/heads/main' # Don't run for main branch
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
- name: Lint Code Base
uses: docker://github/super-linter:v2.1.1
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
VALIDATE_JAVASCRIPT_ES: true
VALIDATE_JSON: true
VALIDATE_YAML: true
publish:
name: Publish
needs: [quality_checks, security_checks, lint]
if: github.event_name == 'release' && github.event.action == 'released'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3.3.0
- name: Setup NodeJS 22
uses: actions/setup-node@v3.6.0
with:
node-version: '22'
cache: 'npm'
registry-url: https://registry.npmjs.org
scope: '@quickcase'
- name: Install deps
run: npm ci
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
end:
name: End
needs: [quality_checks, security_checks, lint, publish]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
steps:
- name: Build summary
id: summary
env:
QUALITY: ${{ needs.quality_checks.result }}
SECURITY: ${{ needs.security_checks.result }}
LINT: ${{ needs.lint.result }}
PUBLISH: ${{ needs.publish.result }}
run: |
echo ::set-output name=success::$(if [[ "$QUALITY$SECURITY$LINT$PUBLISH" =~ ^(success|skipped)+$ ]]; then echo "true"; else echo "false"; fi)
- name: Notify slack success
if: steps.summary.outputs.success == 'true' && github.event_name == 'release' && env.SLACK_BOT_TOKEN != 0
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel: dev
status: SUCCESS
color: good
- name: Notify slack fail
if: steps.summary.outputs.success != 'true' && env.SLACK_BOT_TOKEN != 0
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel: dev
status: FAILED
color: danger