Skip to content

Commit 6d0e7b2

Browse files
authored
Merge pull request #1 from skilld-labs/migrate_package
migrate package from action to launchr plugin
2 parents 87ed3dc + 1f28dbe commit 6d0e7b2

File tree

8 files changed

+741
-21
lines changed

8 files changed

+741
-21
lines changed

.gitignore

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1-
# If you prefer the allow list template instead of the deny list, see community template:
2-
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3-
#
4-
# Binaries for programs and plugins
5-
*.exe
6-
*.exe~
7-
*.dll
8-
*.so
9-
*.dylib
10-
11-
# Test binary, built with `go test -c`
12-
*.test
13-
14-
# Output of the go coverage tool, specifically when used with LiteIDE
15-
*.out
16-
17-
# Dependency directories (remove the comment below to include it)
18-
# vendor/
19-
20-
# Go workspace file
21-
go.work
1+
.DS_Store
2+
.idea
3+
/bin
4+
/build_*
5+
.launchr
6+
*.tar
7+
*.gz
8+
*.gen.go
9+
dist/
10+
vendor/

.golangci.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# More info on config here: https://github.com/golangci/golangci-lint#config-file
2+
run:
3+
deadline: 10s
4+
issues-exit-code: 1
5+
tests: true
6+
skip-dirs:
7+
- bin
8+
- vendor
9+
- var
10+
- tmp
11+
skip-files:
12+
- \.pb\.go$
13+
- \.pb\.goclay\.go$
14+
15+
output:
16+
format: colored-line-number
17+
print-issued-lines: true
18+
print-linter-name: true
19+
20+
linters-settings:
21+
govet:
22+
check-shadowing: true
23+
golint:
24+
min-confidence: 0
25+
dupl:
26+
threshold: 100
27+
goconst:
28+
min-len: 2
29+
min-occurrences: 2
30+
31+
linters:
32+
disable-all: true
33+
enable:
34+
- revive
35+
- govet
36+
- errcheck
37+
- unused
38+
- ineffassign
39+
- typecheck
40+
- dupl
41+
- goconst
42+
- gosec
43+
- goimports
44+
- megacheck # (staticcheck + gosimple + unused in one linter) - enable before push
45+
46+
issues:
47+
exclude-use-default: false
48+
exclude:
49+
# # _ instead of err checks
50+
# - G104
51+
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
52+
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv|.*Rollback). is not checked

Makefile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
export GOSUMDB=off
2+
3+
GOPATH?=$(HOME)/go
4+
FIRST_GOPATH:=$(firstword $(subst :, ,$(GOPATH)))
5+
6+
# Build available information.
7+
GIT_HASH:=$(shell git log --format="%h" -n 1 2> /dev/null)
8+
GIT_BRANCH:=$(shell git branch 2> /dev/null | grep '*' | cut -f2 -d' ')
9+
APP_VERSION:="$(GIT_BRANCH)-$(GIT_HASH)"
10+
GOPKG:=github.com/skilld-labs/plasmactl-package
11+
12+
DEBUG?=0
13+
ifeq ($(DEBUG), 1)
14+
LDFLAGS_EXTRA=
15+
BUILD_OPTS=-gcflags "all=-N -l"
16+
else
17+
LDFLAGS_EXTRA=-s -w
18+
BUILD_OPTS=-trimpath
19+
endif
20+
21+
BUILD_ENVPARMS:=CGO_ENABLED=0
22+
23+
GOBIN:=$(FIRST_GOPATH)/bin
24+
LOCAL_BIN:=$(CURDIR)/bin
25+
26+
# Linter config.
27+
GOLANGCI_BIN:=$(LOCAL_BIN)/golangci-lint
28+
GOLANGCI_TAG:=1.55.2
29+
30+
.PHONY: all
31+
all: deps test build
32+
33+
# Install go dependencies
34+
.PHONY: deps
35+
deps:
36+
$(info Installing go dependencies...)
37+
go mod download
38+
39+
# Run all tests
40+
.PHONY: test
41+
test:
42+
$(info Running tests...)
43+
go test ./...
44+
45+
# Build launchr
46+
.PHONY: build
47+
build:
48+
$(info Building launchr...)
49+
# Application related information available on build time.
50+
$(eval LDFLAGS:=-X '$(GOPKG).name=launchr' -X '$(GOPKG).version=$(APP_VERSION)' $(LDFLAGS_EXTRA))
51+
$(eval BIN?=$(LOCAL_BIN)/launchr)
52+
go generate ./...
53+
$(BUILD_ENVPARMS) go build -ldflags "$(LDFLAGS)" $(BUILD_OPTS) -o $(BIN) ./cmd/launchr
54+
55+
# Install launchr
56+
.PHONY: install
57+
install: all
58+
install:
59+
$(info Installing launchr to GOPATH...)
60+
cp $(LOCAL_BIN)/launchr $(GOBIN)/launchr
61+
62+
# Install and run linters
63+
.PHONY: lint
64+
lint: .install-lint .lint
65+
66+
# Install golangci-lint binary
67+
.PHONY: .install-lint
68+
.install-lint:
69+
ifeq ($(wildcard $(GOLANGCI_BIN)),)
70+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(LOCAL_BIN) v$(GOLANGCI_TAG)
71+
endif
72+
73+
# Runs linters
74+
.PHONY: .lint
75+
.lint:
76+
$(info Running lint...)
77+
$(GOLANGCI_BIN) run --fix ./...

