Skip to content

Commit

Permalink
Merge pull request #37 from gliderlabs/update-circleci
Browse files Browse the repository at this point in the history
Switch to Github Actions for CI
  • Loading branch information
josegonzalez authored Dec 1, 2021
2 parents 5679a9c + 92429ad commit 1be8ff4
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 38 deletions.
53 changes: 53 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
version: 2.1

jobs:
test:
docker:
- image: circleci/golang:1.12
steps:
- checkout
- restore_cache:
keys:
- go-mod-v4-{{ checksum "go.sum" }}
- run:
name: Prepare environment
command: make 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
steps:
- checkout
- restore_cache:
keys:
- go-mod-v4-{{ checksum "go.sum" }}
- run:
name: Release
command: |
echo "make deps build release"
workflows:
build:
jobs:
- test
- release:
filters:
branches:
only:
- release
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
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
- uses: actions/setup-go@v2
with:
go-version: '1.17.3'
- run: make deps build
- run: make test
- 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
32 changes: 15 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -24,26 +25,23 @@ 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)

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

Expand Down
20 changes: 0 additions & 20 deletions circle.yml

This file was deleted.

14 changes: 14 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
2 changes: 1 addition & 1 deletion src/module.bash
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module-load() {

module-auto-export() {
declare filename="$1"

local autoprefix="cmd:"
while read cmd; do
cmd-export "cmd:$cmd" "$cmd"
Expand Down

0 comments on commit 1be8ff4

Please sign in to comment.