Build with Magefile #104341
@ -23,18 +23,19 @@ var (
|
||||
webStatic = filepath.Join("web", "static")
|
||||
)
|
||||
|
||||
// Build Flamenco Manager and Flamenco Worker, including the webapp and the add-on
|
||||
func Build() {
|
||||
mg.Deps(FlamencoManager, FlamencoWorker)
|
||||
}
|
||||
|
||||
// FlamencoManager builds Flamenco Manager with the webapp and add-on ZIP embedded.
|
||||
// Build Flamenco Manager with the webapp and add-on ZIP embedded
|
||||
func FlamencoManager() error {
|
||||
mg.Deps(WebappStatic)
|
||||
mg.Deps(flamencoManager)
|
||||
return nil
|
||||
}
|
||||
|
||||
// FlamencoManager only builds the Flamenco Manager executable.
|
||||
// Only build the Flamenco Manager executable, do not rebuild the webapp
|
||||
func FlamencoManagerWithoutWebapp() error {
|
||||
mg.Deps(flamencoManager)
|
||||
return nil
|
||||
@ -44,12 +45,12 @@ func flamencoManager() error {
|
||||
return build("./cmd/flamenco-manager")
|
||||
}
|
||||
|
||||
// FlamencoWorker builds the Flamenco Worker executable.
|
||||
// Build the Flamenco Worker executable
|
||||
func FlamencoWorker() error {
|
||||
return build("./cmd/flamenco-worker")
|
||||
}
|
||||
|
||||
// WebappStatic build the webapp as static files that can be served.
|
||||
// Build the webapp as static files that can be served
|
||||
func WebappStatic() error {
|
||||
if err := cleanWebappStatic(); err != nil {
|
||||
return err
|
||||
|
@ -18,10 +18,12 @@ import (
|
||||
"honnef.co/go/tools/unused"
|
||||
)
|
||||
|
||||
// Run unit tests, check for vulnerabilities, and run the linter
|
||||
func Check(ctx context.Context) {
|
||||
mg.CtxDeps(ctx, Test, Govulncheck, Staticcheck, Vet)
|
||||
}
|
||||
|
||||
// Run unit tests
|
||||
func Test(ctx context.Context) error {
|
||||
return sh.RunV(mg.GoCmd(), "test", "-short", "-failfast", "./...")
|
||||
}
|
||||
@ -53,6 +55,7 @@ func Staticcheck() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Run `go vet`
|
||||
func Vet() error {
|
||||
return sh.RunV(mg.GoCmd(), "vet", "./...")
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"github.com/magefile/mage/sh"
|
||||
)
|
||||
|
||||
// Remove executables and other build output
|
||||
func Clean() error {
|
||||
if err := cleanWebappStatic(); err != nil {
|
||||
return err
|
||||
|
@ -16,10 +16,12 @@ import (
|
||||
"github.com/magefile/mage/sh"
|
||||
)
|
||||
|
||||
// Generate code (OpenAPI and test mocks)
|
||||
func Generate() {
|
||||
mg.Deps(GenerateGo, GeneratePy, GenerateJS)
|
||||
}
|
||||
|
||||
// Generate Go code for Flamenco Manager and Worker
|
||||
func GenerateGo(ctx context.Context) error {
|
||||
r := NewRunner(ctx)
|
||||
r.Run(mg.GoCmd(), "generate", "./pkg/api/...")
|
||||
@ -36,6 +38,7 @@ func GenerateGo(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Generate Python code for the add-on
|
||||
func GeneratePy() error {
|
||||
// The generator doesn't consistently overwrite existing files, nor does it
|
||||
// remove no-longer-generated files.
|
||||
@ -70,6 +73,7 @@ func GeneratePy() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Generate JavaScript code for the webapp
|
||||
func GenerateJS() error {
|
||||
const (
|
||||
jsOutDir = "web/app/src/manager-api"
|
||||
|
@ -19,6 +19,7 @@ func gitHash() (string, error) {
|
||||
return sh.Output("git", "rev-parse", "--short", "HEAD")
|
||||
}
|
||||
|
||||
// Show which version information would be embedded in executables
|
||||
func Version() error {
|
||||
fmt.Printf("Package : %s\n", goPkg)
|
||||
fmt.Printf("Version : %s\n", version)
|
||||
|
Loading…
Reference in New Issue
Block a user