cmd/launchr/main.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Package executes Launchr application.
2+
package main
3+
4+
import (
5+
"os"
6+
7+
"github.com/launchrctl/launchr"
8+
9+
_ "github.com/skilld-labs/plasmactl-package"
10+
)
11+
12+
func main() {
13+
os.Exit(launchr.Run())
14+
}

go.mod

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
module github.com/skilld-labs/plasmactl-package
2+
3+
go 1.21.6
4+
5+
require (
6+
github.com/go-git/go-git/v5 v5.11.0
7+
github.com/launchrctl/launchr v0.5.7
8+
github.com/spf13/cobra v1.8.0
9+
)
10+
11+
require (
12+
dario.cat/mergo v1.0.0 // indirect
13+
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
14+
github.com/Microsoft/go-winio v0.6.1 // indirect
15+
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
16+
github.com/a8m/envsubst v1.4.2 // indirect
17+
github.com/cloudflare/circl v1.3.7 // indirect
18+
github.com/containerd/containerd v1.7.12 // indirect
19+
github.com/containerd/log v0.1.0 // indirect
20+
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
21+
github.com/distribution/reference v0.5.0 // indirect
22+
github.com/docker/docker v25.0.1+incompatible // indirect
23+
github.com/docker/go-connections v0.5.0 // indirect
24+
github.com/docker/go-units v0.5.0 // indirect
25+
github.com/emirpasic/gods v1.18.1 // indirect
26+
github.com/felixge/httpsnoop v1.0.4 // indirect
27+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
28+
github.com/go-git/go-billy/v5 v5.5.0 // indirect
29+
github.com/go-logr/logr v1.4.1 // indirect
30+
github.com/go-logr/stdr v1.2.2 // indirect
31+
github.com/gogo/protobuf v1.3.2 // indirect
32+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
33+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
34+
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
35+
github.com/kevinburke/ssh_config v1.2.0 // indirect
36+
github.com/klauspost/compress v1.17.5 // indirect
37+
github.com/moby/moby v25.0.1+incompatible // indirect
38+
github.com/moby/patternmatcher v0.6.0 // indirect
39+
github.com/moby/sys/sequential v0.5.0 // indirect
40+
github.com/moby/sys/signal v0.7.0 // indirect
41+
github.com/moby/sys/user v0.1.0 // indirect
42+
github.com/moby/term v0.5.0 // indirect
43+
github.com/morikuni/aec v1.0.0 // indirect
44+
github.com/opencontainers/go-digest v1.0.0 // indirect
45+
github.com/opencontainers/image-spec v1.1.0-rc6 // indirect
46+
github.com/pjbgf/sha1cd v0.3.0 // indirect
47+
github.com/pkg/errors v0.9.1 // indirect
48+
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
49+
github.com/sergi/go-diff v1.1.0 // indirect
50+
github.com/sirupsen/logrus v1.9.3 // indirect
51+
github.com/skeema/knownhosts v1.2.1 // indirect
52+
github.com/spf13/pflag v1.0.5 // indirect
53+
github.com/xanzy/ssh-agent v0.3.3 // indirect
54+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
55+
go.opentelemetry.io/otel v1.22.0 // indirect
56+
go.opentelemetry.io/otel/metric v1.22.0 // indirect
57+
go.opentelemetry.io/otel/trace v1.22.0 // indirect
58+
go.uber.org/mock v0.4.0 // indirect
59+
golang.org/x/crypto v0.18.0 // indirect
60+
golang.org/x/mod v0.14.0 // indirect
61+
golang.org/x/net v0.20.0 // indirect
62+
golang.org/x/sys v0.16.0 // indirect
63+
golang.org/x/tools v0.17.0 // indirect
64+
gopkg.in/warnings.v0 v0.1.2 // indirect
65+
gopkg.in/yaml.v3 v3.0.1 // indirect
66+
)

0 commit comments

Comments
 (0)