Compare commits
2 commits
236f10e006
...
3e9290897c
Author | SHA1 | Date | |
---|---|---|---|
3e9290897c | |||
3d17c30d0f |
7 changed files with 5 additions and 38 deletions
|
@ -47,7 +47,6 @@ You can install Enbas with Mage using the following commands:
|
||||||
[source,console]
|
[source,console]
|
||||||
----
|
----
|
||||||
git clone https://github.com/dananglin/enbas.git
|
git clone https://github.com/dananglin/enbas.git
|
||||||
cd enbas/internal/build/
|
|
||||||
mage install
|
mage install
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
module enbas-build
|
|
||||||
|
|
||||||
go 1.22.0
|
|
||||||
|
|
||||||
require github.com/magefile/mage v1.15.0
|
|
8
mage
8
mage
|
@ -1,8 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -o errexit
|
|
||||||
set -o nounset
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
cd ./internal/build
|
|
||||||
mage $@
|
|
5
magefiles/go.mod
Normal file
5
magefiles/go.mod
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
module codeflow.dananglin.me.uk/apollo/enbas/magefiles
|
||||||
|
|
||||||
|
go 1.22.3
|
||||||
|
|
||||||
|
require github.com/magefile/mage v1.15.0
|
|
@ -29,10 +29,6 @@ var Default = Build
|
||||||
// To enable verbose mode set ENBAS_TEST_VERBOSE=1.
|
// To enable verbose mode set ENBAS_TEST_VERBOSE=1.
|
||||||
// To enable coverage mode set ENBAS_TEST_COVER=1.
|
// To enable coverage mode set ENBAS_TEST_COVER=1.
|
||||||
func Test() error {
|
func Test() error {
|
||||||
if err := changeToProjectRoot(); err != nil {
|
|
||||||
return fmt.Errorf("unable to change to the project's root directory; %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
goTest := sh.RunCmd("go", "test")
|
goTest := sh.RunCmd("go", "test")
|
||||||
|
|
||||||
args := []string{"./..."}
|
args := []string{"./..."}
|
||||||
|
@ -50,10 +46,6 @@ func Test() error {
|
||||||
|
|
||||||
// Lint runs golangci-lint against the code.
|
// Lint runs golangci-lint against the code.
|
||||||
func Lint() error {
|
func Lint() error {
|
||||||
if err := changeToProjectRoot(); err != nil {
|
|
||||||
return fmt.Errorf("unable to change to the project's root directory; %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return sh.RunV("golangci-lint", "run", "--color", "always")
|
return sh.RunV("golangci-lint", "run", "--color", "always")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,10 +53,6 @@ func Lint() error {
|
||||||
// To rebuild packages that are already up-to-date set ENBAS_BUILD_REBUILD_ALL=1
|
// To rebuild packages that are already up-to-date set ENBAS_BUILD_REBUILD_ALL=1
|
||||||
// To enable verbose mode set ENBAS_BUILD_VERBOSE=1
|
// To enable verbose mode set ENBAS_BUILD_VERBOSE=1
|
||||||
func Build() error {
|
func Build() error {
|
||||||
if err := changeToProjectRoot(); err != nil {
|
|
||||||
return fmt.Errorf("unable to change to the project's root directory; %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
main := "./cmd/" + app
|
main := "./cmd/" + app
|
||||||
binary := "./__build/" + app
|
binary := "./__build/" + app
|
||||||
flags := ldflags()
|
flags := ldflags()
|
||||||
|
@ -107,10 +95,6 @@ func Install() error {
|
||||||
|
|
||||||
// Clean clean the workspace.
|
// Clean clean the workspace.
|
||||||
func Clean() error {
|
func Clean() error {
|
||||||
if err := changeToProjectRoot(); err != nil {
|
|
||||||
return fmt.Errorf("unable to change to the project's root directory; %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := sh.Rm(app); err != nil {
|
if err := sh.Rm(app); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -122,14 +106,6 @@ func Clean() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func changeToProjectRoot() error {
|
|
||||||
if err := os.Chdir("../.."); err != nil {
|
|
||||||
return fmt.Errorf("unable to change directory; %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ldflags returns the build flags.
|
// ldflags returns the build flags.
|
||||||
func ldflags() string {
|
func ldflags() string {
|
||||||
ldflagsfmt := "-s -w -X main.binaryVersion=%s -X main.gitCommit=%s -X main.goVersion=%s -X main.buildTime=%s"
|
ldflagsfmt := "-s -w -X main.binaryVersion=%s -X main.gitCommit=%s -X main.goVersion=%s -X main.buildTime=%s"
|
Loading…
Reference in a new issue