Skip to content

Commit 37d8a47

Browse files
committed
update to use openllb/go.hlb module
1 parent 9f539ff commit 37d8a47

File tree

6 files changed

+55
-85
lines changed

6 files changed

+55
-85
lines changed

.github/workflows/test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ jobs:
4242
go build -o build/docgen ./cmd/docgen
4343
go build -o build/builtingen ./cmd/builtingen
4444
45-
- name: Go Tests
46-
run: go test -v ./...
47-
4845
- name: Start BuildkitD
4946
if: github.repository != 'openllb/hlb'
5047
run: docker run --name buildkitd --rm -d --privileged openllb/buildkit:experimental
@@ -54,6 +51,9 @@ jobs:
5451
# waiting for buildkitd to report 1 worker (2 lines, 1 for column titles, one for the worker details)
5552
run: while true; do lineCount=$(docker exec buildkitd buildctl debug workers | wc -l); if [ $lineCount -gt 1 ]; then break; fi; sleep 1; done
5653

54+
- name: Go Tests
55+
run: ./build/hlb run -t test
56+
5757
- name: GoLint
5858
run: ./build/hlb run -t lint
5959

.golangci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ linters:
1717
- unparam
1818
- varcheck
1919

20-
2120
issues:
2221
exclude-use-default: false

build.hlb

+49-8
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,67 @@
1-
# TODO replace with openllb/go.hlb
2-
import go "./go.hlb"
1+
import go from fs {
2+
image "openllb/go.hlb"
3+
}
4+
35
import mkdocs "./mkdocs.hlb"
46

5-
fs default() {
7+
group default() {
68
crossHLB
79
}
810

9-
fs crossHLB() {
10-
go.crossBinaries src "github.com/openllb/hlb/cmd/hlb" "github.com/openllb/hlb"
11-
download "./build/dist"
11+
group crossHLB() {
12+
go.buildCommonWithOptions src "github.com/openllb/hlb/cmd/hlb" commonBuildArgs option::run{}
13+
}
14+
15+
string version() {
16+
localRun "git describe --match 'v[0-9]*' --tags --dirty='.dirty' --always | sed 's/^v//'"
17+
}
18+
19+
option::template commonBuildArgs() {
20+
stringField "goBuildFlags" string {
21+
template <<~EOM
22+
-ldflags "-w -s -extldflags -static -X github.com/openllb/hlb.Version={{.version}}"
23+
EOM with option {
24+
stringField "version" version
25+
}
26+
}
27+
}
28+
29+
fs build() {
30+
go.buildWithOptions src "github.com/openllb/hlb/cmd/hlb" commonBuildArgs option::run{}
31+
download "."
1232
}
1333

1434
fs lint() {
15-
go.lint src
35+
go.lint fs {
36+
testSrc
37+
copy fs {
38+
local ".golangci.yml"
39+
} "." "."
40+
}
41+
}
42+
43+
fs test() {
44+
go.test testSrc
1645
}
1746

1847
fs src() {
1948
local "." with option {
20-
excludePatterns "build"
49+
includePatterns "**/*.go" "go.mod" "go.sum"
50+
excludePatterns "**/*_test.go" "vendor"
2151
}
2252
}
2353

54+
fs testSrc() {
55+
# TODO update to use merge-op once available upstream
56+
src
57+
copy fs {
58+
local "." with option {
59+
includePatterns "**/*_test.go"
60+
excludePatterns "vendor"
61+
}
62+
} "." "."
63+
}
64+
2465
fs gen() {
2566
mkdocs.generatedBuiltin
2667
download "./builtin/."

go.hlb

-70
This file was deleted.

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ replace k8s.io/client-go => k8s.io/client-go v0.0.0-20180806134042-1f13a808da65
4646
// necessary for langserver with vscode
4747
replace github.com/sourcegraph/go-lsp => github.com/radeksimko/go-lsp v0.0.0-20200223162147-9f2c54f29c9f
4848

49-
replace github.com/tonistiigi/fsutil => github.com/coryb/fsutil v0.0.0-20200508061958-7d16a3dcbd1d
49+
replace github.com/tonistiigi/fsutil => github.com/coryb/fsutil v0.0.0-20200514225115-6114353d9a17

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz
8282
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
8383
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
8484
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
85-
github.com/coryb/fsutil v0.0.0-20200508061958-7d16a3dcbd1d h1:A7to1XdmvKRghdKwiC/bc2Y5Uwwu1eg3+eaaAxaNriU=
86-
github.com/coryb/fsutil v0.0.0-20200508061958-7d16a3dcbd1d/go.mod h1:0G1sLZ/0ttFf09xvh7GR4AEECnjifHRNJN/sYbLianU=
85+
github.com/coryb/fsutil v0.0.0-20200514225115-6114353d9a17 h1:QpblWbcAtXd6PQ/LSVydk7pWzK9gjHcEKoYF3Fd/2xA=
86+
github.com/coryb/fsutil v0.0.0-20200514225115-6114353d9a17/go.mod h1:0G1sLZ/0ttFf09xvh7GR4AEECnjifHRNJN/sYbLianU=
8787
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
8888
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
8989
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=

0 commit comments

Comments
 (0)