File tree Expand file tree Collapse file tree 4 files changed +111
-5
lines changed Expand file tree Collapse file tree 4 files changed +111
-5
lines changed Original file line number Diff line number Diff line change 11
11
12
12
env :
13
13
DESTDIR : ./bin
14
+ GO_VERSION : 1.16.7
14
15
15
16
jobs :
17
+ test :
18
+ runs-on : ${{ matrix.os }}
19
+ strategy :
20
+ fail-fast : false
21
+ matrix :
22
+ os :
23
+ - ubuntu-20.04
24
+ - macOS-11
25
+ - windows-2022
26
+ steps :
27
+ -
28
+ name : Checkout
29
+ uses : actions/checkout@v3
30
+ -
31
+ name : Set up Go
32
+ uses : actions/setup-go@v3
33
+ with :
34
+ go-version : ${{ env.GO_VERSION }}
35
+ cache : true
36
+ -
37
+ name : Install deps
38
+ if : ${{ matrix.os == 'ubuntu-20.04' }}
39
+ run : |
40
+ sudo apt-get update
41
+ sudo apt-get install -y dbus-x11 gnome-keyring libsecret-1-dev pass
42
+ -
43
+ name : Test
44
+ run : |
45
+ go test -short -v -coverprofile=./coverage.txt -covermode=atomic ./...
46
+ go tool cover -func=./coverage.txt
47
+ shell : bash
48
+ -
49
+ name : Upload coverage
50
+ uses : codecov/codecov-action@v3
51
+ with :
52
+ file : ./coverage.txt
53
+
54
+ test-sandboxed :
55
+ runs-on : ubuntu-20.04
56
+ steps :
57
+ -
58
+ name : Checkout
59
+ uses : actions/checkout@v3
60
+ -
61
+ name : Set up Docker Buildx
62
+ uses : docker/setup-buildx-action@v2
63
+ -
64
+ name : Test
65
+ uses : docker/bake-action@v2
66
+ with :
67
+ targets : test
68
+ set : |
69
+ *.cache-from=type=gha,scope=test
70
+ *.cache-to=type=gha,scope=test,mode=max
71
+ -
72
+ name : Upload coverage
73
+ uses : codecov/codecov-action@v3
74
+ with :
75
+ file : ${{ env.DESTDIR }}//coverage.txt
76
+
16
77
build :
17
- runs-on : ubuntu-latest
78
+ runs-on : ubuntu-20.04
18
79
steps :
19
80
-
20
81
name : Checkout
30
91
uses : docker/bake-action@v2
31
92
with :
32
93
targets : binaries
94
+ set : |
95
+ *.cache-from=type=gha,scope=build
96
+ *.cache-to=type=gha,scope=build,mode=max
33
97
-
34
98
name : Move artifacts
35
99
run : |
Original file line number Diff line number Diff line change @@ -30,6 +30,18 @@ FROM gobase AS base
30
30
ARG TARGETPLATFORM
31
31
RUN xx-apk add musl-dev gcc libsecret-dev pass
32
32
33
+ FROM base AS test
34
+ RUN --mount=type=bind,target=. \
35
+ --mount=type=cache,target=/root/.cache \
36
+ --mount=type=cache,target=/go/pkg/mod <<EOT
37
+ set -e
38
+ xx-go test -short -v -coverprofile=/tmp/coverage.txt -covermode=atomic ./...
39
+ xx-go tool cover -func=/tmp/coverage.txt
40
+ EOT
41
+
42
+ FROM scratch AS test-coverage
43
+ COPY --from=test /tmp/coverage.txt /coverage.txt
44
+
33
45
FROM base AS build-linux
34
46
ARG TARGETOS
35
47
ARG TARGETARCH
Original file line number Diff line number Diff line change
1
+ [ ![ GitHub release] ( https://img.shields.io/github/release/docker/docker-credential-helpers.svg?style=flat-square )] ( https://github.com/docker/docker-credential-helpers/releases/latest )
2
+ [ ![ PkgGoDev] ( https://img.shields.io/badge/go.dev-docs-007d9c?style=flat-square&logo=go&logoColor=white )] ( https://pkg.go.dev/github.com/docker/docker-credential-helpers )
3
+ [ ![ Build Status] ( https://img.shields.io/github/workflow/status/docker/docker-credential-helpers/build?label=build&logo=github&style=flat-square )] ( https://github.com/docker/docker-credential-helpers/actions?query=workflow%3Abuild )
4
+ [ ![ Codecov] ( https://img.shields.io/codecov/c/github/docker/docker-credential-helpers?logo=codecov&style=flat-square )] ( https://codecov.io/gh/docker/docker-credential-helpers )
5
+ [ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/docker/docker-credential-helpers?style=flat-square )] ( https://goreportcard.com/report/github.com/docker/docker-credential-helpers )
6
+
1
7
## Introduction
2
8
3
9
docker-credential-helpers is a suite of programs to use native stores to keep Docker credentials safe.
@@ -6,9 +12,21 @@ docker-credential-helpers is a suite of programs to use native stores to keep Do
6
12
7
13
Go to the [ Releases] ( https://github.com/docker/docker-credential-helpers/releases ) page and download the binary that works better for you. Put that binary in your ` $PATH ` , so Docker can find it.
8
14
9
- ### Building from scratch
15
+ ## Building
16
+
17
+ You can build the credential helpers using Docker:
18
+
19
+ ``` shell
20
+ # create builder
21
+ $ docker buildx create --use
22
+ # build credential helpers from remote repository and output to ./bin/build
23
+ $ docker buildx bake " https://github.com/docker/docker-credential-helpers.git"
24
+ # or from local source
25
+ $ git clone https://github.com/docker/docker-credential-helpers.git
26
+ $ docker buildx bake
27
+ ```
10
28
11
- The programs in this repository are written with the Go programming language. These instructions assume that you have previous knowledge about the language and you have it installed in your machine.
29
+ Or if the toolchain is already installed on your machine:
12
30
13
31
1 - Download the source and put it in your ` $GOPATH ` with ` go get ` .
14
32
Original file line number Diff line number Diff line change 1
1
variable "GO_VERSION" {
2
2
default = " 1.16.7"
3
3
}
4
+
5
+ # Defines the output folder
4
6
variable "DESTDIR" {
5
- default = " ./bin"
7
+ default = " "
8
+ }
9
+ function "bindir" {
10
+ params = [defaultdir ]
11
+ result = DESTDIR != " " ? DESTDIR : " ./bin/${ defaultdir } "
6
12
}
7
13
8
14
target "_common" {
@@ -15,10 +21,16 @@ group "default" {
15
21
targets = [" binaries" ]
16
22
}
17
23
24
+ target "test" {
25
+ inherits = [" _common" ]
26
+ target = " test-coverage"
27
+ output = [bindir (" coverage" )]
28
+ }
29
+
18
30
target "binaries" {
19
31
inherits = [" _common" ]
20
32
target = " binaries"
21
- output = [DESTDIR ]
33
+ output = [bindir ( " build " ) ]
22
34
platforms = [
23
35
" darwin/amd64" ,
24
36
" darwin/arm64" ,
You can’t perform that action at this time.
0 commit comments