-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Paweł Gronowski <[email protected]>
- Loading branch information
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "Dockerfile", | ||
"build": { | ||
"context": "..", | ||
"target": "devcontainer", | ||
"dockerfile": "../Dockerfile" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"golang.go", | ||
"github.copilot", | ||
"github.vscode-github-actions" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: test | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- 'master' | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
- | ||
name: Test | ||
uses: docker/bake-action@v5 | ||
with: | ||
targets: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM --platform=$BUILDPLATFORM golang:1.23-bullseye AS base | ||
|
||
# devcontainer | ||
FROM base AS gopls | ||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
--mount=type=cache,target=/go/pkg/mod \ | ||
GOBIN=/build/ GO111MODULE=on go install "golang.org/x/tools/gopls@latest" \ | ||
&& /build/gopls version | ||
|
||
FROM base AS devcontainer | ||
COPY --from=gopls /build/gopls /usr/local/bin/gopls | ||
|
||
# deps | ||
FROM base AS deps | ||
|
||
WORKDIR /go/src | ||
|
||
RUN --mount=type=bind,src=./go.mod,target=./go.mod \ | ||
--mount=type=bind,src=./go.sum,target=./go.sum \ | ||
go mod download | ||
|
||
# test | ||
FROM deps AS test | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
RUN --mount=type=bind,target=/go/src \ | ||
--mount=type=cache,target=/root/.cache/go-build \ | ||
go test -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
group "default" { | ||
targets = ["test"] | ||
} | ||
|
||
target "test" { | ||
target = "test" | ||
output = ["type=cacheonly"] | ||
} | ||
|