-
Notifications
You must be signed in to change notification settings - Fork 39
137 lines (116 loc) · 3.71 KB
/
ci.yml
File metadata and controls
137 lines (116 loc) · 3.71 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
129
130
131
132
133
134
135
136
137
name: CI
on:
workflow_dispatch:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
jobs:
build:
runs-on: ubuntu-latest
outputs:
e2e-matrix: ${{ steps.resolve-versions.outputs.matrix }}
steps:
- uses: actions/checkout@v6
- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'
- name: Cache node_modules for future jobs
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Check types
run: npm run typecheck
- name: Lint
run: npm run lint
- name: Unit tests
run: npm run test:ci
- name: Build frontend
run: npm run build
- name: Check for backend
id: check-for-backend
run: |
if [ -f "Magefile.go" ]
then
echo "has-backend=true" >> $GITHUB_OUTPUT
fi
- name: Setup Go environment
if: steps.check-for-backend.outputs.has-backend == 'true'
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Test backend
if: steps.check-for-backend.outputs.has-backend == 'true'
uses: magefile/mage-action@v2
with:
version: latest
args: coverage
- name: Build backend
if: steps.check-for-backend.outputs.has-backend == 'true'
uses: magefile/mage-action@v2
with:
version: latest
args: buildAll
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
- name: Resolve Grafana E2E versions
id: resolve-versions
uses: grafana/plugin-actions/e2e-version@e2e-version/v1.2.1
with:
skip-grafana-react-19-preview-image: false
e2e:
runs-on: ubuntu-latest
timeout-minutes: 15
needs: build
strategy:
fail-fast: false
matrix:
GRAFANA_IMAGE: ${{ fromJson(needs.build.outputs.e2e-matrix) }}
QUICKWIT_VERSION: [edge]
steps:
- uses: actions/checkout@v6
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Restore executable permissions
run: chmod +x dist/gpx_quickwit_*
- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version: '22'
- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Install Playwright
run: npx playwright install --with-deps chromium
- name: Start Grafana (${{ matrix.GRAFANA_IMAGE.name }}:${{ matrix.GRAFANA_IMAGE.version }}) + Quickwit (${{ matrix.QUICKWIT_VERSION }})
run: docker compose up -d --build
env:
GRAFANA_VERSION: ${{ matrix.GRAFANA_IMAGE.version }}
GRAFANA_IMAGE: ${{ matrix.GRAFANA_IMAGE.name }}
QUICKWIT_VERSION: ${{ matrix.QUICKWIT_VERSION }}
- name: Wait for Grafana and Quickwit to start
run: |
timeout 60 bash -c 'until curl -sf http://localhost:3000/api/health; do sleep 2; done' || { docker compose logs grafana; exit 1; }
timeout 60 bash -c 'until curl -sf http://localhost:7280/health/readyz; do sleep 2; done' || { docker compose logs quickwit; exit 1; }
- name: Run e2e tests
run: npm run e2e
- name: Stop Grafana
if: always()
run: docker compose down