-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (86 loc) · 2.64 KB
/
ci-node.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
name: CI
on:
push:
branches: [main]
pull_request:
release:
types: [released, prereleased]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
- name: Install dependencies
run: yarn install --immutable --prefer-offline
- name: Check types
run: yarn typecheck
- name: Lint
run: yarn lint
- name: Unit tests
run: yarn test:ci
e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
- name: Install dependencies
run: yarn install --immutable --prefer-offline
- name: Build dependencies
run: yarn build
- name: Start Grafana container
run: docker-compose --file compose.yaml up --detach
- name: Run e2e tests
run: yarn e2e
- name: Stop Grafana container
run: docker-compose --file compose.yaml down
build:
runs-on: ubuntu-latest
needs:
- tests
- e2e-tests
if: ${{ github.event_name == 'release' && contains(fromJSON('["released", "prereleased"]'), github.event.action) }}
env:
FILENAME: embraceio-metric-app-${{ github.event.release.tag_name }}.zip
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
# - name: Update version in package.json and plugin.json
# run: |
# sed -i 's/"version": "0.0.0"/"version": "${{ github.event.release.tag_name }}"/g' package.json src/plugin.json
- name: Install dependencies
run: yarn install --pure-lockfile
- name: Build dependencies
run: yarn build
- name: Sign Grafana plugin
run: npx @grafana/sign-plugin
env:
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }}
- name: Rename dist directory
run: mv dist/ embraceio-metric-app/
- name: Zip app directory
run: zip -r $FILENAME ./embraceio-metric-app
- name: Generate MD5 hash file
run: echo "$(md5sum ./$FILENAME | awk '{print $1}')" > md5.txt
- name: Upload release
run: gh release upload "${{ github.event.release.tag_name }}" $FILENAME md5.txt --clobber
env:
GH_TOKEN: ${{ github.token }}