-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (92 loc) · 3.33 KB
/
run-tests.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
name: Test and package plugin
on:
push:
branches:
- main
pull_request:
branches:
- main
# build may start failing due to questdb change
schedule:
- cron: '0 9 1 * *'
jobs:
run:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
questdb_version:
- latest
#- nightly
questdb_name:
- 'questdb/questdb'
# - 'questdb/enterprise'
steps:
- uses: actions/checkout@v4
- name: Setup packages
id: setup-packages
run: |
sudo apt-get update -y
sudo apt-get install -y zip zstd jq git
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
- name: Install yarn dependencies
run: yarn install
env:
NODE_OPTIONS: '--max_old_space_size=4096'
- name: Build Frontend
run: yarn build
env:
NODE_OPTIONS: '--max_old_space_size=4096'
- name: Compatibility check
uses: grafana/plugin-actions/is-compatible@v1
with:
module: './src/module.ts'
comment-pr: 'yes'
skip-comment-if-compatible: 'yes'
fail-if-incompatible: 'no'
targets: '@grafana/data,@grafana/ui,@grafana/runtime,@grafana/e2e-selectors'
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Build backend
run: go build -v ./...
- name: Run backend tests
run: QUESTDB_NAME=${{ matrix.questdb_name }} QUESTDB_VERSION=${{ matrix.questdb_version }} go test -v ./...
- name: Build all backends
uses: magefile/mage-action@v3
with:
version: latest
args: -v buildAll
- name: Get plugin metadata
id: metadata
run: |
sudo apt-get install jq
export GRAFANA_PLUGIN_ID=$(cat dist/plugin.json | jq -r .id)
export GRAFANA_PLUGIN_VERSION=$(cat dist/plugin.json | jq -r .info.version)
export GRAFANA_PLUGIN_TYPE=$(cat dist/plugin.json | jq -r .type)
export GRAFANA_PLUGIN_ARTIFACT=${GRAFANA_PLUGIN_ID}-${GRAFANA_PLUGIN_VERSION}.zip
export GRAFANA_PLUGIN_ARTIFACT_SHA1SUM=${GRAFANA_PLUGIN_ARTIFACT}.sha1
echo "plugin-id=${GRAFANA_PLUGIN_ID}" >> $GITHUB_OUTPUT
echo "plugin-version=${GRAFANA_PLUGIN_VERSION}" >> $GITHUB_OUTPUT
echo "plugin-type=${GRAFANA_PLUGIN_TYPE}" >> $GITHUB_OUTPUT
echo "archive=${GRAFANA_PLUGIN_ARTIFACT}" >> $GITHUB_OUTPUT
echo "archive-sha1sum=${GRAFANA_PLUGIN_ARTIFACT_SHA1SUM}" >> $GITHUB_OUTPUT
echo "github-tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
shell: bash
- name: Package plugin
id: package-plugin
run: |
mv dist ${{ steps.metadata.outputs.plugin-id }}
zip ${{ steps.metadata.outputs.archive }} ${{ steps.metadata.outputs.plugin-id }} -r
sha1sum ${{ steps.metadata.outputs.archive }} | cut -f1 -d' ' > ${{ steps.metadata.outputs.archive-sha1sum }}
shell: bash
- name: Archive plugin build artifacts
uses: actions/upload-artifact@v4
with:
name: grafana-questdb-datasource.zip
path: ${{ steps.metadata.outputs.archive }}
retention-days: 7