Skip to content

Commit bf163cd

Browse files
Merge pull request #27 from urfave/github-actions
Add GitHub Actions support
2 parents 49a190d + 0644560 commit bf163cd

File tree

5 files changed

+100
-56
lines changed

5 files changed

+100
-56
lines changed

.github/workflows/gfmrun.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Test and Build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
master
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
jobs:
12+
test:
13+
name: Test GFMRUN
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Code
17+
uses: actions/checkout@v1
18+
with:
19+
ref: ${{ github.ref }}
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v1
23+
with:
24+
go-version: 1.13
25+
26+
- name: Set GOPATH and PATH
27+
run: |
28+
echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)"
29+
echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin"
30+
shell: bash
31+
32+
- name: Run Linter
33+
run: |
34+
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin latest
35+
golangci-lint run
36+
37+
- name: Run Test Suite
38+
uses: actions/setup-python@v1
39+
with:
40+
python-version: '3.x'
41+
run: make all
42+
43+
- name: Build Binary
44+
if: success() && contains(github.ref, 'v')
45+
run: make build
46+
47+
- name: Create Release
48+
id: create_release
49+
if: success() && contains(github.ref, 'v')
50+
uses: actions/create-release@v1
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
with:
54+
tag_name: ${{ github.ref }}
55+
release_name: Release ${{ github.ref }}
56+
draft: false
57+
prerelease: false
58+
59+
- name: Extract Version
60+
if: success() && contains(github.ref, 'v')
61+
id: extract_version
62+
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
63+
64+
- name: Upload Linux Asset to Release
65+
if: success() && contains(github.ref, 'v')
66+
uses: actions/upload-release-asset@v1.0.1
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
with:
70+
upload_url: ${{ steps.create_release.outputs.upload_url }}
71+
asset_path: ./gfmrun-linux-amd64-${{ steps.extract_version.outputs.VERSION }}
72+
asset_name: gfmrun-linux-amd64-${{ steps.extract_version.outputs.VERSION }}
73+
asset_content_type: application/octet-stream
74+
75+
- name: Upload MacOS Asset to Release
76+
if: success() && contains(github.ref, 'v')
77+
uses: actions/upload-release-asset@v1.0.1
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
with:
81+
upload_url: ${{ steps.create_release.outputs.upload_url }}
82+
asset_path: ./gfmrun-darwin-amd64-${{ steps.extract_version.outputs.VERSION }}
83+
asset_name: gfmrun-darwin-amd64-${{ steps.extract_version.outputs.VERSION }}
84+
asset_content_type: application/octet-stream
85+
86+
- name: Upload Windows Asset to Release
87+
if: success() && contains(github.ref, 'v')
88+
uses: actions/upload-release-asset@v1.0.1
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
with:
92+
upload_url: ${{ steps.create_release.outputs.upload_url }}
93+
asset_path: ./gfmrun-windows-amd64-${{ steps.extract_version.outputs.VERSION }}.exe
94+
asset_name: gfmrun-windows-amd64-${{ steps.extract_version.outputs.VERSION }}.exe
95+
asset_content_type: application/octet-stream

.travis.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017 Dan Buch and contributors
3+
Copyright (c) 2019 Dan Buch, Ajitem Sahasrabuddhe and contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ lint:
5353

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

5860
.PHONY: deps
5961
deps:
60-
$(GO) get -x -ldflags "$(GOBUILD_LDFLAGS)" $(ALL_PACKAGES)
61-
$(GO) get -t -x -ldflags "$(GOBUILD_LDFLAGS)" $(ALL_PACKAGES)
62+
go get ./...
6263

6364
.PHONY: clean
6465
clean:

appveyor.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)