forked from qdrant/vector-db-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 14
119 lines (99 loc) · 3.91 KB
/
Copy pathdocker-build-pr.yml
File metadata and controls
119 lines (99 loc) · 3.91 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
name: Docker Build - PR Validation
on:
pull_request:
branches: [master, main]
paths:
- 'Dockerfile'
- '.dockerignore'
- 'Cargo.toml'
- 'Cargo.lock'
- 'src/**'
- 'datasets/datasets.json'
- 'experiments/configurations/**'
- '.github/workflows/docker-build-pr.yml'
env:
IMAGE_NAME: vector-db-benchmark-pr
jobs:
docker-build-test:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image (amd64)
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: false
load: true
tags: ${{ env.IMAGE_NAME }}:pr-${{ github.event.number }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test --help
run: |
echo "Testing --help command..."
docker run --rm ${{ env.IMAGE_NAME }}:pr-${{ github.event.number }} --help
- name: Test --describe datasets
run: |
echo "Testing --describe datasets..."
docker run --rm ${{ env.IMAGE_NAME }}:pr-${{ github.event.number }} --describe datasets
- name: Run integration test (random-100 + Redis)
run: |
export IMAGE_NAME=${{ env.IMAGE_NAME }}
export IMAGE_TAG=pr-${{ github.event.number }}
echo "Starting Redis..."
docker compose -f tests/docker-compose.ci-test.yml up -d redis --wait
echo "Configuring Redis search-workers..."
docker compose -f tests/docker-compose.ci-test.yml exec redis redis-cli CONFIG SET search-workers 8
echo "Running benchmark..."
docker compose -f tests/docker-compose.ci-test.yml run --rm benchmark
echo "Stopping services..."
docker compose -f tests/docker-compose.ci-test.yml down
- name: Validate multi-platform build (amd64 + arm64)
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
tags: ${{ env.IMAGE_NAME }}:pr-${{ github.event.number }}-multiplatform
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Post PR comment
# Only on same-repo PRs. GitHub grants the GITHUB_TOKEN read-only scope
# for pull_request events from forks (regardless of the job's requested
# permissions), so createComment fails there with "Resource not
# accessible by integration" and reds an otherwise-passing build. Fork
# PRs simply skip the cosmetic comment; the build/test steps above are
# the real gate. continue-on-error is a belt-and-suspenders so a comment
# failure never fails the job.
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
continue-on-error: true
uses: actions/github-script@v7
with:
script: |
const output = `## Docker Build Validation
**Platforms tested:**
- linux/amd64 (built and tested)
- linux/arm64 (build validated)
**Tests performed:**
- \`--help\` command
- \`--describe datasets\` command
- Integration test (random-100 dataset + Redis)
- Multi-platform build validation (amd64 + arm64)`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
});
- name: Clean up
if: always()
run: |
docker rmi ${{ env.IMAGE_NAME }}:pr-${{ github.event.number }} || true