-
Notifications
You must be signed in to change notification settings - Fork 1.5k
123 lines (102 loc) · 3.37 KB
/
build.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
name: Test pipeline
on: pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run with Node 18
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "yarn"
cache-dependency-path: pmm-app/yarn.lock
- name: Install deps
run: make prepare_release
- name: Build Grafana Dashboards
run: make build_package
- name: Upload the build artefacts
uses: actions/upload-artifact@v3
with:
name: build-dist
path: pmm-app/dist/
if-no-files-found: error
unit_tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run with Node 18
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "yarn"
cache-dependency-path: pmm-app/yarn.lock
- name: Install deps
run: make prepare_release
- name: Run lint
run: cd pmm-app && yarn lint:check
- name: Run unit tests
run: cd pmm-app && yarn test:ci
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_GRAFANA_DASHBOARDS_TOKEN }}
verbose: true
# code_coverage:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Setup NodeJS
# uses: actions/setup-node@v4
# with:
# node-version: "18"
# cache: "yarn"
# cache-dependency-path: pmm-app/yarn.lock
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_GRAFANA_DASHBOARDS_TOKEN }}
# - name: Download built packages
# uses: actions/download-artifact@v3
# with:
# name: build-dist
# path: pmm-app/dist/
# - name: Install deps
# run: make prepare_release
# - name: Generate Coverage
# run: make generate_coverage
workflow_success:
needs: [unit_tests, code_coverage, build]
name: Slack Notification success
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_TOKEN }}
SLACK_CHANNEL: "pmm-ci"
SLACK_USERNAME: "PR pipelines bot"
SLACK_ICON_EMOJI: ":octocat:"
SLACK_COLOR: "#00FF00"
SLACK_TITLE: "Finished grafana-dashboards workflow"
SLACK_MESSAGE: "${{ github.event.inputs.repo || github.repository }}:${{ github.event.inputs.branch || github.head_ref }}"
SLACK_FOOTER: "Please check the Actions URL ^"
steps:
- uses: actions/checkout@v4
- name: Slack Notification
uses: percona/gh-action-action-slack-notify@v2
workflow_failure:
if: ${{ failure() }}
needs: [unit_tests, code_coverage, build]
name: Slack Notification failure
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_TOKEN }}
SLACK_CHANNEL: "pmm-ci"
SLACK_USERNAME: "PR pipelines bot"
SLACK_ICON_EMOJI: ":octocat:"
SLACK_COLOR: "#FF0000"
SLACK_TITLE: "Finished grafana-dashboards workflow"
SLACK_MESSAGE: "Workflow failed: ${{ github.event.inputs.repo || github.repository }}:${{ github.event.inputs.branch || github.head_ref }}"
SLACK_FOOTER: "Please check the Actions URL ^"
steps:
- uses: actions/checkout@v4
- name: Slack Notification
uses: percona/gh-action-action-slack-notify@v2