Skip to content

Commit 39fbbd5

Browse files
committed
Add bash script to publish to results to test analytics via the API
1 parent 1c5b757 commit 39fbbd5

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea
22
*.iml
3-
.pytest_cache
3+
.pytest_cache
4+
junit-results.xml

pytest.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pytest]
2+
addopts = --strict-markers --junit-xml=junit-results.xml
3+
junit_logging = system-err
4+
xfail_strict = True

report_test_analytics.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
ts=$(date +%s)
3+
BUILDKITE_BUILD_ID="$ts"
4+
BUILDKITE_BUILD_URL="https://github.com/adimoldovan/pytest-bk-test-analytics/actions"
5+
BUILDKITE_BRANCH="main"
6+
BUILDKITE_MESSAGE="local run $ts"
7+
8+
curl \
9+
-X POST \
10+
-H "Authorization: Token token=\"$BUILDKITE_ANALYTICS_TOKEN\"" \
11+
-F "data=@junit-results.xml" \
12+
-F "format=junit" \
13+
-F "run_env[CI]=buildkite" \
14+
-F "run_env[key]=$BUILDKITE_BUILD_ID" \
15+
-F "run_env[url]=$BUILDKITE_BUILD_URL" \
16+
-F "run_env[branch]=$BUILDKITE_BRANCH" \
17+
-F "run_env[commit_sha]=$BUILDKITE_COMMIT" \
18+
-F "run_env[number]=$BUILDKITE_BUILD_NUMBER" \
19+
-F "run_env[job_id]=$BUILDKITE_JOB_ID" \
20+
-F "run_env[message]=$BUILDKITE_MESSAGE" \
21+
https://analytics-api.buildkite.com/v1/uploads

0 commit comments

Comments
 (0)