Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ jobs:
go build -o build/docgen ./cmd/docgen
go build -o build/builtingen ./cmd/builtingen

- name: Go Tests
run: go test -v ./...

- name: Start BuildkitD
if: github.repository != 'openllb/hlb'
run: docker run --name buildkitd --rm -d --privileged openllb/buildkit:experimental
Expand All @@ -54,6 +51,9 @@ jobs:
# waiting for buildkitd to report 1 worker (2 lines, 1 for column titles, one for the worker details)
run: while true; do lineCount=$(docker exec buildkitd buildctl debug workers | wc -l); if [ $lineCount -gt 1 ]; then break; fi; sleep 1; done

- name: Go Tests
run: ./build/hlb run -t test

- name: GoLint
run: ./build/hlb run -t lint

Expand Down
57 changes: 49 additions & 8 deletions build.hlb
Original file line number Diff line number Diff line change
@@ -1,26 +1,67 @@
# TODO replace with openllb/go.hlb
import go "./go.hlb"
import go from fs {
image "openllb/go.hlb"
}

import mkdocs "./mkdocs.hlb"

fs default() {
group default() {
crossHLB
}

fs crossHLB() {
go.crossBinaries src "github.com/openllb/hlb/cmd/hlb" "github.com/openllb/hlb"
download "./build/dist"
group crossHLB() {
go.buildCommonWithOptions src "github.com/openllb/hlb/cmd/hlb" commonBuildArgs option::run{}
}

string version() {
localRun "git describe --match 'v[0-9]*' --tags --dirty='.dirty' --always | sed 's/^v//'"
}

option::template commonBuildArgs() {
stringField "goBuildFlags" string {
template <<~EOM
-ldflags "-w -s -extldflags -static -X github.com/openllb/hlb.Version={{.version}}"
EOM with option {
stringField "version" version
}
}
}

fs build() {
go.buildWithOptions src "github.com/openllb/hlb/cmd/hlb" commonBuildArgs option::run{}
download "."
}

fs lint() {
go.lint src
go.lint fs {
testSrc
copy fs {
local ".golangci.yml"
} "." "."
}
}

fs test() {
go.test testSrc
}

fs src() {
local "." with option {
excludePatterns "build"
includePatterns "**/*.go" "go.mod" "go.sum"
excludePatterns "**/*_test.go" "vendor"
}
}

fs testSrc() {
# TODO update to use merge-op once available upstream
src
copy fs {
local "." with option {
includePatterns "**/*_test.go"
excludePatterns "vendor"
}
} "." "."
}

fs gen() {
mkdocs.generatedBuiltin
download "./builtin/."
Expand Down
70 changes: 0 additions & 70 deletions go.hlb

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ replace k8s.io/client-go => k8s.io/client-go v0.0.0-20180806134042-1f13a808da65
// necessary for langserver with vscode
replace github.com/sourcegraph/go-lsp => github.com/radeksimko/go-lsp v0.0.0-20200223162147-9f2c54f29c9f

replace github.com/tonistiigi/fsutil => github.com/coryb/fsutil v0.0.0-20200508061958-7d16a3dcbd1d
replace github.com/tonistiigi/fsutil => github.com/coryb/fsutil v0.0.0-20200514225115-6114353d9a17
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
github.com/coryb/fsutil v0.0.0-20200508061958-7d16a3dcbd1d h1:A7to1XdmvKRghdKwiC/bc2Y5Uwwu1eg3+eaaAxaNriU=
github.com/coryb/fsutil v0.0.0-20200508061958-7d16a3dcbd1d/go.mod h1:0G1sLZ/0ttFf09xvh7GR4AEECnjifHRNJN/sYbLianU=
github.com/coryb/fsutil v0.0.0-20200514225115-6114353d9a17 h1:QpblWbcAtXd6PQ/LSVydk7pWzK9gjHcEKoYF3Fd/2xA=
github.com/coryb/fsutil v0.0.0-20200514225115-6114353d9a17/go.mod h1:0G1sLZ/0ttFf09xvh7GR4AEECnjifHRNJN/sYbLianU=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
Expand Down
4 changes: 2 additions & 2 deletions parser/cst.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

var (
// Lexer lexes HLB into tokens for the parser.
Lexer = lexer.Must(regex.New(fmt.Sprintf(`
Lexer = lexer.Must(regex.New(`
Whitespace = [\r\t ]+
HereDoc = <<[-~]?
Keyword = \b(with|as|import|export|from)\b
Expand All @@ -31,7 +31,7 @@ var (
Operator = {|}|\(|\)|,|;
Comment = #[^\n]*\n
Bad = [^\r\t\n ]*
`)))
`))

// Parser parses HLB into a concrete syntax tree rooted from a Module.
Parser = participle.MustBuild(
Expand Down