Skip to content

Commit 98a5d4c

Browse files
committed
chore: change datadog endpoint
1 parent cf1521b commit 98a5d4c

File tree

1 file changed

+189
-0
lines changed

1 file changed

+189
-0
lines changed

.github/workflows/ci.yml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,193 @@
11
name: Continuous Integration with Datadog
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
env:
10+
BUILD_ARTIFACT_NAME: 'lace-dev-${{ github.sha }}'
11+
12+
jobs:
13+
datadog-ci:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Send CI metrics to Datadog
17+
run: |
18+
if [ -n "${{ secrets.DATADOG_API_KEY }}" ]; then
19+
echo "Sending metrics to Datadog..."
20+
response=$(curl -s -w "%{http_code}" -X POST "https://api.us5.datadoghq.com/api/v1/series" \
21+
-H "Content-Type: application/json" \
22+
-H "DD-API-KEY: ${{ secrets.DATADOG_API_KEY }}" \
23+
-d '{
24+
"series": [{
25+
"metric": "github.ci.pipeline.duration",
26+
"points": [[$(date +%s), ${{ github.run_duration }}]],
27+
"tags": ["service:lace-wallet", "env:ci", "workflow:${{ github.workflow }}", "job:${{ github.job }}"],
28+
"type": "gauge"
29+
}, {
30+
"metric": "github.ci.pipeline.status",
31+
"points": [[$(date +%s), 1]],
32+
"tags": ["service:lace-wallet", "env:ci", "workflow:${{ github.workflow }}", "job:${{ github.job }}", "status:${{ job.status }}"],
33+
"type": "gauge"
34+
}]
35+
}')
36+
echo "Datadog API response: $response"
37+
else
38+
echo "No DATADOG_API_KEY provided, skipping metrics"
39+
fi
40+
41+
prepare:
42+
name: Prepare
43+
runs-on: ubuntu-22.04
44+
needs: [datadog-ci]
45+
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0
51+
52+
- name: Collect Workflow Telemetry Build Packages
53+
uses: catchpoint/workflow-telemetry-action@v2
54+
with:
55+
comment_on_pr: false
56+
57+
- name: Setup Node.js and install dependencies
58+
uses: ./.github/actions/install
59+
with:
60+
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
61+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
62+
63+
- name: Build common
64+
uses: ./.github/actions/build/package
65+
with:
66+
DIR: packages/common
67+
NAME: packages-common
68+
69+
- name: Build cardano
70+
uses: ./.github/actions/build/package
71+
with:
72+
DIR: packages/cardano
73+
NAME: packages-cardano
74+
75+
- name: Build translation
76+
uses: ./.github/actions/build/package
77+
with:
78+
DIR: packages/translation
79+
NAME: packages-translation
80+
81+
- name: Build core
82+
uses: ./.github/actions/build/package
83+
with:
84+
DIR: packages/core
85+
NAME: packages-core
86+
87+
- name: Build staking
88+
uses: ./.github/actions/build/package
89+
with:
90+
DIR: packages/staking
91+
NAME: packages-staking
92+
93+
- name: Build nami
94+
uses: ./.github/actions/build/package
95+
with:
96+
DIR: packages/nami
97+
NAME: packages-nami
98+
99+
- name: Build bitcoin
100+
uses: ./.github/actions/build/package
101+
with:
102+
DIR: packages/bitcoin
103+
NAME: packages-bitcoin
104+
105+
- name: Send build metrics to Datadog
106+
run: |
107+
if [ -n "${{ secrets.DATADOG_API_KEY }}" ]; then
108+
echo "Sending build metrics to Datadog..."
109+
response=$(curl -s -w "%{http_code}" -X POST "https://api.us5.datadoghq.com/api/v1/series" \
110+
-H "Content-Type: application/json" \
111+
-H "DD-API-KEY: ${{ secrets.DATADOG_API_KEY }}" \
112+
-d '{
113+
"series": [{
114+
"metric": "lace.build.packages",
115+
"points": [[$(date +%s), 1]],
116+
"tags": ["service:lace-wallet", "env:ci", "workflow:ci", "status:${{ job.status }}"],
117+
"type": "gauge"
118+
}]
119+
}')
120+
echo "Datadog API response: $response"
121+
else
122+
echo "No DATADOG_API_KEY provided, skipping build metrics"
123+
fi
124+
125+
unitTests:
126+
name: Unit Tests
127+
runs-on: ubuntu-22.04
128+
needs: prepare
129+
130+
steps:
131+
- name: Checkout repository
132+
uses: actions/checkout@v4
133+
134+
- name: Setup Node.js and install dependencies
135+
uses: ./.github/actions/install
136+
with:
137+
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }}
138+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
139+
140+
- name: Download packages-common
141+
uses: actions/download-artifact@v4
142+
with:
143+
name: packages-common
144+
path: packages/common/dist
145+
146+
- name: Download packages-cardano
147+
uses: actions/download-artifact@v4
148+
with:
149+
name: packages-cardano
150+
path: packages/cardano/dist
151+
152+
- name: Download packages-translation
153+
uses: actions/download-artifact@v4
154+
with:
155+
name: packages-translation
156+
path: packages/translation/dist
157+
158+
- name: Download packages-core
159+
uses: actions/download-artifact@v4
160+
with:
161+
name: packages-core
162+
path: packages/core/dist
163+
164+
- name: Download packages-staking
165+
uses: actions/download-artifact@v4
166+
with:
167+
name: packages-staking
168+
path: packages/staking/dist
169+
170+
- name: Download packages-nami
171+
uses: actions/download-artifact@v4
172+
with:
173+
name: packages-nami
174+
path: packages/nami/dist
175+
176+
- name: Download packages-bitcoin
177+
uses: actions/download-artifact@v4
178+
with:
179+
name: packages-bitcoin
180+
path: packages/bitcoin/dist
181+
182+
- name: Run unit tests
183+
run: npm run test:unit
184+
185+
- name: Send test metrics to Datadog
186+
run: |
187+
if [ -n "${{ secrets.DATADOG_API_KEY }}" ]; then
188+
echo "Sending test metrics to Datadog..."
189+
response=$(curl -s -w "%{http_code}" -X POST "https://api.us5.datadoghq.com/api/v1/series" \
190+
-H "Content-Type: application/json" \
2191
-H "DD-API-KEY: ${{ secrets.DATADOG_API_KEY }}" \
3192
-d '{
4193
"series": [{

0 commit comments

Comments
 (0)