Skip to content

Commit

Permalink
add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
butlerx committed Sep 4, 2020
1 parent d4defe2 commit 84fb806
Show file tree
Hide file tree
Showing 8 changed files with 241 additions and 23 deletions.
29 changes: 14 additions & 15 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,34 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.
### Describe the bug

<!--A clear and concise description of what the bug is.-->

### To Reproduce

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
### Expected behavior

A clear and concise description of what you expected to happen.

**Screenshots**
### Screenshots

If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
- OS: [e.g. iOS]
- Version [e.g. 22]

### Additional context

**Additional context**
Add any other context about the problem here.
19 changes: 12 additions & 7 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
### Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is. Ex. I'm always
frustrated when [...]

### Describe the solution you'd like

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
### Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've
considered.

### Additional context

**Additional context**
Add any other context or screenshots about the feature request here.
62 changes: 62 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "CodeQL"

on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 21 * * 2'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['go']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
48 changes: 48 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Build and Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: Build
strategy:
matrix:
go:
- 1.13.x
- 1.14.x
- 1.15.x
platform:
- ubuntu-latest
- macos-latest
# - windows-latest
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Restore dependencies Caches
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Get dependencies
run: make dep
- name: Test
run: make test
- name: Build
run: make build
- name: Upload Binary
uses: actions/upload-artifact@v2
with:
name: asciify-${{ matrix.go }}-${{ matrix.platform }}
path: ./asciify.bin
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Upload Release Asset
on:
push:
tags:
- 'v*'
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build project
run: make release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./asciify.zip
asset_name: asciify.zip
asset_content_type: application/zip
- name: Upload Release Zip
uses: actions/upload-artifact@v2
with:
name: asciify.zip
path: ./asciify.zip
- name: Upload Release Binary
uses: actions/upload-artifact@v2
with:
name: asciify
path: ./asciify.bin
55 changes: 55 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
.DEFAULT_GOAL := help
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules

GO111MODULES=on
GIT_TAG := $(shell git describe --always --abbrev=0 --tags)
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
GIT_COMMIT := $(shell git log --pretty=format:'%h' -n 1)
VERSION="$(GIT_TAG)-$(GIT_BRANCH).$(GIT_COMMIT)"

ASCIIFY := "asciify.bin"
ASCIIFY_PKG_BUILD := "./cmd/asciify"
RELEASE_ZIP := "asciify.zip"

.PHONY: all build release
all: build release
build: $(ASCIIFY) ## Build Binary
release: $(RELEASE_ZIP) ## Package release artifact

$(ASCIIFY): dep
@echo "🍳 Building $(ASCIIFY)"
@go build -i -v -o $(ASCIIFY) -ldflags "-X main.version=$(GIT_TAG)-$(GIT_BRANCH).$(GIT_COMMIT)" $(ASCIIFY_PKG_BUILD)

$(RELEASE_ZIP): $(ASCIIFY)
@echo "🍳 Building $(RELEASE_ZIP)"
zip --junk-paths $(RELEASE_ZIP) $(ASCIIFY) README.md

.PHONY:clean
clean: ## Remove previous builds
@echo "🧹 Cleaning old build"
@go clean
@rm -f $(ASCIIFY) $(RELEASE_ZIP)

.PHONY: dep
dep: ## go get all dependencies
@echo "🛎 Updatig Dependencies"
@go get -v -d ./...

.PHONY: run
run: dep ## Compiles and runs Binary
@go run -race $(ASCIIFY_PKG_BUILD) --config configs/config.toml

.PHONY: help
help: ## Display this help screen
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: test
test: ## Runs go test with default values
@echo "🍜 Testing $(ASCIIFY)" @go test -v -count=1 -race ./...
4 changes: 3 additions & 1 deletion cmd/asciify/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"github.com/urfave/cli"
)

var version = "development"

func main() {
app := cli.NewApp()
app.Name = "asciify"
Expand All @@ -23,7 +25,7 @@ func main() {
Email: "butlerx@notthe.cloud",
},
}
app.Version = "1.0.0"
app.Version = version
app.EnableBashCompletion = true
cwd, _ := os.Getwd()
app.Flags = []cli.Flag{
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ require (
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/urfave/cli v1.20.0
)

go 1.13

0 comments on commit 84fb806

Please sign in to comment.