From 189a1ee799027480ea3aca6039697cafbb28d65d Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 00:22:50 -0500 Subject: [PATCH 01/14] chore: update to go modules --- go.mod | 14 ++++++++++++++ go.sum | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 go.mod create mode 100644 go.sum diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..f6233ee --- /dev/null +++ b/go.mod @@ -0,0 +1,14 @@ +module glidergun + +go 1.17 + +require ( + github.com/progrium/go-basher v5.1.4+incompatible + gopkg.in/inconshreveable/go-update.v0 v0.0.0-20150814200126-d8b0b1d421aa +) + +require ( + github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect + github.com/kr/binarydist v0.1.0 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..2ab652d --- /dev/null +++ b/go.sum @@ -0,0 +1,10 @@ +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= +github.com/kr/binarydist v0.1.0 h1:6kAoLA9FMMnNGSehX0s1PdjbEaACznAv/W219j2uvyo= +github.com/kr/binarydist v0.1.0/go.mod h1:DY7S//GCoz1BCd0B0EVrinCKAZN3pXe+MDaIZbXQVgM= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/progrium/go-basher v5.1.4+incompatible h1:23t6SIRLGNmrb3NfVX5t8jpxXywRnvgI7If38mKiFso= +github.com/progrium/go-basher v5.1.4+incompatible/go.mod h1:Oiy7jZEU1mm+gI1dt5MKYwxptmD37q8/UupxnwhMHtI= +gopkg.in/inconshreveable/go-update.v0 v0.0.0-20150814200126-d8b0b1d421aa h1:drvf2JoUL1fz3ttkGNkw+rf3kZa2//7XkYGpSO4NHNA= +gopkg.in/inconshreveable/go-update.v0 v0.0.0-20150814200126-d8b0b1d421aa/go.mod h1:tuNm0ntQ7IH9VSA39XxzLMpee5c2DwgIbjD4x3ydo8Y= From 59dd67758c5d5de62617f6f716a0048d3e983c21 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 00:23:05 -0500 Subject: [PATCH 02/14] chore: update to circleci 2.1 --- .circleci/config.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++ circle.yml | 20 ----------------- 2 files changed, 53 insertions(+), 20 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 circle.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..7b1a942 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,53 @@ +--- +version: 2.1 + +jobs: + build: + docker: + - image: circleci/golang:1.12 + steps: + - checkout + - restore_cache: + keys: + - go-mod-v4-{{ checksum "go.sum" }} + - run: + name: Prepare environment + command: make circleci deps build + - run: + name: Run unit tests + command: make test + - run: + name: Prepare artifacts + command: | + mkdir -p build/workspace/ + tar -czvf build/workspace/go-workspace.tgz -C ~/.go_workspace . + - save_cache: + key: go-mod-v4-{{ checksum "go.sum" }} + paths: + - "/go/pkg/mod" + - store_artifacts: + path: build + destination: build + + release: + docker: + - image: circleci/golang:1.12 + filters: + branches: + only: + - release + steps: + - checkout + - restore_cache: + keys: + - go-mod-v4-{{ checksum "go.sum" }} + - run: + name: Release + command: | + echo "make circleci deps build release" + +workflows: + build-workflow: + jobs: + - build + - release diff --git a/circle.yml b/circle.yml deleted file mode 100644 index a28376d..0000000 --- a/circle.yml +++ /dev/null @@ -1,20 +0,0 @@ -dependencies: - pre: - - make circleci - override: - - make deps - - make build - post: - - tar -czvf $CIRCLE_ARTIFACTS/gun-linux.tgz -C build/Linux gun - - tar -czvf $CIRCLE_ARTIFACTS/gun-darwin.tgz -C build/Darwin gun - - tar -czvf $CIRCLE_ARTIFACTS/go-workspace.tgz -C ~/.go_workspace . - -test: - override: - - make test - -deployment: - release: - branch: release - commands: - - make release From 5421776f08fffbcb2988b436ac6206f63154a2e3 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 00:26:08 -0500 Subject: [PATCH 03/14] fix: move branch filter to workflows directive --- .circleci/config.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7b1a942..ee20d00 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,10 +32,6 @@ jobs: release: docker: - image: circleci/golang:1.12 - filters: - branches: - only: - - release steps: - checkout - restore_cache: @@ -47,7 +43,11 @@ jobs: echo "make circleci deps build release" workflows: - build-workflow: + build: jobs: - - build - - release + - test + - release: + filters: + branches: + only: + - release From 971b18cb399245adc1a89f81c3cbc6bf9e5a1b9a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 00:26:36 -0500 Subject: [PATCH 04/14] fix: correct branch name --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ee20d00..a445c94 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 jobs: - build: + test: docker: - image: circleci/golang:1.12 steps: From 623673a5f89fde3cebbfc2a811d6908180c83850 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 00:31:43 -0500 Subject: [PATCH 05/14] feat: add github actions support --- .circleci/config.yml | 4 ++-- .circleci/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ .github/dependabot.yml | 7 +++++++ Makefile | 7 ------- 4 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 .circleci/workflows/ci.yml create mode 100644 .github/dependabot.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index a445c94..ea4382e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,7 +12,7 @@ jobs: - go-mod-v4-{{ checksum "go.sum" }} - run: name: Prepare environment - command: make circleci deps build + command: make deps build - run: name: Run unit tests command: make test @@ -40,7 +40,7 @@ jobs: - run: name: Release command: | - echo "make circleci deps build release" + echo "make deps build release" workflows: build: diff --git a/.circleci/workflows/ci.yml b/.circleci/workflows/ci.yml new file mode 100644 index 0000000..0305795 --- /dev/null +++ b/.circleci/workflows/ci.yml @@ -0,0 +1,34 @@ +--- +name: ci + +on: + pull_request: + branches: + - '*' + push: + branches: + - 'master' + - 'release' + +jobs: + ci: + name: ci + runs-on: ubuntu-18.04 + strategy: + fail-fast: true + steps: + - uses: actions/checkout@v2 + - run: make deps build + - run: make test + - run: mkdir -p build/workspace/ + - run: tar -czvf build/workspace/go-workspace.tgz -C ~/.go_workspace . + - name: upload packages + uses: actions/upload-artifact@v2 + with: + name: build + path: build/**/* + - name: make release-in-docker + run: | + if [[ "${GITHUB_REF#refs/heads/}" == "release" ]]; then + make deps build release + fi \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a48452c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +--- +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "daily" diff --git a/Makefile b/Makefile index 50151e8..273b4d1 100644 --- a/Makefile +++ b/Makefile @@ -37,13 +37,6 @@ release: gh-release checksums sha256 gh-release create $(OWNER)/$(NAME) $(VERSION) $(shell git rev-parse --abbrev-ref HEAD) v$(VERSION) -circleci: - rm ~/.gitconfig - rm -rf /home/ubuntu/.go_workspace/src/github.com/$(OWNER)/$(NAME) && cd .. \ - && mkdir -p /home/ubuntu/.go_workspace/src/github.com/$(OWNER) \ - && mv $(NAME) /home/ubuntu/.go_workspace/src/github.com/$(OWNER)/$(NAME) \ - && ln -s /home/ubuntu/.go_workspace/src/github.com/$(OWNER)/$(NAME) $(NAME) - clean: rm -rf build release From 2762969420059ddd4f0585e952fba828858d896b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 00:34:09 -0500 Subject: [PATCH 06/14] fix: put workflow in correct place --- {.circleci => .github}/workflows/ci.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {.circleci => .github}/workflows/ci.yml (100%) diff --git a/.circleci/workflows/ci.yml b/.github/workflows/ci.yml similarity index 100% rename from .circleci/workflows/ci.yml rename to .github/workflows/ci.yml From 22079ffc804a04c30217d03569570552cb3125d6 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 00:36:42 -0500 Subject: [PATCH 07/14] chore: add newline --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0305795..b26ca14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,4 +31,4 @@ jobs: run: | if [[ "${GITHUB_REF#refs/heads/}" == "release" ]]; then make deps build release - fi \ No newline at end of file + fi From 66e331e68f2b1b58a40f9fb58aaa942c9cbe72b2 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 00:40:12 -0500 Subject: [PATCH 08/14] chore: use older golang to match the golang in plugn --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b26ca14..6b37ce4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,9 @@ jobs: fail-fast: true steps: - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: '^1.12.17' - run: make deps build - run: make test - run: mkdir -p build/workspace/ From 9bc5b0763502c05b32004c5e00ce8e14ab69fbbd Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 00:44:38 -0500 Subject: [PATCH 09/14] refactor: fetch deps another way --- Makefile | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 273b4d1..474e5dc 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ -NAME=glidergun +NAME = glidergun BINARYNAME=gun -OWNER=gliderlabs -ARCH=$(shell uname -m) +OWNER =gliderlabs +HARDWARE = $(shell uname -m) +SYSTEM_NAME = $(shell uname -s | tr '[:upper:]' '[:lower:]') VERSION=0.1.0 build: src @@ -24,16 +25,20 @@ src: install: build install build/$(shell uname -s)/gun /usr/local/bin -deps: - go get -u github.com/jteeuwen/go-bindata/... - go get -u github.com/progrium/gh-release/... - go get -u github.com/progrium/basht/... - go get || true +deps gh-release: + cd / && go get -u github.com/jteeuwen/go-bindata/... + cd / && go get -u github.com/progrium/basht/... + +gh-release: + mkdir -p bin + curl -o bin/gh-release.tgz -sL https://github.com/progrium/gh-release/releases/download/v2.3.3/gh-release_2.3.3_$(SYSTEM_NAME)_$(HARDWARE).tgz + tar xf bin/gh-release.tgz -C /usr/local/bin + chmod +x /usr/local/bin/gh-release release: rm -rf release && mkdir release - tar -zcf release/$(NAME)_$(VERSION)_Linux_$(ARCH).tgz -C build/Linux $(BINARYNAME) - tar -zcf release/$(NAME)_$(VERSION)_Darwin_$(ARCH).tgz -C build/Darwin $(BINARYNAME) + tar -zcf release/$(NAME)_$(VERSION)_Linux_$(HARDWARE).tgz -C build/Linux $(BINARYNAME) + tar -zcf release/$(NAME)_$(VERSION)_Darwin_$(HARDWARE).tgz -C build/Darwin $(BINARYNAME) gh-release checksums sha256 gh-release create $(OWNER)/$(NAME) $(VERSION) $(shell git rev-parse --abbrev-ref HEAD) v$(VERSION) From c6b64a44d885e843f7fa1db4c9b9104b402cb9d8 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 00:46:32 -0500 Subject: [PATCH 10/14] fix: drop workspace tarball --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b37ce4..c68492e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,8 +23,6 @@ jobs: go-version: '^1.12.17' - run: make deps build - run: make test - - run: mkdir -p build/workspace/ - - run: tar -czvf build/workspace/go-workspace.tgz -C ~/.go_workspace . - name: upload packages uses: actions/upload-artifact@v2 with: From d7ca52d16d8f4be2eeba0921321082265665c21a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 00:52:21 -0500 Subject: [PATCH 11/14] feat: update to go 1.13 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c68492e..e6aa191 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: '^1.12.17' + go-version: '^1.13.15' - run: make deps build - run: make test - name: upload packages From 1436b75d9a1f20e19e9eefe0038028ec98c41ec5 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 01:06:10 -0500 Subject: [PATCH 12/14] fix: correct syntax --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 474e5dc..9e81ae2 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ src: install: build install build/$(shell uname -s)/gun /usr/local/bin -deps gh-release: +deps: gh-release cd / && go get -u github.com/jteeuwen/go-bindata/... cd / && go get -u github.com/progrium/basht/... From f38dee9679a7fc77257c80dcfd4d0b8ef7600410 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 01:15:27 -0500 Subject: [PATCH 13/14] chore: remove whitespace --- src/module.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module.bash b/src/module.bash index 3dcc2bc..c6cfae3 100644 --- a/src/module.bash +++ b/src/module.bash @@ -13,7 +13,7 @@ module-load() { module-auto-export() { declare filename="$1" - + local autoprefix="cmd:" while read cmd; do cmd-export "cmd:$cmd" "$cmd" From 92429ad1d0e5176eeb45d3bea722bc81d99bcb8f Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 1 Dec 2021 01:17:05 -0500 Subject: [PATCH 14/14] feat: pin to latest golang --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6aa191..e82da72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: '^1.13.15' + go-version: '1.17.3' - run: make deps build - run: make test - name: upload packages