Skip to content

Commit

Permalink
refactor!: Remove Makefiles in favor of go build
Browse files Browse the repository at this point in the history
Switch to using `go build` directly to embrace the Go way of building.
This change eliminates the need to maintain both the Makefile and the
goreleaser yaml. You can still build everything at once using the
provided justfile with `just build`.

Additionally, remove the go.mod files in subdirectories to avoid manual
updates when the main go.mod is updated. As a result, the linter now
also checks the contrib files, necessitating a few trivial fixes.

Signed-off-by: Michael Adler <[email protected]>
  • Loading branch information
michaeladler committed Mar 3, 2025
1 parent ec6c0fd commit b10ee74
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 347 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- run: make test
- run: go test -race -coverprofile=coverage.out -covermode=atomic -timeout 30s --tags=testing ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5
with:
Expand Down Expand Up @@ -211,10 +211,12 @@ jobs:
- run: .ci/setup-cli-tests.sh
- name: Disable git security features
run: git config --global safe.directory '*'
- name: build wfx
run: make
- name: install wfx
run: make install
run: go install .
- name: install wfxctl
run: go install ./cmd/wfxctl
- name: build plugins
run: go build -C example/plugin
- name: run tests
env:
PGHOST: postgres
Expand All @@ -228,7 +230,7 @@ jobs:
MYSQL_PASSWORD: secret
MYSQL_HOST: mysql
working-directory: test
run: bats .
run: export PATH=$(go env GOPATH)/bin:$PATH; bats .

lint:
runs-on: ubuntu-latest
Expand Down
8 changes: 5 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test:
stage: test
needs: []
script:
- make test
- go test -race -coverprofile=coverage.out -covermode=atomic -timeout 30s --tags=testing ./...

test-postgres:
stage: test
Expand Down Expand Up @@ -118,9 +118,11 @@ cli-tests:
PGDATABASE: wfx
before_script:
- .ci/setup-cli-tests.sh
- make
- make install
- go install .
- go install ./cmd/wfxctl
- go build -C example/plugin
script:
- export PATH=$(go env GOPATH)/bin:$PATH
- cd test && bats .

lint:
Expand Down
61 changes: 0 additions & 61 deletions Makefile

This file was deleted.

5 changes: 3 additions & 2 deletions contrib/config-deployment/client/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import (
"log"
"time"

"github.com/Southclaws/fault"
"github.com/cavaliergopher/grab/v3"
)

func download(url string, dir string) (string, error) {
req, err := grab.NewRequest(dir, url)
if err != nil {
return "", err
return "", fault.Wrap(err)
}

// start download
Expand Down Expand Up @@ -46,7 +47,7 @@ Loop:
}

if err := resp.Err(); err != nil {
return "", err
return "", fault.Wrap(err)
}

log.Printf("Download saved to %s\n", resp.Filename)
Expand Down
31 changes: 0 additions & 31 deletions contrib/config-deployment/client/go.mod

This file was deleted.

77 changes: 0 additions & 77 deletions contrib/config-deployment/client/go.sum

This file was deleted.

11 changes: 6 additions & 5 deletions contrib/config-deployment/client/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"path"
"time"

"github.com/Southclaws/fault"
"github.com/siemens/wfx/cmd/wfxctl/errutil"
"github.com/siemens/wfx/generated/api"
)
Expand Down Expand Up @@ -71,7 +72,7 @@ func worker() {
func processJob(client *api.ClientWithResponses, job *api.Job) error {
tmpDir, err := os.MkdirTemp("", "config-deployer")
if err != nil {
return err
return fault.Wrap(err)
}
defer func() {
_ = os.RemoveAll(tmpDir)
Expand All @@ -83,7 +84,7 @@ func processJob(client *api.ClientWithResponses, job *api.Job) error {

tmpFile, err := download(url, tmpDir)
if err != nil {
return err
return fault.Wrap(err)
}

log.Println("Download successful, starting installation")
Expand All @@ -104,13 +105,13 @@ func processJob(client *api.ClientWithResponses, job *api.Job) error {
_ = os.MkdirAll(path.Dir(destination), 0o755)
src, err := os.Open(tmpFile)
if err != nil {
return err
return fault.Wrap(err)
}
defer src.Close()

dst, err := os.Create(destination)
if err != nil {
return err
return fault.Wrap(err)
}
defer dst.Close()

Expand Down Expand Up @@ -154,7 +155,7 @@ func runScript(script string) error {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
return err
return fault.Wrap(err)
}
return nil
}
30 changes: 0 additions & 30 deletions contrib/remote-access/client/go.mod

This file was deleted.

Loading

0 comments on commit b10ee74

Please sign in to comment.