File tree 7 files changed +75
-32
lines changed
7 files changed +75
-32
lines changed Original file line number Diff line number Diff line change
1
+ name : Go Build & Test
2
+ on :
3
+ push :
4
+ branches :
5
+ - master
6
+ tags :
7
+ - ' **'
8
+ pull_request :
9
+ workflow_dispatch :
10
+
11
+ jobs :
12
+ build-and-test :
13
+ runs-on : ubuntu-latest
14
+
15
+ steps :
16
+ - name : Checkout code
17
+ uses : actions/checkout@v4
18
+
19
+ - name : Login to Docker Hub
20
+ uses : docker/login-action@v3
21
+ if : github.event_name != 'pull_request'
22
+ with :
23
+ username : ${{ vars.DOCKERHUB_USERNAME }}
24
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
25
+
26
+ - name : Set up Go
27
+ uses : actions/setup-go@v5
28
+ with :
29
+ go-version : stable
30
+
31
+ - name : Build and run tests
32
+ run : |
33
+ go install ./...
34
+ go test -short -v ./...
35
+ _script/run-e2e.sh read
36
+
37
+ - name : Set up QEMU
38
+ uses : docker/setup-qemu-action@v3
39
+
40
+ - name : Set up Docker Buildx
41
+ uses : docker/setup-buildx-action@v3
42
+
43
+ - name : Docker meta
44
+ id : meta
45
+ uses : docker/metadata-action@v5
46
+ with :
47
+ images : |
48
+ docker.io/${{ github.repository }}
49
+ tags : |
50
+ type=edge
51
+ type=ref,event=branch
52
+ type=semver,pattern={{version}}
53
+ type=semver,pattern={{major}}.{{minor}}
54
+ type=semver,pattern={{major}}
55
+ type=sha
56
+
57
+ - name : Build and push
58
+ uses : docker/build-push-action@v6
59
+ with :
60
+ platforms : linux/amd64,linux/arm64
61
+ push : ${{ github.event_name != 'pull_request' }}
62
+ tags : ${{ steps.meta.outputs.tags }}
63
+ labels : ${{ steps.meta.outputs.labels }}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
# Copyright 2020 Adevinta
2
2
3
- FROM golang:1.22-alpine3.18 as builder
3
+ FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
4
4
5
5
WORKDIR /app
6
6
7
+ ARG TARGETOS TARGETARCH
8
+
7
9
COPY go.mod .
8
10
COPY go.sum .
9
11
10
12
RUN go mod download
11
13
12
14
COPY . .
13
15
14
- RUN cd cmd/vulnerability-db-api/ && GOOS=linux GOARCH=amd64 go build . && cd -
16
+ RUN cd cmd/vulnerability-db-api/ && GOOS=$TARGETOS GOARCH=$TARGETARCH go build . && cd -
15
17
16
18
FROM alpine:3.21
17
19
18
20
RUN apk add --no-cache --update bash gettext
19
21
20
22
WORKDIR /app
21
23
22
- ARG BUILD_RFC3339="1970-01-01T00:00:00Z"
23
- ARG COMMIT="local"
24
-
25
- ENV BUILD_RFC3339 "$BUILD_RFC3339"
26
- ENV COMMIT "$COMMIT"
27
-
28
24
COPY --from=builder /app/cmd/vulnerability-db-api/vulnerability-db-api .
29
25
30
26
COPY config.toml .
Original file line number Diff line number Diff line change 2
2
3
3
# Copyright 2020 Adevinta
4
4
5
- docker- compose up -d
5
+ docker compose up -d
Original file line number Diff line number Diff line change 2
2
3
3
# Copyright 2020 Adevinta
4
4
5
- docker- compose kill
6
- docker- compose rm -f
5
+ docker compose kill
6
+ docker compose rm -f
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ case $ARG in
34
34
esac
35
35
36
36
# Start postgress databases.
37
- docker- compose -f _resources/docker-compose-e2e.yml -p e2e up --quiet-pull -d $SERVICE
37
+ docker compose -f _resources/docker-compose-e2e.yml -p e2e up --quiet-pull -d $SERVICE
38
38
39
39
# Set up schema for the test db.
40
40
VDB=$( mktemp -d)
@@ -60,10 +60,10 @@ vulnerability-db-api -c $CONFIG_FILE &
60
60
61
61
# Run e2e tests.
62
62
echo " RUNNING e2e tests"
63
- docker- compose -f _resources/docker-compose-e2e.yml -p " e2e" run e2e
63
+ docker compose -f _resources/docker-compose-e2e.yml -p " e2e" run --quiet-pull e2e
64
64
65
65
# Clean up resurces.
66
66
set +e
67
67
pkill vulnerability-db-api
68
68
set -e
69
- docker- compose -f _resources/docker-compose-e2e.yml -p " e2e" rm -s -f -v
69
+ docker compose -f _resources/docker-compose-e2e.yml -p " e2e" rm -s -f -v
Original file line number Diff line number Diff line change 1
1
module github.com/adevinta/vulnerability-db-api
2
2
3
- go 1.21.2
3
+ go 1.23.0
4
+
4
5
toolchain go1.24.1
5
6
6
7
require (
You can’t perform that action at this time.
0 commit comments