Skip to content

Commit

Permalink
Merge pull request #27 from urfave/github-actions
Browse files Browse the repository at this point in the history
Add GitHub Actions support
  • Loading branch information
asahasrabuddhe committed Dec 5, 2019
2 parents 49a190d + 0644560 commit bf163cd
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 56 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/gfmrun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Test and Build

on:
pull_request:
branches:
master
push:
tags:
- 'v*'

jobs:
test:
name: Test GFMRUN
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v1
with:
ref: ${{ github.ref }}

- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13

- name: Set GOPATH and PATH
run: |
echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)"
echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin"
shell: bash

- name: Run Linter
run: |
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin latest
golangci-lint run
- name: Run Test Suite
uses: actions/setup-python@v1
with:
python-version: '3.x'
run: make all

- name: Build Binary
if: success() && contains(github.ref, 'v')
run: make build

- name: Create Release
id: create_release
if: success() && contains(github.ref, 'v')
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: Extract Version
if: success() && contains(github.ref, 'v')
id: extract_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

- name: Upload Linux Asset to Release
if: success() && contains(github.ref, 'v')
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./gfmrun-linux-amd64-${{ steps.extract_version.outputs.VERSION }}
asset_name: gfmrun-linux-amd64-${{ steps.extract_version.outputs.VERSION }}
asset_content_type: application/octet-stream

- name: Upload MacOS Asset to Release
if: success() && contains(github.ref, 'v')
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./gfmrun-darwin-amd64-${{ steps.extract_version.outputs.VERSION }}
asset_name: gfmrun-darwin-amd64-${{ steps.extract_version.outputs.VERSION }}
asset_content_type: application/octet-stream

- name: Upload Windows Asset to Release
if: success() && contains(github.ref, 'v')
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./gfmrun-windows-amd64-${{ steps.extract_version.outputs.VERSION }}.exe
asset_name: gfmrun-windows-amd64-${{ steps.extract_version.outputs.VERSION }}.exe
asset_content_type: application/octet-stream
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Dan Buch and contributors
Copyright (c) 2019 Dan Buch, Ajitem Sahasrabuddhe and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ lint:

.PHONY: build
build: deps
$(GO) install -x -ldflags "$(GOBUILD_LDFLAGS)" $(ALL_PACKAGES)
GOOS=linux $(GO) build -o gfmrun-linux-amd64-$(VERSION_VALUE) -x -ldflags "$(GOBUILD_LDFLAGS)" ./cmd/gfmrun/main.go
GOOS=darwin $(GO) build -o gfmrun-darwin-amd64-$(VERSION_VALUE) -x -ldflags "$(GOBUILD_LDFLAGS)" ./cmd/gfmrun/main.go
GOOS=windows $(GO) build -o gfmrun-windows-amd64-$(VERSION_VALUE).exe -x -ldflags "$(GOBUILD_LDFLAGS)" ./cmd/gfmrun/main.go

.PHONY: deps
deps:
$(GO) get -x -ldflags "$(GOBUILD_LDFLAGS)" $(ALL_PACKAGES)
$(GO) get -t -x -ldflags "$(GOBUILD_LDFLAGS)" $(ALL_PACKAGES)
go get ./...

.PHONY: clean
clean:
Expand Down
21 changes: 0 additions & 21 deletions appveyor.yml

This file was deleted.

0 comments on commit bf163cd

Please sign in to comment.