Skip to content
Merged
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
7 changes: 0 additions & 7 deletions .github/dependabot.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
"schedule:weekly",
"group:allNonMajor"
],
"minimumReleaseAge": "24 hours",
"postUpdateOptions": ["gomodTidy"],
"packageRules": [
{
"matchManagers": ["github-actions"],
"groupName": "github-actions"
}
]
}
11 changes: 4 additions & 7 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,21 @@ concurrency:
permissions:
contents: write

env:
GO_VERSION: "1.25"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: go.mod
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v7
Comment thread
coderabbitai[bot] marked this conversation as resolved.
with:
distribution: goreleaser
version: '~> v2'
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,29 @@ concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
GO_VERSION: "1.25"

jobs:
lint-and-test:
name: Lint & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
Comment thread
pilat marked this conversation as resolved.

- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
Comment thread
coderabbitai[bot] marked this conversation as resolved.
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: go.mod
cache: true

- name: Lint
- name: Lint (linux)
uses: golangci/golangci-lint-action@v9
with:
version: v2.12.2

- name: Lint (darwin)
uses: golangci/golangci-lint-action@v9
with:
version: v2.7.2
version: v2.12.2
env:
GOOS: darwin

- name: Unit tests
run: go test -race ./internal/...
Expand All @@ -37,11 +41,11 @@ jobs:
name: E2E Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: go.mod
cache: true

- name: Build devbox
Expand Down
141 changes: 133 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,151 @@ version: "2"
linters:
enable:
- errcheck
# - wrapcheck # TODO
- govet
- ineffassign
- staticcheck
- goconst
# - gocyclo # TODO
- ineffassign
- bodyclose
- nilerr
- nilnil
- forcetypeassert
- contextcheck
- containedctx
- unparam
- wastedassign
- exhaustive
- errorlint
- wrapcheck
- misspell
- whitespace
- nolintlint
- revive
- unconvert
- predeclared
- usestdlibvars
- dupword
- goconst
- gocritic
- gosec
- prealloc
- perfsprint
- intrange

settings:
gocyclo:
min-complexity: 15
errcheck:
check-blank: false
govet:
enable-all: true
disable:
- fieldalignment
staticcheck:
checks:
- all
- -ST1000
errorlint:
errorf: true
errorf-multi: true
asserts: true
comparison: true
nilnil:
checked-types:
- ptr
- func
- iface
- map
- chan
gocritic:
enabled-tags:
- diagnostic
- style
- performance
disabled-checks:
- hugeParam
- rangeValCopy
- ifElseChain
- unlambda
wrapcheck:
ignore-sigs:
- .Errorf(
- errors.New(
- errors.Join(
perfsprint:
int-conversion: true
err-error: true
errorf: true
sprintf1: true
goconst:
ignore-tests: true
gosec:
excludes:
- G104
- G204
- G304
- G301
- G302
- G306
Comment thread
coderabbitai[bot] marked this conversation as resolved.
revive:
rules:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: if-return
- name: increment-decrement
- name: var-declaration
- name: range
- name: time-naming
- name: indent-error-flow
- name: empty-block
- name: superfluous-else
- name: unreachable-code
- name: redefines-builtin-id

exclusions:
generated: lax
paths:
- tmp
rules:
- linters: [gosec]
path: _test\.go
- linters: [dupword]
path: _test\.go
- linters: [errcheck]
path: _test\.go
source: "Close\\(\\)"
- linters: [bodyclose]
path: _test\.go
- linters: [wrapcheck]
path: _test\.go
- linters: [containedctx]
path: _test\.go
- linters: [goconst]
path: _test\.go
- linters: [errcheck]
source: "defer .+\\.Close\\("
- linters: [govet]
text: 'shadow: declaration of "err" shadows'
- linters: [unparam]
source: "^func \\(.+\\) .+\\(.*\\) .+ \\{$"
- linters: [wrapcheck]
source: "ctx\\.Err\\(\\)"

formatters:
enable:
- gofmt
- goimports
- gofumpt
- gci
- golines
settings:
gofumpt:
module-path: github.com/pilat/devbox
gci:
sections:
- standard
- default
- prefix(github.com/pilat/devbox)
golines:
max-len: 120
exclusions:
paths:
- tmp
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.PHONY: all tidy vendor mocks lint test test-e2e
.PHONY: all build tidy vendor mocks fmt lint test test-e2e clean

all: tidy vendor lint test

build:
go build -o devbox ./cmd/devbox/

mocks:
mockery

Expand All @@ -11,11 +14,17 @@ tidy:
vendor:
go mod vendor

fmt:
golangci-lint fmt

lint:
golangci-lint run
golangci-lint run ./...

test:
go test -race ./internal/...

test-e2e:
go test -v ./tests/e2e/ -timeout 10m -count=1

clean:
rm -f devbox
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ brew install devbox
1. Download the appropriate binary from the [Releases Page](https://github.com/pilat/devbox/releases)
2. Make the binary executable and add it to your PATH

> **macOS:** the release binaries are unsigned, so Gatekeeper blocks a downloaded
> binary until you clear its quarantine bit: `xattr -dr com.apple.quarantine ./devbox`

### System Requirements
- Docker Engine 20.10.0 or later
- Git 2.28 or later
Expand Down
13 changes: 8 additions & 5 deletions cmd/devbox/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,25 @@ import (
"context"
"fmt"

"github.com/pilat/devbox/internal/project"
"github.com/spf13/cobra"

"github.com/pilat/devbox/internal/project"
)

func init() {
cmd := &cobra.Command{
Use: "destroy",
Short: "Destroy devbox project",
Long: "That command will destroy devbox project",
ValidArgsFunction: validArgsWrapper(func(ctx context.Context, cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return []string{}, cobra.ShellCompDirectiveNoFileComp
}),
ValidArgsFunction: validArgsWrapper(
func(ctx context.Context, cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return []string{}, cobra.ShellCompDirectiveNoFileComp
},
),
RunE: runWrapper(func(ctx context.Context, cmd *cobra.Command, args []string) error {
p, err := mgr.AutodetectProject(ctx, projectName)
if err != nil {
return err
return fmt.Errorf("failed to detect project: %w", err)
}

if err := runDown(ctx, p, true); err != nil {
Expand Down
Loading