Skip to content

Commit 04e8568

Browse files
fix
1 parent 2a5bf01 commit 04e8568

File tree

4 files changed

+62
-1
lines changed

4 files changed

+62
-1
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build test models
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
checks: write
12+
attestations: write
13+
id-token: write
14+
15+
env:
16+
REGISTRY: ghcr.io
17+
IMAGE_NAME: ${{ github.repository }}
18+
19+
jobs:
20+
build:
21+
name: build test model
22+
runs-on: ubuntu-latest
23+
env:
24+
CI: true
25+
steps:
26+
- name: Set up Go
27+
uses: actions/setup-go@v2
28+
with:
29+
go-version: '1.24.5'
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
- name: Install dependencies
33+
run: |
34+
go mod download
35+
- name: download models
36+
run: |
37+
go run testData/downloadModels.go
38+
- name: List models directory
39+
run: ls -l ./models
40+
- name: Remove models from .dockerignore # make sure models folder is not ignored
41+
run: sed -i '/^\\/models$/d' .dockerignore
42+
- name: Log in to the Container registry
43+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
44+
with:
45+
registry: ${{ env.REGISTRY }}
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
- name: Build and push Docker image
49+
uses: docker/build-push-action@v5
50+
with:
51+
context: .
52+
file: models.Dockerfile
53+
tags: ghcr.io/knights-analytics/hugot/models:latest
54+
push: true

models.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM scratch
2+
3+
COPY models .

scripts/run-unit-tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ else
3030
fi
3131

3232
# build with compose
33-
docker compose -f "$src_dir/compose-test.yaml" build
33+
docker compose -f "$src_dir/compose-test.yaml" build hugot && \
34+
docker compose -f "$src_dir/compose-test.yaml" build-test
3435

3536
echo "Running tests for commit hash: $commit_hash"
3637
docker compose -f "$src_dir/compose-test.yaml" up && \

test.Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
ARG BUILD_PLATFORM=linux/amd64
22

3+
FROM ghcr.io/knights-analytics/hugot/models:latest AS models
4+
35
FROM --platform=$BUILD_PLATFORM hugot:latest AS hugot-test
46

57
COPY . /build
8+
COPY --from=models /models /build/models
69

710
RUN cd /build && \
811
chown -R testuser:testuser /build && \

0 commit comments

Comments
 (0)