Skip to content

Commit

Permalink
Merge pull request #30 from davidlukac/feature/7-github-actions-pipeline
Browse files Browse the repository at this point in the history
Feature/7 GitHub actions pipeline
  • Loading branch information
davidlukac authored Aug 27, 2021
2 parents bc76f6e + 3eda726 commit c299471
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_VERSION=0.1.0
66 changes: 66 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Main

on:
push:
branches:
- master
- develop
- feature/*
- hotfix/*

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Environment Variables from Dotenv
uses: c-py/action-dotenv-to-setenv@v3
with:
env-file: .env

- name: GoLang setup
uses: actions/setup-go@v2
with:
go-version: '^1.16'

- name: Install dependencies
run: |
echo "App version: ${{ env.APP_VERSION }}"
go version
go get -u golang.org/x/lint/golint
go mod download
- name: Run build
run: |
go build -o build/ cmd/pleasant/pleasant.go
- name: Create versioned binary
run: |
cp build/pleasant build/pleasant-${{ env.APP_VERSION }}-linux-x86_64
if: startsWith(github.ref, 'refs/tags/')

- name: Create build snapshot binary
run: |
cp build/pleasant build/pleasant-${{ env.APP_VERSION }}-snapshot-linux-x86_64
if: startsWith(github.ref, 'refs/heads/')

- name: Run vet & lint
run: |
find . -type f -name "*.go" -printf %h\\n | uniq | xargs go vet
# find . -type f -name "*.go" -printf %h\\n | uniq | xargs golint

# - name: Run testing
# run: go test ./test -v

- name: Release build snapshot
uses: softprops/[email protected]
with:
name: v${{ env.APP_VERSION }}-snapshot
tag_name: v${{ env.APP_VERSION }}-snapshot
draft: false
prerelease: true
fail_on_unmatched_files: true
files: build/pleasant-${{ env.APP_VERSION }}-snapshot-linux-x86_64
if: github.ref == 'refs/heads/master'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# Sensitive data / local configuration
.pleasant.yaml

# Build
build/
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/davidlukac/go-pleasant-cli
go 1.16

require (
github.com/davidlukac/go-pleasant-vault-client v0.0.0-20201104101430-cf5b96afb3ed
github.com/davidlukac/go-pleasant-vault-client v0.0.0-20210727160429-5df1ebb67bd6
github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5
github.com/mikefarah/yq/v4 v4.10.0
github.com/sirupsen/logrus v1.8.1
Expand All @@ -13,4 +13,5 @@ require (
gopkg.in/yaml.v2 v2.4.0
)

replace github.com/davidlukac/go-pleasant-vault-client v0.0.0-20201104101430-cf5b96afb3ed => ../go-pleasant-vault-client
// Local development:
//replace github.com/davidlukac/go-pleasant-vault-client v0.0.0-20210727160429-5df1ebb67bd6 => ../go-pleasant-vault-client
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davidlukac/go-pleasant-vault-client v0.0.0-20210727160429-5df1ebb67bd6 h1:8kqiJ8rLCkiBTLsBBc8LS8WNjZDBp3NGsNGbzBtXe2U=
github.com/davidlukac/go-pleasant-vault-client v0.0.0-20210727160429-5df1ebb67bd6/go.mod h1:3EdPrrEwAXv4MqceRLS9nZLD2pFO9qf4/ph6SE8mpGM=
github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5 h1:RAV05c0xOkJ3dZGS0JFybxFKZ2WMLabgx3uXnd7rpGs=
github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5/go.mod h1:GgB8SF9nRG+GqaDtLcwJZsQFhcogVCJ79j4EdT0c2V4=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
Expand Down Expand Up @@ -204,7 +206,6 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jinzhu/copier v0.2.8 h1:N8MbL5niMwE3P4dOwurJixz5rMkKfujmMRFmAanSzWE=
github.com/jinzhu/copier v0.2.8/go.mod h1:24xnZezI2Yqac9J61UC6/dG/k76ttpq0DdJI3QmUvro=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
Expand Down

0 comments on commit c299471

Please sign in to comment.