]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix test Dockerfile
authorMatt Joiner <anacrolix@gmail.com>
Mon, 2 Jun 2025 04:55:00 +0000 (14:55 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 2 Jun 2025 04:55:00 +0000 (14:55 +1000)
Dockerfile
justfile

index 2451b3091f754e44634c8dd74db961990c8fc3e5..0705a2596e78c72636eb77e5fd672950dcc0faf7 100644 (file)
@@ -2,32 +2,29 @@
 
 FROM alpine
 
-RUN apk add go fuse bash rustup git gcc musl-dev g++
+RUN apk add go fuse bash rustup git gcc musl-dev g++ just
 RUN rustup-init -y --profile minimal
 ENV PATH="/root/.cargo/bin:$PATH"
 
 WORKDIR /src
 
-COPY . .
-RUN git clone https://github.com/anacrolix/possum
+ENV GOWORK=off
 
-WORKDIR possum
+COPY . .
 
 RUN git submodule update --init --recursive
+
 RUN --mount=type=cache,target=/root/.cargo/registry \
        --mount=type=cache,target=/root/.cargo/git \
        --mount=type=cache,target=/src/possum/target \
-       cargo build
-
-WORKDIR ..
+       just build-possum
 
 ARG GOCACHE=/root/.cache/go-build
 ARG GOMODCACHE=/root/go/pkg/mod
 
 RUN --mount=type=cache,target=$GOCACHE \
        --mount=type=cache,target=$GOMODCACHE \
-       CGO_LDFLAGS=possum/target/debug/libpossum.a \
-       go test -failfast ./...
+       just test
 
 # # Can't use fuse inside Docker? Asks for modprobe fuse.
 
index c3de19149f862ac056b5bcdbe1c294728b100896..9a52ffbaedb67892ff9b91e183b19f3a2ea62e51 100644 (file)
--- a/justfile
+++ b/justfile
@@ -3,3 +3,9 @@ check:
 
 act:
     act -j test --matrix go-version:'1.24' --env-file .empty.env
+
+test: build-possum
+    go test -race ./...
+
+build-possum:
+    cd storage/possum/lib && cargo build