-
Notifications
You must be signed in to change notification settings - Fork 14
134 lines (114 loc) · 4.35 KB
/
Copy pathci.yml
File metadata and controls
134 lines (114 loc) · 4.35 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
check-versions:
name: Version consistency check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Verify package.json, config.ts, and CHANGELOG.md versions match
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
CONFIG_VERSION=$(node -p "require('fs').readFileSync('src/config.ts','utf8').match(/version: \"([^\"]+)\"/)[1]")
CHANGELOG_VERSION=$(node -p "require('fs').readFileSync('CHANGELOG.md','utf8').match(/^## \\[([^\\]]+)\\]/m)[1]")
echo "package.json: $PKG_VERSION"
echo "config.ts: $CONFIG_VERSION"
echo "CHANGELOG.md: $CHANGELOG_VERSION"
if [ "$PKG_VERSION" != "$CONFIG_VERSION" ]; then
echo "::error::package.json ($PKG_VERSION) and config.ts ($CONFIG_VERSION) versions differ"
exit 1
fi
if [ "$PKG_VERSION" != "$CHANGELOG_VERSION" ]; then
echo "::error::package.json ($PKG_VERSION) and CHANGELOG.md ($CHANGELOG_VERSION) versions differ"
exit 1
fi
echo "All versions match: $PKG_VERSION"
test-protocol:
name: Protocol tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "22"
cache: "npm"
- run: npm ci
- run: npm run build
- run: npm test
test-integration-core:
name: Integration tests (InfluxDB 3 Core)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "22"
cache: "npm"
- run: npm ci
- run: npm run build
- name: Start InfluxDB 3 Core
run: |
docker run -d --name influxdb3-core \
-p 8181:8181 \
-v "${{ github.workspace }}/tests/fixtures/admin-token.json:/run/secrets/admin-token:ro" \
influxdb:3-core \
serve --node-id=ci-test --object-store=memory --admin-token-file=/run/secrets/admin-token
- name: Wait for InfluxDB to be ready
run: |
for i in $(seq 1 30); do
if curl -sf -H "Authorization: Bearer apiv3_test" http://localhost:8181/ping > /dev/null 2>&1; then
echo "InfluxDB ready after ${i}s"
exit 0
fi
sleep 1
done
echo "InfluxDB failed to start"
docker logs influxdb3-core
exit 1
- name: Integration tests
run: npm run test:integration
env:
INFLUX_TEST_ENABLED: "true"
INFLUX_DB_INSTANCE_URL: "http://localhost:8181/"
INFLUX_DB_TOKEN: "apiv3_test"
INFLUX_DB_PRODUCT_TYPE: "core"
- name: Stop InfluxDB
if: always()
run: docker stop influxdb3-core && docker rm influxdb3-core
test-integration-cloud-serverless:
name: Integration tests (InfluxDB Cloud Serverless)
runs-on: ubuntu-latest
if: github.repository_owner == 'influxdata'
environment: cloud-serverless
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "22"
cache: "npm"
- run: npm ci
- run: npm run build
- name: Integration tests
run: npm run test:integration
env:
INFLUX_TEST_ENABLED: "true"
INFLUX_DB_INSTANCE_URL: ${{ secrets.INFLUXDB_CLOUD_URL }}
INFLUX_DB_TOKEN: ${{ secrets.INFLUXDB_CLOUD_TOKEN }}
INFLUX_DB_PRODUCT_TYPE: "cloud-serverless"
# Future: test-integration-enterprise
# Requires Enterprise Docker image and license key.
# Gate with: if: github.repository_owner == 'influxdata'
# Environment: enterprise (with INFLUXDB_ENTERPRISE_LICENSE secret)